dnd: Only send DELETE request on X11

This is Xdnd-specific and doesn't need to happen elsewhere.
This commit is contained in:
Benjamin Otte 2017-12-13 23:52:55 +01:00
parent 4042d5f242
commit ca5f859dc8
2 changed files with 12 additions and 20 deletions

View File

@ -2523,6 +2523,17 @@ gdk_x11_drag_context_drop_finish (GdkDragContext *context,
GdkDisplay *display = GDK_WINDOW_DISPLAY (context->source_window); GdkDisplay *display = GDK_WINDOW_DISPLAY (context->source_window);
XEvent xev; 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.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished"); xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "XdndFinished");
xev.xclient.format = 32; xev.xclient.format = 32;

View File

@ -448,26 +448,7 @@ gtk_drag_finish (GdkDragContext *context,
{ {
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context)); g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
if (success && gdk_drag_context_get_selected_action (context) == GDK_ACTION_MOVE) gdk_drop_finish (context, success, time);
{
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);
}
} }
/** /**