[gtk+] gdkdnd: Stick to the first gdk_drag_drop_done() result
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdkdnd: Stick to the first gdk_drag_drop_done() result
- Date: Mon, 15 Feb 2016 18:07:42 +0000 (UTC)
commit 38d0d0a687c0c7416188cd6095ae4ebf69dc4f53
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon Feb 15 18:56:42 2016 +0100
gdkdnd: Stick to the first gdk_drag_drop_done() result
That way we can let ::cancel callers to override the visual
result of the operation (eg. when detaching notebook tabs on
NO_TARGET).
Also, document gdk_drag_drop_done() so it is mentioned that
this is a one-shot call.
https://bugzilla.gnome.org/show_bug.cgi?id=761954
gdk/gdkdnd.c | 9 +++++++++
gdk/gdkdndprivate.h | 2 ++
2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
index b76b110..02d8d53 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdnd.c
@@ -641,6 +641,10 @@ gdk_drag_context_set_hotspot (GdkDragContext *context,
* be the last call before dropping the reference to the
* @context.
*
+ * The #GdkDragContext will only take the first gdk_drag_drop_done()
+ * call as effective, if this function is called multiple times,
+ * all subsequent calls will be ignored.
+ *
* Since: 3.20
*/
void
@@ -649,6 +653,11 @@ gdk_drag_drop_done (GdkDragContext *context,
{
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ if (context->drop_done)
+ return;
+
+ context->drop_done = TRUE;
+
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done)
GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_done (context, success);
}
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
index 8eb94b8..c66de32 100644
--- a/gdk/gdkdndprivate.h
+++ b/gdk/gdkdndprivate.h
@@ -105,6 +105,8 @@ struct _GdkDragContext {
guint32 start_time;
GdkDevice *device;
+
+ guint drop_done : 1; /* Whether gdk_drag_drop_done() was performed */
};
GList * gdk_drag_context_list (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]