wayland: Fix updating pointer cursor on Drag and Drop

The logic to allow src/wayland to update the pointer cursor changed
to bypassing grabs in commit e69e4fa6, since it is nowadays the
responsibility of the DnD source to update the pointer cursor in reaction
to the negotiated action.

This is not entirely correct, and was done at the expense of regressions.
Change the logic so we explicitly check for a DnD grab existing, or use
the active focus instead (i.e. grab-aware). This fixes the regression, and
keep DnD cursor icons working.

This is a partial revert of commit e69e4fa6dbbd62677de61bcd2f5f3bec515e79ce.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3460
Fixes: e69e4fa6db ("Revert "wayland: Check focus surface to set a pointer cursor"")
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
This commit is contained in:
Carlos Garnacho 2024-12-03 18:03:50 +01:00 committed by Marge Bot
parent 0095e7d50a
commit f28f31fc32

View File

@ -57,6 +57,7 @@
#include "wayland/meta-cursor-sprite-wayland.h" #include "wayland/meta-cursor-sprite-wayland.h"
#include "wayland/meta-wayland-buffer.h" #include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-cursor-surface.h" #include "wayland/meta-wayland-cursor-surface.h"
#include "wayland/meta-wayland-data-device.h"
#include "wayland/meta-wayland-pointer.h" #include "wayland/meta-wayland-pointer.h"
#include "wayland/meta-wayland-popup.h" #include "wayland/meta-wayland-popup.h"
#include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-private.h"
@ -1137,8 +1138,17 @@ meta_wayland_pointer_update_cursor_surface (MetaWaylandPointer *pointer)
{ {
MetaBackend *backend = backend_from_pointer (pointer); MetaBackend *backend = backend_from_pointer (pointer);
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend); MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
MetaWaylandSeat *seat = meta_wayland_pointer_get_seat (pointer);
MetaWaylandDragGrab *drag_grab;
MetaWaylandSurface *surface;
if (pointer->current) drag_grab = meta_wayland_data_device_get_current_grab (&seat->data_device);
if (drag_grab)
surface = meta_wayland_drag_grab_get_origin (drag_grab);
else
surface = pointer->focus_surface;
if (surface)
{ {
MetaCursorSprite *cursor_sprite = NULL; MetaCursorSprite *cursor_sprite = NULL;