[gtk+] testdnd: Stop using gtk_drag_source_set_icon_pixbuf



commit c51703be60c3219665b2135d5eb1d79e22597481
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Nov 29 20:02:01 2017 -0500

    testdnd: Stop using gtk_drag_source_set_icon_pixbuf
    
    We can avoid it here as well.

 tests/testdnd.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/tests/testdnd.c b/tests/testdnd.c
index 3fbc0f6..c95817a 100644
--- a/tests/testdnd.c
+++ b/tests/testdnd.c
@@ -580,6 +580,7 @@ main (int argc, char **argv)
   GtkWidget *pixmap;
   GtkWidget *button;
   GdkPixbuf *drag_icon;
+  cairo_surface_t *surface;
   GdkContentFormats *targets;
 
   test_init ();
@@ -595,6 +596,8 @@ main (int argc, char **argv)
   gtk_container_add (GTK_CONTAINER (window), grid);
 
   drag_icon = gdk_pixbuf_new_from_xpm_data (drag_icon_xpm);
+  surface = gdk_cairo_surface_create_from_pixbuf (drag_icon, 1, NULL);
+  g_object_unref (drag_icon);
   trashcan_open = gdk_pixbuf_new_from_xpm_data (trashcan_open_xpm);
   trashcan_closed = gdk_pixbuf_new_from_xpm_data (trashcan_closed_xpm);
   
@@ -656,10 +659,10 @@ main (int argc, char **argv)
   gtk_drag_source_set (button, GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
                        targets,
                       GDK_ACTION_COPY | GDK_ACTION_MOVE);
-  gtk_drag_source_set_icon_pixbuf (button, drag_icon);
+  gtk_drag_source_set_icon_surface (button, surface);
   gdk_content_formats_unref (targets);
 
-  g_object_unref (drag_icon);
+  cairo_destroy (surface);
 
   gtk_widget_set_hexpand (button, TRUE);
   gtk_widget_set_vexpand (button, TRUE);


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