From f5c4651c67236191caa30b09c5e5f3774fa98864 Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Thu, 23 Mar 2023 21:39:49 +0000 Subject: [PATCH] cursor: fix focus.followMouse glitches Update focus correctly when using `` 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cursor.c b/src/cursor.c index 8c217c2f..08893f05 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -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); }