From ca5f859dc8134eca53c328eaa35b6d5c1dca1856 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 13 Dec 2017 23:52:55 +0100 Subject: [PATCH] dnd: Only send DELETE request on X11 This is Xdnd-specific and doesn't need to happen elsewhere. --- gdk/x11/gdkdnd-x11.c | 11 +++++++++++ gtk/gtkdnd.c | 21 +-------------------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 618630af49..9bbd7018ad 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -2523,6 +2523,17 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context, GdkDisplay *display = GDK_WINDOW_DISPLAY (context->source_window); XEvent xev; + if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE) + { + XConvertSelection (GDK_DISPLAY_XDISPLAY (display), + gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection"), + gdk_x11_get_xatom_by_name_for_display (display, "DELETE"), + gdk_x11_get_xatom_by_name_for_display (display, "GDK_SELECTION"), + GDK_WINDOW_XID (context->source_window), + time); + /* XXX: Do we need to wait for a reply here before sending the next message? */ + } + xev.xclient.type = ClientMessage; xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished"); xev.xclient.format = 32; diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 3a1fcad9cb..231156ff2f 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -448,26 +448,7 @@ gtk_drag_finish (GdkDragContext *context, { g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); - if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE) - { - GtkWidget *selection_widget = gtk_drag_get_ipc_widget_for_display (gdk_window_get_display (gdk_drag_context_get_source_window (context))); - - g_object_ref (context); - - g_object_set_data (G_OBJECT (selection_widget), I_("drag-context"), context); - g_signal_connect (selection_widget, "selection-received", - G_CALLBACK (gtk_drag_selection_received), - NULL); - - gtk_selection_convert (selection_widget, - gdk_drag_get_selection (context), - gdk_atom_intern_static_string ("DELETE"), - time); - } - else - { - gdk_drop_finish (context, success, time); - } + gdk_drop_finish (context, success, time); } /**