]> git.mdlowis.com Git - proto/labwc.git/commitdiff
window-rules: add ignoreConfigureRequest
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sat, 13 Apr 2024 18:36:09 +0000 (20:36 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 21 Apr 2024 19:31:55 +0000 (20:31 +0100)
This allows to ignore X11 client side configure requests
like positioning and resizing and can be used to fight
some X11 applications that persist to have their windows
spawn at specific places and sizes.

Fixes: #1446
docs/labwc-config.5.scd
include/window-rules.h
src/config/rcxml.c
src/window-rules.c
src/xwayland.c

index b9d9e4d125e4d89d560d72cdc6900766b84056a9..a52daa6762dce662aa11bf70a3f84bcecac4fa0d 100644 (file)
@@ -875,7 +875,11 @@ situation.
        on-screen-display).
 
 *<windowRules><windowRule ignoreFocusRequest="">* [yes|no|default]
-       *ignoreFocusRequest* prevent window to activate itself.
+       *ignoreFocusRequest* prevents window to activate itself.
+
+*<windowRules><windowRule ignoreConfigureRequest="">* [yes|no|default]
+       *ignoreConfigureRequest* prevents a X11 window to position and size
+       itself.
 
 *<windowRules><windowRule fixedPosition="">* [yes|no|default]
        *fixedPosition* disallows interactive move/resize and prevents
index 55741f4c0f4d19afb2e2da8ee2045e3cbb21c51e..3bbc3b9781e506d45ac8bf66e5c7756feea6fc68 100644 (file)
@@ -31,6 +31,7 @@ struct window_rule {
        enum property skip_taskbar;
        enum property skip_window_switcher;
        enum property ignore_focus_request;
+       enum property ignore_configure_request;
        enum property fixed_position;
 
        struct wl_list link; /* struct rcxml.window_rules */
index 1262f035bdf507e9e550dc28e09ff0521d749b83..fd55c591706929307796ea5c4241fa19d29d4d8d 100644 (file)
@@ -209,6 +209,8 @@ fill_window_rule(char *nodename, char *content)
                set_property(content, &current_window_rule->skip_window_switcher);
        } else if (!strcasecmp(nodename, "ignoreFocusRequest")) {
                set_property(content, &current_window_rule->ignore_focus_request);
+       } else if (!strcasecmp(nodename, "ignoreConfigureRequest")) {
+               set_property(content, &current_window_rule->ignore_configure_request);
        } else if (!strcasecmp(nodename, "fixedPosition")) {
                set_property(content, &current_window_rule->fixed_position);
 
index 5c16c2bac4392af55b36beec526fb19d5b539b02..b6b299954935ea73f676f4f8f4014bdbca8a8d78 100644 (file)
@@ -114,6 +114,10 @@ window_rules_get_property(struct view *view, const char *property)
                                        && !strcasecmp(property, "ignoreFocusRequest")) {
                                return rule->ignore_focus_request;
                        }
+                       if (rule->ignore_configure_request
+                                       && !strcasecmp(property, "ignoreConfigureRequest")) {
+                               return rule->ignore_configure_request;
+                       }
                        if (rule->fixed_position
                                        && !strcasecmp(property, "fixedPosition")) {
                                return rule->fixed_position;
index 5f90ead1d84bf61cf90c74617cf3c074f6827ad0..58d61a8076f77a9713cb856cb1957c32d8cb773d 100644 (file)
@@ -377,8 +377,10 @@ handle_request_configure(struct wl_listener *listener, void *data)
                wl_container_of(listener, xwayland_view, request_configure);
        struct view *view = &xwayland_view->base;
        struct wlr_xwayland_surface_configure_event *event = data;
+       bool ignore_configure_requests = window_rules_get_property(
+               view, "ignoreConfigureRequest") == LAB_PROP_TRUE;
 
-       if (view_is_floating(view)) {
+       if (view_is_floating(view) && !ignore_configure_requests) {
                /* Honor client configure requests for floating views */
                struct wlr_box box = {.x = event->x, .y = event->y,
                        .width = event->width, .height = event->height};