dnd: Handle rootwin drop in gdk

This lets us drop the only use of the drag protocol in gtk.
This commit is contained in:
Matthias Clasen 2017-12-03 06:22:25 +01:00 committed by Benjamin Otte
parent 6cfb55a396
commit e74c46fc4e

View File

@ -1503,39 +1503,6 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
static void
gtk_drag_drop (GtkDragSourceInfo *info,
guint32 time)
{
if (gdk_drag_context_get_protocol (info->context) == GDK_DRAG_PROTO_ROOTWIN)
{
GtkSelectionData selection_data;
GdkAtom found = NULL;
/* GTK+ traditionally has used application/x-rootwin-drop, but the
* XDND spec specifies x-rootwindow-drop.
*/
if (gdk_content_formats_contain_mime_type (info->target_list, "application/x-rootwindow-drop"))
found = gdk_atom_intern ("application/x-rootwindow-drop", FALSE);
if (gdk_content_formats_contain_mime_type (info->target_list, "application/x-rootwin-drop"))
found = gdk_atom_intern ("application/x-rootwin-drop", FALSE);
else found = NULL;
if (found)
{
selection_data.selection = NULL;
selection_data.target = found;
selection_data.data = NULL;
selection_data.length = -1;
g_signal_emit_by_name (info->widget, "drag-data-get",
info->context, &selection_data,
time);
/* FIXME: Should we check for length >= 0 here? */
gtk_drag_drop_finished (info, GTK_DRAG_RESULT_SUCCESS, time);
return;
}
gtk_drag_drop_finished (info, GTK_DRAG_RESULT_NO_TARGET, time);
}
else
{
if (info->icon_window)
gtk_widget_hide (info->icon_window);
@ -1545,7 +1512,6 @@ gtk_drag_drop (GtkDragSourceInfo *info,
info);
g_source_set_name_by_id (info->drop_timeout, "[gtk+] gtk_drag_abort_timeout");
}
}
/*
* Source side callbacks.