diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 8acf7be7b5..197298ef00 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -2396,7 +2396,30 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context, break; case GDK_DRAG_PROTO_ROOTWIN: - g_warning ("Drops for GDK_DRAG_PROTO_ROOTWIN must be handled internally"); + { + GdkEvent *temp_event; + /* GTK+ traditionally has used application/x-rootwin-drop, + * but the XDND spec specifies x-rootwindow-drop. + */ + GdkAtom target1 = gdk_atom_intern_static_string ("application/x-rootwindow-drop"); + GdkAtom target2 = gdk_atom_intern_static_string ("application/x-rootwin-drop"); + + if (g_list_find (context->targets, GDK_ATOM_TO_POINTER (target1)) || + g_list_find (context->targets, GDK_ATOM_TO_POINTER (target2))) + { + temp_event = gdk_event_new (GDK_SELECTION_REQUEST); + temp_event->selection.window = g_object_ref (context->source_window); + temp_event->selection.send_event = FALSE; + temp_event->selection.selection = gdk_atom_intern_static_string ("XdndSelection"); + temp_event->selection.target = target1; + temp_event->selection.property = GDK_NONE; + temp_event->selection.requestor = g_object_ref (context->source_window); + gdk_event_set_device (temp_event, gdk_drag_context_get_device (context)); + + gdk_event_put (temp_event); + gdk_event_free (temp_event); + } + } break; case GDK_DRAG_PROTO_NONE: g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()"); diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 13cbe7102d..f5cb409629 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -1537,52 +1537,14 @@ static void gtk_drag_drop (GtkDragSourceInfo *info, guint32 time) { - if (gdk_drag_context_get_protocol (info->context) == GDK_DRAG_PROTO_ROOTWIN) - { - GtkSelectionData selection_data; - GList *tmp_list; - /* GTK+ traditionally has used application/x-rootwin-drop, but the - * XDND spec specifies x-rootwindow-drop. - */ - GdkAtom target1 = gdk_atom_intern_static_string ("application/x-rootwindow-drop"); - GdkAtom target2 = gdk_atom_intern_static_string ("application/x-rootwin-drop"); - - tmp_list = info->target_list->list; - while (tmp_list) - { - GtkTargetPair *pair = tmp_list->data; - - if (pair->target == target1 || pair->target == target2) - { - selection_data.selection = GDK_NONE; - selection_data.target = pair->target; - selection_data.data = NULL; - selection_data.length = -1; + if (info->icon_window) + gtk_widget_hide (info->icon_window); - g_signal_emit_by_name (info->widget, "drag-data-get", - info->context, &selection_data, - pair->info, - time); - - /* FIXME: Should we check for length >= 0 here? */ - gtk_drag_drop_finished (info, GTK_DRAG_RESULT_SUCCESS, time); - return; - } - tmp_list = tmp_list->next; - } - gtk_drag_drop_finished (info, GTK_DRAG_RESULT_NO_TARGET, time); - } - else - { - if (info->icon_window) - gtk_widget_hide (info->icon_window); - - gdk_drag_drop (info->context, time); - info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME, - gtk_drag_abort_timeout, - info); - g_source_set_name_by_id (info->drop_timeout, "[gtk+] gtk_drag_abort_timeout"); - } + gdk_drag_drop (info->context, time); + info->drop_timeout = gdk_threads_add_timeout (DROP_ABORT_TIME, + gtk_drag_abort_timeout, + info); + g_source_set_name_by_id (info->drop_timeout, "[gtk+] gtk_drag_abort_timeout"); } /*