[gtk+] dnd: Hide the drag window when we're done
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] dnd: Hide the drag window when we're done
- Date: Mon, 21 Mar 2016 15:29:57 +0000 (UTC)
commit 068d3826896590dd7ff6e41bee88f07e1416afc9
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 16 16:49:21 2016 -0400
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
gdk/wayland/gdkdnd-wayland.c | 14 ++++++++++++++
gdk/x11/gdkdnd-x11.c | 5 ++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c
index 2a2bad5..069828d 100644
--- a/gdk/wayland/gdkdnd-wayland.c
+++ b/gdk/wayland/gdkdnd-wayland.c
@@ -446,6 +446,19 @@ gdk_wayland_drag_context_cancel (GdkDragContext *context,
}
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)
{
GObjectClass *object_class = G_OBJECT_CLASS (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;
diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c
index eceb8e9..c2a6919 100644
--- a/gdk/x11/gdkdnd-x11.c
+++ b/gdk/x11/gdkdnd-x11.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]