Merge branch 'master' into modkeys

This commit is contained in:
Simon Long 2024-06-05 09:46:29 +01:00
commit 13f2eed8b4
12 changed files with 127 additions and 61 deletions

View file

@ -9,7 +9,12 @@ indent_style = tab
indent_size = 8 indent_size = 8
max_line_length = 80 max_line_length = 80
[*.{xml,build}] [*.{xml,build,md}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[*.md]
max_line_length = 80
[COMMIT_EDITMSG]
max_line_length = 74

View file

@ -103,7 +103,7 @@ However, there are some caveats:
1. In menu.xml, the attributes *id*, *label* and *execute* must be 1. In menu.xml, the attributes *id*, *label* and *execute* must be
expressed as attributes rather than as separate child elements. expressed as attributes rather than as separate child elements.
2. Ordering of attributes can sometimes be singificant. For example, 2. Ordering of attributes can sometimes be significant. For example,
when setting fonts via attributes rather than children, when setting fonts via attributes rather than children,
*<font place="ActiveWindow" name="..." size="..." />* *<font place="ActiveWindow" name="..." size="..." />*
@ -257,14 +257,15 @@ this is for compatibility with Openbox.
- 'o' - output name (show if more than 1 monitor active) - 'o' - output name (show if more than 1 monitor active)
- 'T' - title of window - 'T' - title of window
- 't' - title of window (if different than wm-class/app-id) - 't' - title of window (if different than wm-class/app-id)
Recommend using with a mono space font, to keep alignment. Recommend using with a monospace font, to keep alignment.
- *custom - subset of printf options allowed -- man 3 printf* - *custom - subset of printf options allowed -- man 3 printf*
- random text may be inserted - random text may be inserted
- field length, example "%10" use 10 spaces, even if text uses less - field length, example "%10" use 10 spaces, even if text uses less
- left jusify text, example "%-" - left justify text, example "%-"
- right justify text, example "%" instead of "%-" - right justify text, example "%" instead of "%-"
- example, %-10 would left justify and make room for 10 charaters - example, %-10 would left justify and make room for 10 characters
- Only one custom format allowed now. Future enhancements may allow more than one. - Only one custom format allowed now. Future enhancements may
allow more than one.
*width* defines the width of the field expressed as a percentage of *width* defines the width of the field expressed as a percentage of
the overall window switcher width. The "%" character is required. the overall window switcher width. The "%" character is required.
@ -492,7 +493,7 @@ extending outward from the snapped edge.
Default is no. Default is no.
*<keyboard><keybind key=""><action name="">* *<keyboard><keybind key=""><action name="">*
Keybind action. See labwc-action(5). Keybind action. See labwc-actions(5).
*<keyboard><default />* *<keyboard><default />*
Load the default keybinds listed below. This is an addition to the Load the default keybinds listed below. This is an addition to the
@ -890,6 +891,24 @@ situation.
can be caused by *<margin>* settings or exclusive layer-shell clients can be caused by *<margin>* settings or exclusive layer-shell clients
such as panels. such as panels.
## MENU
```
<menu>
<ignoreButtonReleasePeriod>250</ignoreButtonReleasePeriod>
</menu>
```
*<menu><ignoreButtonReleasePeriod>*
How long (in milliseconds) the initial button release event is ignored
for. The reason for this logic and behaviour is to avoid a fast
press-move-release sequence indended to just open the menu resulting in
the closure of the menu or the selection of (typically the first) menu
item. This behaviour only affects the first button-release. It is not
anticipated that most users will want to change this, but the config
option has been exposed for unusual use-cases. It is equivalent to
Openbox's `<hideDelay>`. Default is 250 ms.
## ENVIRONMENT VARIABLES ## ENVIRONMENT VARIABLES
*XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme *XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme

View file

@ -57,7 +57,7 @@ The menu file must be entirely enclosed within <openbox_menu> and
The visible name of the menu item. The visible name of the menu item.
*menu.item.action* *menu.item.action*
See labwc-action(5). Note: XML CDATA is supported for this node in See labwc-actions(5). Note: XML CDATA is supported for this node in
order to maintain compatibility with obmenu-generator. order to maintain compatibility with obmenu-generator.
*menu.separator* *menu.separator*
@ -107,4 +107,4 @@ interpreted as a user-override.
# SEE ALSO # SEE ALSO
labwc(1), labwc-action(5), labwc-config(5), labwc-theme(5) labwc(1), labwc-actions(5), labwc-config(5), labwc-theme(5)

View file

@ -131,18 +131,20 @@ openbox and is used by many popular themes. For the sake of brevity, these
elements are not listed here, but are supported. elements are not listed here, but are supported.
*window.active.shadow.size* *window.active.shadow.size*
Size of the drop-shadow for the focused window, in pixels. Default is 60. Size of the drop-shadow for the focused window, in pixels.
Default is 60.
*window.inactive.shadow.size* *window.inactive.shadow.size*
Size of drop-shadows for non-focused windows, in pixels. Default is 40. Size of drop-shadows for non-focused windows, in pixels.
Default is 40.
*window.active.shadow.color* *window.active.shadow.color*
Color of the drop-shadow for the focused window, including opacity. Default Color of the drop-shadow for the focused window, including opacity.
is #00000060 (black with 38% opacity). Default is #00000060 (black with 38% opacity).
*window.inactive.shadow.color* *window.inactive.shadow.color*
Color of drop-shadows for non-focused windows, including opacity. Default is Color of drop-shadows for non-focused windows, including opacity.
#00000040 (black with 25% opacity). Default is #00000040 (black with 25% opacity).
*menu.items.bg.color* *menu.items.bg.color*
Background color of inactive menu items. Background color of inactive menu items.
@ -173,15 +175,15 @@ elements are not listed here, but are supported.
*window.active.title.bg.color* if not set. *window.active.title.bg.color* if not set.
*osd.border.color* *osd.border.color*
Border color of on-screen-display. Inherits *osd.label.text.color* if not Border color of on-screen-display. Inherits *osd.label.text.color* if
set. not set.
*osd.border.width* *osd.border.width*
Border width of on-screen-display. Inherits *border.width* if not set. Border width of on-screen-display. Inherits *border.width* if not set.
*osd.label.text.color* *osd.label.text.color*
Text color of on-screen-display. Inherits *window.active.label.text.color* if Text color of on-screen-display. Inherits
not set. *window.active.label.text.color* if not set.
*osd.window-switcher.width* *osd.window-switcher.width*
Width of window switcher in pixels. Default is 600. Width of window switcher in pixels. Default is 600.
@ -205,15 +207,15 @@ elements are not listed here, but are supported.
Default is 2. Default is 2.
*osd.window-switcher.preview.border.width* *osd.window-switcher.preview.border.width*
Border width of the outlines shown as the preview of the window selected by Border width of the outlines shown as the preview of the window selected
window switcher. Inherits *osd.border.width* if not set. by window switcher. Inherits *osd.border.width* if not set.
*osd.window-switcher.preview.border.color* *osd.window-switcher.preview.border.color*
Color(s) of the outlines shown as the preview of the window selected by Color(s) of the outlines shown as the preview of the window selected by
window switcher. Possible value is a color or up to 3 colors separated window switcher. Possible value is a color or up to 3 colors separated
by commas (e.g. "#ffffff,#000000,#ffffff"). When multiple colors are by commas (e.g. "#ffffff,#000000,#ffffff"). When multiple colors are
specified, a multi-line rectangle with each line having the specified color specified, a multi-line rectangle with each line having the specified
is drawn. If not set, this inherits the on-screen-display theme color is drawn. If not set, this inherits the on-screen-display theme
("[*osd.bg.color*],[*osd.label.text.color*],[*osd.bg.color*]"). ("[*osd.bg.color*],[*osd.label.text.color*],[*osd.bg.color*]").
*osd.workspace-switcher.boxes.width* *osd.workspace-switcher.boxes.width*
@ -225,55 +227,55 @@ elements are not listed here, but are supported.
boxes. Default is 20. boxes. Default is 20.
*snapping.overlay.region.bg.enabled* [yes|no] *snapping.overlay.region.bg.enabled* [yes|no]
Show a filled rectangle as an overlay when a window is snapped to a region. Show a filled rectangle as an overlay when a window is snapped to a
Default is yes for hardware-based renderers and no for software-based region. Default is yes for hardware-based renderers and no for
renderers. software-based renderers.
*snapping.overlay.edge.bg.enabled* [yes|no] *snapping.overlay.edge.bg.enabled* [yes|no]
Show a filled rectangle as an overlay when a window is snapped to an edge. Show a filled rectangle as an overlay when a window is snapped to an
Default is yes for hardware-based renderer and no for software-based edge. Default is yes for hardware-based renderer and no for
renderers. software-based renderers.
*snapping.overlay.region.border.enabled* [yes|no] *snapping.overlay.region.border.enabled* [yes|no]
Show an outlined rectangle as an overlay when a window is snapped to a Show an outlined rectangle as an overlay when a window is snapped to a
region. Default is no for hardware-based renderers and yes for software-based region. Default is no for hardware-based renderers and yes for
renderers. software-based renderers.
*snapping.overlay.edge.border.enabled* [yes|no] *snapping.overlay.edge.border.enabled* [yes|no]
Show an outlined rectangle as an overlay when a window is snapped to an edge. Show an outlined rectangle as an overlay when a window is snapped to an
Default is no for hardware-based renderer and yes for software-based edge. Default is no for hardware-based renderer and yes for
renderers. software-based renderers.
*snapping.overlay.region.bg.color* *snapping.overlay.region.bg.color*
Color of a filled rectangle shown as an overlay when a window is snapped to Color of a filled rectangle shown as an overlay when a window is snapped
a region. Default is #8080b380. to a region. Default is #8080b380.
*snapping.overlay.edge.bg.color* *snapping.overlay.edge.bg.color*
Color of a filled rectangle shown as an overlay when a window is snapped to Color of a filled rectangle shown as an overlay when a window is snapped
an edge. Default is #8080b380. to an edge. Default is #8080b380.
*snapping.overlay.region.border.width* *snapping.overlay.region.border.width*
Border width of an outlined rectangle shown as an overlay when a window is Border width of an outlined rectangle shown as an overlay when a window
snapped to a region. Inherits `osd.border.width` if not set. is snapped to a region. Inherits `osd.border.width` if not set.
*snapping.overlay.edge.border.width* *snapping.overlay.edge.border.width*
Border width of an outlined rectangle shown as the preview when a window is Border width of an outlined rectangle shown as the preview when a window
snapped to an edge. Inherits `osd.border.width` if not set. is snapped to an edge. Inherits `osd.border.width` if not set.
*snapping.overlay.region.border.color* *snapping.overlay.region.border.color*
Color(s) of an outlined rectangle shown as an overlay when a window is Color(s) of an outlined rectangle shown as an overlay when a window is
snapped to a region. Possible values and the default value are the same as snapped to a region. Possible values and the default value are the same
those of *osd.window-switcher.preview.border.color*. as those of *osd.window-switcher.preview.border.color*.
*snapping.overlay.edge.border.color* *snapping.overlay.edge.border.color*
Color(s) of an outlined rectangle shown as an overlay when a window is Color(s) of an outlined rectangle shown as an overlay when a window is
snapped to an edge. Possible values and the default value are the same as snapped to an edge. Possible values and the default value are the same
those of *osd.window-switcher.preview.border.color*. as those of *osd.window-switcher.preview.border.color*.
*border.color* *border.color*
Set both *window.active.border.color* and *window.inactive.border.color*. Set both *window.active.border.color* and
This is obsolete, but supported for backward compatibility as some themes *window.inactive.border.color*. This is obsolete, but supported for
still contain it. backward compatibility as some themes still contain it.
# BUTTONS # BUTTONS

View file

@ -586,4 +586,7 @@
</windowRules> </windowRules>
--> -->
<menu>
<ignoreButtonReleasePeriod>250</ignoreButtonReleasePeriod>
</menu>
</labwc_config> </labwc_config>

View file

@ -137,6 +137,9 @@ struct rcxml {
} window_switcher; } window_switcher;
struct wl_list window_rules; /* struct window_rule.link */ struct wl_list window_rules; /* struct window_rule.link */
/* Menu */
unsigned int menu_ignore_button_release_period;
}; };
extern struct rcxml rc; extern struct rcxml rc;

