wayland: Make XDnD grab unlink source/offer manually

This currently happens by default whenever the grab is finished.
We want to eventually do this manually everywhere, so start here.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1720>
This commit is contained in:
Carlos Garnacho 2021-02-08 20:19:38 +01:00 committed by Marge Bot
parent 3322e4fa54
commit 3799606fc2

View File

@ -340,14 +340,22 @@ xdnd_send_status (MetaXWaylandDnd *dnd,
}
static void
meta_xwayland_end_dnd_grab (MetaWaylandDataDevice *data_device)
meta_xwayland_end_dnd_grab (MetaWaylandDataDevice *data_device,
gboolean success)
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandManager *manager = &compositor->xwayland_manager;
MetaWaylandDragGrab *drag_grab = compositor->seat->data_device.current_grab;
MetaXWaylandDnd *dnd = manager->dnd;
meta_wayland_data_device_end_drag (data_device);
if (drag_grab)
{
if (!success && dnd->source)
meta_wayland_data_source_set_current_offer (dnd->source, NULL);
meta_wayland_data_device_end_drag (data_device);
}
XMoveResizeWindow (xdisplay, dnd->dnd_window, -1, -1, 1, 1);
XUnmapWindow (xdisplay, dnd->dnd_window);
@ -717,7 +725,7 @@ drag_xgrab_button (MetaWaylandPointerGrab *grab,
(!meta_wayland_drag_grab_get_focus ((MetaWaylandDragGrab *) grab) ||
meta_wayland_data_source_get_current_action (data_source) ==
WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE))
meta_xwayland_end_dnd_grab (&seat->data_device);
meta_xwayland_end_dnd_grab (&seat->data_device, FALSE);
}
static const MetaWaylandPointerGrabInterface drag_xgrab_interface = {
@ -861,7 +869,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor,
{
dnd->client_message_timestamp = event->data.l[2];
meta_wayland_surface_drag_dest_drop (drag_focus);
meta_xwayland_end_dnd_grab (&seat->data_device);
meta_xwayland_end_dnd_grab (&seat->data_device, TRUE);
return TRUE;
}
}
@ -900,7 +908,7 @@ meta_xwayland_dnd_handle_xfixes_selection_notify (MetaWaylandCompositor *composi
}
else if (event->owner == None)
{
meta_xwayland_end_dnd_grab (data_device);
meta_xwayland_end_dnd_grab (data_device, FALSE);
}
return FALSE;