]> git.mdlowis.com Git - proto/labwc.git/commitdiff
followMouse: add followMouseRequiresMovement
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 2 Apr 2023 00:18:25 +0000 (02:18 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sat, 6 May 2023 13:13:20 +0000 (14:13 +0100)
This implements the same config option as `underMouse` in Openbox.

Fixes #862

docs/labwc-config.5.scd
docs/rc.xml.all
include/config/rcxml.h
src/config/rcxml.c
src/cursor.c

index be70b5967c4f7f9baf3fc82fa17b0f9e9000c08a..e6d03d5b1520242a84f5f8223caa983f0850d21d 100644 (file)
@@ -116,6 +116,14 @@ The rest of this man page describes configuration options.
        Make focus follow mouse, i.e. focus is given to window under mouse
        cursor. Default is no.
 
+*<focus><followMouseRequiresMovement>* [yes|no]
+       Requires cursor movement if followMouse is enabled. It is the same
+       as the "underMouse" setting in Openbox. If set to "no", labwc will
+       additionally focus the window under the cursor in all situations
+       which change the position of a window (e.g. switching workspaces,
+       opening/closing windows). Focusing a different window via A-Tab is
+       still possible, even with this setting set to "no". Default is yes.
+
 *<focus><raiseOnFocus>* [yes|no]
        Raise window to top when focused. Default is no.
 
index 3de44aae9109b5682694c34bf7cecb5656dd9f40..a8d2faba86bf41a8091350891db84da12c4ec8a1 100644 (file)
@@ -53,6 +53,7 @@
 
   <focus>
     <followMouse>no</followMouse>
+    <followMouseRequiresMovement>yes</followMouseRequiresMovement>
     <raiseOnFocus>no</raiseOnFocus>
   </focus>
 
index ad50ec82b0385178b26979f53c49c71a0a0e6c4e..7b808dfe58535a80e0861cd96c9070cb76aae3bd 100644 (file)
@@ -35,6 +35,7 @@ struct rcxml {
 
        /* focus */
        bool focus_follow_mouse;
+       bool focus_follow_mouse_requires_movement;
        bool raise_on_focus;
 
        /* theme */
index 37b5067c3a3ffae3dae4434964086cf76e566dab..466d02baae121ebb715cd901f21df9cce97b1049 100644 (file)
@@ -531,6 +531,8 @@ entry(xmlNode *node, char *nodename, char *content)
                fill_font(nodename, content, font_place);
        } else if (!strcasecmp(nodename, "followMouse.focus")) {
                set_bool(content, &rc.focus_follow_mouse);
+       } else if (!strcasecmp(nodename, "followMouseRequiresMovement.focus")) {
+               set_bool(content, &rc.focus_follow_mouse_requires_movement);
        } else if (!strcasecmp(nodename, "raiseOnFocus.focus")) {
                set_bool(content, &rc.raise_on_focus);
        } else if (!strcasecmp(nodename, "doubleClickTime.mouse")) {
@@ -720,11 +722,16 @@ rcxml_init(void)
        init_font_defaults(&rc.font_menuitem);
        init_font_defaults(&rc.font_osd);
 
+       rc.focus_follow_mouse = false;
+       rc.focus_follow_mouse_requires_movement = true;
+       rc.raise_on_focus = false;
+
        rc.doubleclick_time = 500;
        rc.scroll_factor = 1.0;
        rc.repeat_rate = 25;
        rc.repeat_delay = 600;
        rc.screen_edge_strength = 20;
+
        rc.snap_edge_range = 1;
        rc.snap_top_maximize = true;
 
index 583dde3c266a0bd06aa81af8a6f50a595e4a7d47..8746e2c28a9d66bf5fa50f117704098754ee3c26 100644 (file)
@@ -519,8 +519,10 @@ _cursor_update_focus(struct server *server)
        /* Focus surface under cursor if it isn't already focused */
        struct cursor_context ctx = get_cursor_context(server);
 
-       if (ctx.view && rc.focus_follow_mouse && !server->osd_state.cycle_view) {
-               /* Prevent changing keyboard focus during A-Tab */
+       if (ctx.view && rc.focus_follow_mouse
+                       && !rc.focus_follow_mouse_requires_movement
+                       && !server->osd_state.cycle_view) {
+               /* Prevents changing keyboard focus during A-Tab */
                desktop_focus_and_activate_view(&server->seat, ctx.view);
                if (rc.raise_on_focus) {
                        view_move_to_front(ctx.view);