]> git.mdlowis.com Git - proto/labwc.git/commitdiff
followMouse: allow focus switching via A-Tab
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 26 Mar 2023 04:14:48 +0000 (06:14 +0200)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 26 Mar 2023 19:02:04 +0000 (20:02 +0100)
Fixes a regression caused by the recent enhancement of followMouse behavior.

Fixes: #849
Reported-by: mitigate via IRC
src/cursor.c
src/osd.c

index 08893f050b8d6ec61d7e8e4f982556d477e522f4..016b47a1e1764ec26fdcb5fa4149a4322f991299 100644 (file)
@@ -509,7 +509,8 @@ 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) {
+       if (ctx.view && rc.focus_follow_mouse && !server->osd_state.cycle_view) {
+               /* Prevent changing keyboard focus during A-Tab */
                desktop_focus_and_activate_view(&server->seat, ctx.view);
                if (rc.raise_on_focus) {
                        /*
index b63177783a62ba2e5b4f4f5a7e0d77620fd740eb..8c2ee64ebf30dce3e389203d58397f61c4fc528b 100644 (file)
--- a/src/osd.c
+++ b/src/osd.c
@@ -164,7 +164,6 @@ osd_on_view_destroy(struct view *view)
 void
 osd_finish(struct server *server)
 {
-       server->osd_state.cycle_view = NULL;
        server->osd_state.preview_node = NULL;
        server->osd_state.preview_anchor = NULL;
 
@@ -181,6 +180,15 @@ osd_finish(struct server *server)
 
        /* Hiding OSD may need a cursor change */
        cursor_update_focus(server);
+
+       /*
+        * We delay resetting cycle_view until after cursor_update_focus()
+        * has been called to allow A-Tab keyboard focus switching even if
+        * followMouse has been configured and the cursor is on a different
+        * surface. Otherwise cursor_update_focus() would automatically
+        * refocus the surface the cursor is currently on.
+        */
+       server->osd_state.cycle_view = NULL;
 }
 
 void