]> git.mdlowis.com Git - proto/labwc.git/commitdiff
cursor: fix focus.followMouse glitches
authorJohan Malm <jgm323@gmail.com>
Thu, 23 Mar 2023 21:39:49 +0000 (21:39 +0000)
committerConsolatis <35009135+Consolatis@users.noreply.github.com>
Thu, 23 Mar 2023 22:02:29 +0000 (23:02 +0100)
Update focus correctly when using `<focus><followMouse>` and (a) the
focused window is closed; and (b) after switching desktops using action
GoToDesktop. Issue #830

Written-by: @Consolatis
Reported-by: @jech
src/cursor.c

index 8c217c2f432a6f0d8dae36d904c97c9256e72a77..08893f050b8d6ec61d7e8e4f982556d477e522f4 100644 (file)
@@ -508,6 +508,19 @@ 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) {
+               desktop_focus_and_activate_view(&server->seat, ctx.view);
+               if (rc.raise_on_focus) {
+                       /*
+                        * Call view method directly as desktop_move_to_front()
+                        * contains a call to cursor_update_focus() and thus
+                        * loops inifinitely
+                        */
+                       ctx.view->impl->move_to_front(ctx.view);
+               }
+       }
+
        cursor_update_common(server, &ctx, msec(&now),
                /*cursor_has_moved*/ false);
 }