From d48129f5ee5e49a8743b9fa1d8230f9fc99467ef Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 21 Nov 2023 23:10:23 +0100 Subject: [PATCH] wayland: Fix pointer cursor during Wayland grabs With Wayland popups and drag-and-drop using grabs, we should let window cursors prevail when there is one in effect. Also, resort always to the actor as known by the stage. This fixes the cursor lookup right after crossing events induced by grabs, e.g. right clicking on the gtk4-demo textview without motion would keep the I-beam cursor, now results on the right actor/cursor for the menu being picked. Part-of: --- src/backends/meta-cursor-tracker.c | 5 +---- src/wayland/meta-wayland-pointer.c | 18 +++++------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/backends/meta-cursor-tracker.c b/src/backends/meta-cursor-tracker.c index cea4fae7b..bc8adcee5 100644 --- a/src/backends/meta-cursor-tracker.c +++ b/src/backends/meta-cursor-tracker.c @@ -109,12 +109,9 @@ update_displayed_cursor (MetaCursorTracker *tracker) { MetaCursorTrackerPrivate *priv = meta_cursor_tracker_get_instance_private (tracker); - MetaContext *context = meta_backend_get_context (priv->backend); - MetaDisplay *display = meta_context_get_display (context); MetaCursorSprite *cursor = NULL; - if (display && meta_display_windows_are_interactable (display) && - priv->has_window_cursor) + if (priv->has_window_cursor) cursor = priv->window_cursor; else cursor = priv->root_cursor; diff --git a/src/wayland/meta-wayland-pointer.c b/src/wayland/meta-wayland-pointer.c index c4438eb31..7fa54152c 100644 --- a/src/wayland/meta-wayland-pointer.c +++ b/src/wayland/meta-wayland-pointer.c @@ -560,20 +560,12 @@ repick_for_event (MetaWaylandPointer *pointer, { ClutterActor *actor; MetaWaylandSurface *surface; + MetaBackend *backend = backend_from_pointer (pointer); + ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend)); - if (clutter_event_type (for_event) == CLUTTER_LEAVE) - { - actor = clutter_event_get_related (for_event); - } - else - { - MetaBackend *backend = backend_from_pointer (pointer); - ClutterStage *stage = CLUTTER_STAGE (meta_backend_get_stage (backend)); - - actor = clutter_stage_get_device_actor (stage, - clutter_event_get_device (for_event), - clutter_event_get_event_sequence (for_event)); - } + actor = clutter_stage_get_device_actor (stage, + clutter_event_get_device (for_event), + clutter_event_get_event_sequence (for_event)); if (META_IS_SURFACE_ACTOR_WAYLAND (actor)) {