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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3420>
This commit is contained in:
Carlos Garnacho 2023-11-21 23:10:23 +01:00 committed by Robert Mader
parent 2bcf6607d3
commit d48129f5ee
2 changed files with 6 additions and 17 deletions

View File

@ -109,12 +109,9 @@ update_displayed_cursor (MetaCursorTracker *tracker)
{ {
MetaCursorTrackerPrivate *priv = MetaCursorTrackerPrivate *priv =
meta_cursor_tracker_get_instance_private (tracker); 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; MetaCursorSprite *cursor = NULL;
if (display && meta_display_windows_are_interactable (display) && if (priv->has_window_cursor)
priv->has_window_cursor)
cursor = priv->window_cursor; cursor = priv->window_cursor;
else else
cursor = priv->root_cursor; cursor = priv->root_cursor;

View File

@ -560,20 +560,12 @@ repick_for_event (MetaWaylandPointer *pointer,
{ {
ClutterActor *actor; ClutterActor *actor;
MetaWaylandSurface *surface; 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_stage_get_device_actor (stage,
{ clutter_event_get_device (for_event),
actor = clutter_event_get_related (for_event); clutter_event_get_event_sequence (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));
}
if (META_IS_SURFACE_ACTOR_WAYLAND (actor)) if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
{ {