From 368ede74602eaba40b8a67df57dfe0b3f20331d9 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 9 Nov 2023 21:44:51 +0000 Subject: [PATCH] window-rules: add fixedPosition property ...to address regression introduced by 57075ce and enables panel/desktop clients which rely on window rules to remain in the same position when the usable-area changes (normally because an exclusive layer-shell clients is started/finished). Also disallows interactive move/resize, for example by alt + mouse-press. Fixes: #1235 --- docs/labwc-config.5.scd | 6 ++++++ docs/rc.xml.all | 1 + include/window-rules.h | 1 + src/config/rcxml.c | 2 ++ src/interactive.c | 5 +++++ src/view.c | 4 ++++ src/window-rules.c | 4 ++++ 7 files changed, 23 insertions(+) diff --git a/docs/labwc-config.5.scd b/docs/labwc-config.5.scd index f258aa18..bf658ebc 100644 --- a/docs/labwc-config.5.scd +++ b/docs/labwc-config.5.scd @@ -526,6 +526,12 @@ situation. ** [yes|no|default] *ignoreFocusRequest* prevent window to activate itself. +** [yes|no|default] + *fixedPosition* disallows interactive move/resize and prevents + re-positioning in response to changes in reserved output space, which + can be caused by ** settings or exclusive layer-shell clients + such as panels. + ## ENVIRONMENT VARIABLES *XCURSOR_THEME* and *XCURSOR_SIZE* are supported to set cursor theme diff --git a/docs/rc.xml.all b/docs/rc.xml.all index 5b323371..92a5920a 100644 --- a/docs/rc.xml.all +++ b/docs/rc.xml.all @@ -442,6 +442,7 @@ yes yes + yes diff --git a/include/window-rules.h b/include/window-rules.h index fae1daf7..626fb540 100644 --- a/include/window-rules.h +++ b/include/window-rules.h @@ -30,6 +30,7 @@ struct window_rule { enum property skip_taskbar; enum property skip_window_switcher; enum property ignore_focus_request; + enum property fixed_position; struct wl_list link; /* struct rcxml.window_rules */ }; diff --git a/src/config/rcxml.c b/src/config/rcxml.c index 0308b637..ed4c1847 100644 --- a/src/config/rcxml.c +++ b/src/config/rcxml.c @@ -159,6 +159,8 @@ fill_window_rule(char *nodename, char *content) set_property(content, ¤t_window_rule->skip_window_switcher); } else if (!strcasecmp(nodename, "ignoreFocusRequest")) { set_property(content, ¤t_window_rule->ignore_focus_request); + } else if (!strcasecmp(nodename, "fixedPosition")) { + set_property(content, ¤t_window_rule->fixed_position); /* Actions */ } else if (!strcmp(nodename, "name.action")) { diff --git a/src/interactive.c b/src/interactive.c index 25139e8b..31c3c076 100644 --- a/src/interactive.c +++ b/src/interactive.c @@ -4,6 +4,7 @@ #include "regions.h" #include "resize_indicator.h" #include "view.h" +#include "window-rules.h" static int max_move_scale(double pos_cursor, double pos_current, @@ -34,6 +35,10 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges) return; } + if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) { + return; + } + switch (mode) { case LAB_INPUT_STATE_MOVE: if (view->fullscreen) { diff --git a/src/view.c b/src/view.c index e11c6c14..4bafe7cd 100644 --- a/src/view.c +++ b/src/view.c @@ -587,6 +587,10 @@ view_adjust_floating_geometry(struct view *view, struct wlr_box *geometry) return false; } + if (window_rules_get_property(view, "fixedPosition") == LAB_PROP_TRUE) { + return false; + } + bool adjusted = false; /* * First check whether the view is onscreen. For now, "onscreen" diff --git a/src/window-rules.c b/src/window-rules.c index 2607199a..d3ed888e 100644 --- a/src/window-rules.c +++ b/src/window-rules.c @@ -128,6 +128,10 @@ window_rules_get_property(struct view *view, const char *property) && !strcasecmp(property, "ignoreFocusRequest")) { return rule->ignore_focus_request; } + if (rule->fixed_position + && !strcasecmp(property, "fixedPosition")) { + return rule->fixed_position; + } } } return LAB_PROP_UNSPECIFIED; -- 2.52.0