entry: Use gdk_drag_begin
authorMatthias Clasen <mclasen@redhat.com>
Mon, 6 Jan 2020 22:36:18 +0000 (17:36 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 8 Jan 2020 23:48:21 +0000 (18:48 -0500)
Use gdk_drag_begin for one-off drags.

gtk/gtkentry.c

index 4ec8a0f3758a99e2a8edd0970f63bbdb64c40cb4..b5d367a9c1dd7a08a0d60ffa0c3b4435aa7d3ba1 100644 (file)
@@ -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);
     }
 }