diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2016-02-15 17:02:14 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2016-02-15 18:35:51 +0100 |
commit | aad3135e4c30c977c80ba39a65f28623aa4c4592 (patch) | |
tree | 74598cd689912cca989f9dfa5999a77a16c39812 /gtk/gtkdnd.c | |
parent | 1ee3df5161e243a54a1254ff203282ed678f70ae (diff) | |
download | gtk+-aad3135e4c30c977c80ba39a65f28623aa4c4592.tar.gz |
gdk: Add GdkDragCancelReason enum as argument to GdkDragContext::cancel
We should conform to a minimal set of reasons for the gtk side to emit
a better GtkDragResult than GTK_DRAG_RESULT_ERROR. This fixes the notebook
tab DnD feature, where we rely on GTK_DRAG_RESULT_NO_TARGET.
In the wayland side, unfortunately we can't honor either NO_TARGET nor
USER_CANCELLED, we don't know of the latter, so we could return false
positives on the former.
https://bugzilla.gnome.org/show_bug.cgi?id=761954
Diffstat (limited to 'gtk/gtkdnd.c')
-rw-r--r-- | gtk/gtkdnd.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 760bdde7c0..e00aab28ae 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -243,8 +243,9 @@ static void gtk_drag_source_info_destroy (GtkDragSourceInfo *info); static void gtk_drag_context_drop_performed_cb (GdkDragContext *context, guint time, GtkDragSourceInfo *info); -static void gtk_drag_context_cancel_cb (GdkDragContext *context, - GtkDragSourceInfo *info); +static void gtk_drag_context_cancel_cb (GdkDragContext *context, + GdkDragCancelReason reason, + GtkDragSourceInfo *info); static void gtk_drag_context_action_cb (GdkDragContext *context, GdkDragAction action, GtkDragSourceInfo *info); @@ -3454,10 +3455,26 @@ gtk_drag_context_drop_performed_cb (GdkDragContext *context, } static void -gtk_drag_context_cancel_cb (GdkDragContext *context, - GtkDragSourceInfo *info) +gtk_drag_context_cancel_cb (GdkDragContext *context, + GdkDragCancelReason reason, + GtkDragSourceInfo *info) { - gtk_drag_cancel_internal (info, GTK_DRAG_RESULT_ERROR, GDK_CURRENT_TIME); + GtkDragResult result; + + switch (reason) + { + case GDK_DRAG_CANCEL_NO_TARGET: + result = GTK_DRAG_RESULT_NO_TARGET; + break; + case GDK_DRAG_CANCEL_USER_CANCELLED: + result = GTK_DRAG_RESULT_USER_CANCELLED; + break; + case GDK_DRAG_CANCEL_ERROR: + default: + result = GTK_DRAG_RESULT_ERROR; + break; + } + gtk_drag_cancel_internal (info, result, GDK_CURRENT_TIME); } static void |