dnd: Use a GtkPicture in gtk_dnd_set_icon_paintable()
authorBenjamin Otte <otte@redhat.com>
Tue, 19 Jun 2018 17:41:49 +0000 (19:41 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 19 Jun 2018 17:44:17 +0000 (19:44 +0200)
We don't want to get the paintable scaled down to icon size.

Also set can-shrink = FALSE to replicate GTK3 behavior with size
requests.

gtk/gtkdnd.c

index f81aa70ae23ff7feba4ad430b50fc788cac70bb2..349167f018122afb9dd32cc1ce4258bf9ebde722 100644 (file)
@@ -30,6 +30,7 @@
 #include "gtkimageprivate.h"
 #include "gtkintl.h"
 #include "gtkmain.h"
+#include "gtkpicture.h"
 #include "gtkselectionprivate.h"
 #include "gtksettingsprivate.h"
 #include "gtktooltipprivate.h"
@@ -1129,11 +1130,11 @@ gtk_drag_set_icon_definition (GdkDragContext     *context,
  * @hot_x: the X offset of the hotspot within the icon
  * @hot_y: the Y offset of the hotspot within the icon
  *
- * Sets @texture as the icon for a given drag. GTK+ retains
+ * Sets @paintable as the icon for a given drag. GTK+ retains
  * references for the arguments, and will release them when
  * they are no longer needed.
  *
- * To position the texture relative to the mouse, its top
+ * To position the @paintable relative to the mouse, its top
  * left will be positioned @hot_x, @hot_y pixels from the
  * mouse cursor.
  */
@@ -1148,7 +1149,8 @@ gtk_drag_set_icon_paintable (GdkDragContext *context,
   g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
   g_return_if_fail (GDK_IS_PAINTABLE (paintable));
 
-  widget = gtk_image_new_from_paintable (paintable);
+  widget = gtk_picture_new_for_paintable (paintable);
+  gtk_picture_set_can_shrink (GTK_PICTURE (widget), FALSE);
 
   gtk_drag_set_icon_widget_internal (context, widget, hot_x, hot_y, TRUE);
 }