tests: Don't use gtk_drag_set_icon_surface()
authorBenjamin Otte <otte@redhat.com>
Mon, 26 Mar 2018 16:30:34 +0000 (18:30 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 26 Mar 2018 16:30:34 +0000 (18:30 +0200)
tests/testlist3.c

index 62ffc8a33ae96031cb9ddafe805e61da2d075475..f11b01146de4e319924efbf6ea7908e4a45d734f 100644 (file)
@@ -11,25 +11,29 @@ drag_begin (GtkWidget      *widget,
 {
   GtkWidget *row;
   GtkAllocation alloc;
-  cairo_surface_t *surface;
+  GtkSnapshot *snapshot;
+  GdkPaintable *paintable;
   cairo_t *cr;
   int x, y;
 
   row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
   gtk_widget_get_allocation (row, &alloc);
-  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, alloc.width, alloc.height);
-  cr = cairo_create (surface);
+  snapshot = gtk_snapshot_new (FALSE, NULL, "DragIcon");
+  cr = gtk_snapshot_append_cairo (snapshot,
+                                  &GRAPHENE_RECT_INIT(0, 0, alloc.width, alloc.height),
+                                  "DragText");
 
   gtk_style_context_add_class (gtk_widget_get_style_context (row), "during-dnd");
   gtk_widget_draw (row, cr);
   gtk_style_context_remove_class (gtk_widget_get_style_context (row), "during-dnd");
 
+  cairo_destroy (cr);
+  paintable = gtk_snapshot_free_to_paintable (snapshot);
+
   gtk_widget_translate_coordinates (widget, row, 0, 0, &x, &y);
-  cairo_surface_set_device_offset (surface, -x, -y);
-  gtk_drag_set_icon_surface (context, surface);
+  gtk_drag_set_icon_paintable (context, paintable, -x, -y);
 
-  cairo_destroy (cr);
-  cairo_surface_destroy (surface);
+  g_object_unref (paintable);
 }