desktop: enforce followMouse focus policy more strictly

When followMouse=yes, prevent stealing focus from another view under
the cursor. The requested view *is* allowed to take focus if it ends up
under the cursor after raising, or if there is no view under the cursor
at all. (Non-view surfaces aren't currently considered.)

v2: allow focusing a new/raised view appearing under the cursor
v3: allow focusing a sub-view/sibling of the requested view
v4: fix new xdg-shell views under mouse not being focused
v5: allow focus if no other view is focused; rebase
This commit is contained in:
John Lindgren 2025-06-14 11:34:32 -04:00
parent 145de91932
commit 4025d009de
6 changed files with 54 additions and 15 deletions

View file

@ -476,10 +476,12 @@ void xdg_shell_finish(struct server *server);
void desktop_focus_view(struct view *view, bool raise);
/**
* desktop_focus_view_or_surface() - like desktop_focus_view() but can
* also focus other (e.g. xwayland-unmanaged) surfaces
* desktop_focus_for_cursor_update() - like desktop_focus_view() but can
* also focus other (e.g. xwayland-unmanaged) surfaces.
*
* Used only for cursor-driven focus updates.
*/
void desktop_focus_view_or_surface(struct seat *seat, struct view *view,
void desktop_focus_for_cursor_update(struct seat *seat, struct view *view,
struct wlr_surface *surface, bool raise);
void desktop_arrange_all_views(struct server *server);