View file

@ -3,13 +3,14 @@
#define LABWC_VIEW_H #define LABWC_VIEW_H
#include "config.h" #include "config.h"
#include "ssd.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <wayland-util.h> #include <wayland-util.h>
#include <wlr/util/box.h> #include <wlr/util/box.h>
#include <xkbcommon/xkbcommon.h> #include <xkbcommon/xkbcommon.h>
#define LAB_MIN_VIEW_WIDTH 100 #define LAB_MIN_VIEW_WIDTH (SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT)
#define LAB_MIN_VIEW_HEIGHT 60 #define LAB_MIN_VIEW_HEIGHT 60
/* /*

View file

@ -1034,6 +1034,8 @@ entry(xmlNode *node, char *nodename, char *content)
} else { } else {
wlr_log(WLR_ERROR, "Missing 'button' argument for tablet button mapping"); wlr_log(WLR_ERROR, "Missing 'button' argument for tablet button mapping");
} }
} else if (!strcasecmp(nodename, "ignoreButtonReleasePeriod.menu")) {
rc.menu_ignore_button_release_period = atoi(content);
} }
} }
@ -1238,6 +1240,8 @@ rcxml_init(void)
rc.workspace_config.popuptime = INT_MIN; rc.workspace_config.popuptime = INT_MIN;
rc.workspace_config.min_nr_workspaces = 1; rc.workspace_config.min_nr_workspaces = 1;
rc.menu_ignore_button_release_period = 250;
} }
static void static void

View file

@ -929,6 +929,8 @@ handle_press_mousebinding(struct server *server, struct cursor_context *ctx,
return consumed_by_frame_context; return consumed_by_frame_context;
} }
static uint32_t press_msec;
static void static void
cursor_button_press(struct seat *seat, uint32_t button, cursor_button_press(struct seat *seat, uint32_t button,
enum wlr_button_state button_state, uint32_t time_msec) enum wlr_button_state button_state, uint32_t time_msec)
@ -936,6 +938,9 @@ cursor_button_press(struct seat *seat, uint32_t button,
struct server *server = seat->server; struct server *server = seat->server;
struct cursor_context ctx = get_cursor_context(server); struct cursor_context ctx = get_cursor_context(server);
/* Used on next button release to check if it can close menu or select menu item */
press_msec = time_msec;
/* Determine closest resize edges in case action is Resize */ /* Determine closest resize edges in case action is Resize */
uint32_t resize_edges = cursor_get_resize_edges(seat->cursor, &ctx); uint32_t resize_edges = cursor_get_resize_edges(seat->cursor, &ctx);
@ -946,6 +951,11 @@ cursor_button_press(struct seat *seat, uint32_t button,
} }
if (server->input_mode == LAB_INPUT_STATE_MENU) { if (server->input_mode == LAB_INPUT_STATE_MENU) {
/*
* If menu was already opened on press, set a very small value
* so subsequent release always closes menu or selects menu item.
*/
press_msec = 0;
return; return;
} }
@ -1011,6 +1021,8 @@ cursor_button_release(struct seat *seat, uint32_t button,
seat_reset_pressed(seat); seat_reset_pressed(seat);
if (server->input_mode == LAB_INPUT_STATE_MENU) { if (server->input_mode == LAB_INPUT_STATE_MENU) {
/* TODO: take into account overflow of time_msec */
if (time_msec - press_msec > rc.menu_ignore_button_release_period) {
if (ctx.type == LAB_SSD_MENU) { if (ctx.type == LAB_SSD_MENU) {
menu_call_selected_actions(server); menu_call_selected_actions(server);
} else { } else {
@ -1018,6 +1030,7 @@ cursor_button_release(struct seat *seat, uint32_t button,
cursor_update_common(server, &ctx, time_msec, cursor_update_common(server, &ctx, time_msec,
/*cursor_has_moved*/ false); /*cursor_has_moved*/ false);
} }
}
return; return;
} }

View file

@ -229,6 +229,16 @@ ssd_update_geometry(struct ssd *ssd)
int eff_width = current.width; int eff_width = current.width;
int eff_height = view_effective_height(ssd->view, /* use_pending */ false); int eff_height = view_effective_height(ssd->view, /* use_pending */ false);
if (eff_width > 0 && eff_width < LAB_MIN_VIEW_WIDTH) {
/*
* Prevent negative values in calculations like
* `width - SSD_BUTTON_WIDTH * SSD_BUTTON_COUNT`
*/
wlr_log(WLR_ERROR,
"view width is smaller than its minimal value");
return;
}
if (eff_width == cached.width && eff_height == cached.height) { if (eff_width == cached.width && eff_height == cached.height) {
if (current.x != cached.x || current.y != cached.y) { if (current.x != cached.x || current.y != cached.y) {
/* Dynamically resize extents based on position and usable_area */ /* Dynamically resize extents based on position and usable_area */

View file

@ -46,6 +46,12 @@ view_impl_map(struct view *view)
} }
} }
/*
* Some clients (e.g. Steam's Big Picture Mode window) request
* fullscreen before mapping.
*/
desktop_update_top_layer_visiblity(view->server);
wlr_log(WLR_DEBUG, "[map] identifier=%s, title=%s\n", wlr_log(WLR_DEBUG, "[map] identifier=%s, title=%s\n",
view_get_string_prop(view, "app_id"), view_get_string_prop(view, "app_id"),
view_get_string_prop(view, "title")); view_get_string_prop(view, "title"));