cursor: fix focus.followMouse glitches

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
This commit is contained in:
Johan Malm 2023-03-23 21:39:49 +00:00 committed by Consolatis
parent 7914d06760
commit f5c4651c67

View 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);
}