summaryrefslogtreecommitdiff
path: root/tests/testcairo.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-18 22:41:15 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-19 03:02:46 +0100
commitca47c752728c050ca7a23d20161e4a049d7c4c73 (patch)
treeb34dc6828570d846a4633bad9196cdca062d2c41 /tests/testcairo.c
parent4a604cf9273378ad7bef7352f5579073789cf766 (diff)
downloadgtk+-ca47c752728c050ca7a23d20161e4a049d7c4c73.tar.gz
tests: Use new drawing area APIs in testcairo
Diffstat (limited to 'tests/testcairo.c')
-rw-r--r--tests/testcairo.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/testcairo.c b/tests/testcairo.c
index 8c45bc1c9b..e2e22d874d 100644
--- a/tests/testcairo.c
+++ b/tests/testcairo.c
@@ -113,16 +113,17 @@ draw_3circles (cairo_t *cr,
cairo_fill (cr);
}
-static gboolean
-on_draw (GtkWidget *widget,
- cairo_t *cr)
+static void
+on_draw (GtkDrawingArea *darea,
+ cairo_t *cr,
+ int width,
+ int height,
+ gpointer data)
{
cairo_surface_t *overlay, *punch, *circles;
cairo_t *overlay_cr, *punch_cr, *circles_cr;
/* Fill the background */
- int width = gtk_widget_get_allocated_width (widget);
- int height = gtk_widget_get_allocated_height (widget);
double radius = 0.5 * (width < height ? width : height) - 10;
double xc = width / 2.;
double yc = height / 2.;
@@ -181,8 +182,6 @@ on_draw (GtkWidget *widget,
cairo_surface_destroy (overlay);
cairo_surface_destroy (punch);
cairo_surface_destroy (circles);
-
- return FALSE;
}
int
@@ -200,8 +199,7 @@ main (int argc, char **argv)
darea = gtk_drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), darea);
- g_signal_connect (darea, "draw",
- G_CALLBACK (on_draw), NULL);
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (darea), on_draw, NULL, NULL);
g_signal_connect (window, "destroy-event",
G_CALLBACK (gtk_main_quit), NULL);