[gtk+] GtkDragSource: Don't use gtk_image_definition_new_pixbuf



commit 61b2ab5d9083a1e21e79d077dfcdfb40439a1693
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Oct 23 15:15:35 2017 +0200

    GtkDragSource: Don't use gtk_image_definition_new_pixbuf
    
    We want to get rid of pixbuf image definitions.
    
    Long term this should probably be gtk_drag_source_set_icon_surface instead.

 gtk/gtkdragsource.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkdragsource.c b/gtk/gtkdragsource.c
index 4c701b4..6ed5e94 100644
--- a/gtk/gtkdragsource.c
+++ b/gtk/gtkdragsource.c
@@ -362,6 +362,7 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
                                  GdkPixbuf *pixbuf)
 {
   GtkDragSourceSite *site;
+  cairo_surface_t *surface = NULL;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
@@ -370,7 +371,9 @@ gtk_drag_source_set_icon_pixbuf (GtkWidget *widget,
   g_return_if_fail (site != NULL); 
 
   g_clear_pointer (&site->image_def, gtk_image_definition_unref);
-  site->image_def = gtk_image_definition_new_pixbuf (pixbuf, 1);
+  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, gtk_widget_get_window (widget));
+  site->image_def = gtk_image_definition_new_surface (surface);
+  cairo_surface_destroy (surface);
 }
 
 /**


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