From 83cc7f76d76b45a766b4a26f29240920d647c306 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Wed, 9 Mar 2016 17:37:27 +0100 Subject: [PATCH] GtkWindow: Make it an application/x-rootwindow-drop destination This makes toplevels pseudo-transparent wrt this mimetype, so if the drag source offers this mimetype and not another that was managed by the destination-side widget hierarchy, the window will be an acceptable target for this mimetype, allowing it to trigger whatever is meant to in the source side. https://bugzilla.gnome.org/show_bug.cgi?id=763387 --- gtk/gtkwindow.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index a2be09da83..3e8d321edb 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -272,6 +272,10 @@ struct _GtkWindowPrivate GtkCssNode *decoration_node; }; +static const GtkTargetEntry dnd_dest_targets [] = { + { "application/x-rootwindow-drop", 0, 0 }, +}; + enum { SET_FOCUS, FRAME_EVENT, @@ -1693,6 +1697,11 @@ gtk_window_init (GtkWindow *window) gtk_css_node_add_class (widget_node, g_quark_from_static_string (GTK_STYLE_CLASS_BACKGROUND)); priv->scale = gtk_widget_get_scale_factor (widget); + + gtk_drag_dest_set (GTK_WIDGET (window), + GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, + dnd_dest_targets, G_N_ELEMENTS (dnd_dest_targets), + GDK_ACTION_MOVE); } static void