[gtk+] GtkWindow: Make it an application/x-rootwindow-drop destination



commit 83cc7f76d76b45a766b4a26f29240920d647c306
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 9 17:37:27 2016 +0100

    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 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index a2be09d..3e8d321 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]