From b35129db6134e151ff550cde1ca6557c2ea3a8e6 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 3 May 2024 18:09:36 +0200 Subject: [PATCH] wayland: Check focus surface to set a pointer cursor The cursor was following the "current" surface (i.e. the logical focus, unaffected by e.g. grabs), so MetaWaylandPointer was always providing window cursors, just so the MetaCursorRenderer would maybe discard them and show the compositor cursor instead. E.g. in the presence of grabs. This clear barrier between grabs being compositor business deserving a compositor cursor, and non-grabs being client business turned a bit blurrier in grabs-pt5 where "client" things like popups and DnD would also involve grabs. The fixes in that regard in the branch went on the lenient side, introducing situations where grabs do exist but we are preferring client-side cursors anyways. Fix this by making MetaWaylandPointer aware of grabs at the time of updating the client-side cursor, by following the "focus" surface (i.e. the effective focus, affected by grabs outside of MetaWaylandInput). The focus surface and cursor will be updated on focus changes, also induced by grab changes. Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3460 Part-of: --- src/wayland/meta-wayland-pointer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index 88b27f84d..bfcf18d69 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -1133,7 +1133,7 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer) MetaBackend *backend = backend_from_pointer (pointer); MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend); - if (pointer->current) + if (pointer->focus_surface) { MetaCursorSprite *cursor_sprite = NULL;