From a7a5ef3d37d30a777036614aa87731390a5b8dc2 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 8 Feb 2021 20:23:22 +0100 Subject: wayland: Avoid automatically decoupling source/offer after grab In the case that DnD is performed and succeeds, we want to release the grab early, and let the transfer IPC happen in the back. For that to happen without a hitch, drag source and offer must be left related to each other after undoing the grab, even though the default ungrabbing code does that automatically (indirectly, by unsetting the drag focus). In these cases, we used to manually unset the current source, so this decoupling was skipped. Notably, one missed case is X11 DnD, so we might end up with the situation there that DnD did succeed, transfer is ongoing, but the source and offer are already decoupled, this confused the machinery and missed the finishing XdndFinished to be emitted to the X11 drag source. The prior commits prepared for this source/offer decoupling being a manual operation, this commit avoids doing this automatically when ungrabbing. --- src/wayland/meta-wayland-data-device.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index db77f11ca..854bdfc80 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -352,6 +352,7 @@ drag_grab_motion (MetaWaylandPointerGrab *grab, static void data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab) { + meta_wayland_drag_grab_set_source (drag_grab, NULL); meta_wayland_drag_grab_set_focus (drag_grab, NULL); if (drag_grab->drag_origin) @@ -366,8 +367,6 @@ data_device_end_drag_grab (MetaWaylandDragGrab *drag_grab) wl_list_remove (&drag_grab->drag_icon_listener.link); } - meta_wayland_drag_grab_set_source (drag_grab, NULL); - if (drag_grab->feedback_actor) { clutter_actor_remove_all_children (drag_grab->feedback_actor); @@ -448,9 +447,6 @@ drag_grab_button (MetaWaylandPointerGrab *grab, meta_wayland_data_source_has_target (source) && meta_wayland_data_source_get_current_action (source)) { - /* Detach the data source from the grab, it's meant to live longer */ - meta_wayland_drag_grab_set_source (drag_grab, NULL); - meta_wayland_surface_drag_dest_drop (drag_grab->drag_focus); meta_wayland_data_source_notify_drop_performed (source); -- cgit v1.2.1