[gtk/dnd-gestures-2: 101/175] entry: Use gdk_drag_begin



commit 1458c464ce72e6cf03a92c8b7630fbc94bec31cf
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jan 6 17:36:18 2020 -0500

    entry: Use gdk_drag_begin
    
    Use gdk_drag_begin for one-off drags.

 gtk/gtkentry.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 4ec8a0f375..b5d367a9c1 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -69,6 +69,7 @@
 #include "gtknative.h"
 #include "gtkgestureclick.h"
 #include "gtkdragsource.h"
+#include "gtkdragicon.h"
 #include "gtkwidgetpaintable.h"
 
 #include "a11y/gtkentryaccessible.h"
@@ -1464,20 +1465,22 @@ icon_drag_update_cb (GtkGestureDrag *gesture,
   if (icon_info->content != NULL &&
       gtk_drag_check_threshold (icon_info->widget, start_x, start_y, x, y))
     {
-      GtkDragSource *source;
       GdkPaintable *paintable;
+      GdkSurface *surface;
       GdkDevice *device;
+      GdkDrag *drag;
 
       icon_info->in_drag = TRUE;
-      source = gtk_drag_source_new ();
-      gtk_drag_source_set_content (source, icon_info->content);
-      gtk_drag_source_set_actions (source, icon_info->actions);
+
+      surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry)));
+      device = gtk_gesture_get_device (GTK_GESTURE (gesture));
+
+      drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y);
       paintable = gtk_widget_paintable_new (icon_info->widget);
-      gtk_drag_source_set_icon (source, paintable, -2, -2);
+      gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2);
       g_object_unref (paintable);
-      device = gtk_gesture_get_device (GTK_GESTURE (gesture));
-      gtk_drag_source_drag_begin (source, GTK_WIDGET (entry), device, start_x, start_y);
-      g_object_unref (source);
+
+      g_object_unref (drag);
     }
 }
 


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