summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-03-26 18:30:34 +0200
committerBenjamin Otte <otte@redhat.com>2018-03-26 18:30:34 +0200
commitcc9908353c6fc9f36795d13735e9b06d4a013d10 (patch)
treed58f8131187148dfedabe7ff9fa3ace898723687 /tests
parent9afbf02bc219997c0a57df2460c48604876a8d3f (diff)
downloadgtk+-cc9908353c6fc9f36795d13735e9b06d4a013d10.tar.gz
tests: Don't use gtk_drag_set_icon_surface()
Diffstat (limited to 'tests')
-rw-r--r--tests/testlist3.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/testlist3.c b/tests/testlist3.c
index 62ffc8a33a..f11b01146d 100644
--- a/tests/testlist3.c
+++ b/tests/testlist3.c
@@ -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);
}