From: Benjamin Otte Date: Mon, 26 Mar 2018 16:30:34 +0000 (+0200) Subject: tests: Don't use gtk_drag_set_icon_surface() X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~22^2~785 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cc9908353c6fc9f36795d13735e9b06d4a013d10;p=gtk4.git tests: Don't use gtk_drag_set_icon_surface() --- 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); }