dnd: Hide the drag window when we're done

We were just relying on the drag context finalize() to destroy
the window. But with garbage-collected bindings, that might
not happen as soon as we like, so explicitly hide the window
when the drag ends successfully.

https://bugzilla.gnome.org/show_bug.cgi?id=763659
This commit is contained in:
Matthias Clasen 2016-03-16 16:49:21 -04:00
parent 2407f157c7
commit 068d382689
2 changed files with 18 additions and 1 deletions

View File

@ -445,6 +445,19 @@ gdk_wayland_drag_context_cancel (GdkDragContext *context,
gdk_drag_context_set_cursor (context, NULL);
}
static void
gdk_wayland_drag_context_drop_done (GdkDragContext *context,
gboolean success)
{
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
if (success)
{
if (context_wayland->dnd_window)
gdk_window_hide (context_wayland->dnd_window);
}
}
static void
gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
{
@ -464,6 +477,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
context_class->get_selection = gdk_wayland_drag_context_get_selection;
context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window;
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
context_class->drop_done = gdk_wayland_drag_context_drop_done;
context_class->manage_dnd = gdk_wayland_drag_context_manage_dnd;
context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
context_class->action_changed = gdk_wayland_drag_context_action_changed;

View File

@ -2616,7 +2616,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
cairo_t *cr;
if (success)
return;
{
gdk_window_hide (x11_context->drag_window);
return;
}
win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window);
surface = gdk_window_create_similar_surface (x11_context->drag_window,