diff options
author | Benjamin Otte <otte@redhat.com> | 2010-09-09 01:15:14 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-09-26 15:11:41 +0200 |
commit | 97b997d59e654c398d56b7883d671fc99d53f43b (patch) | |
tree | 98323178bd449973574267ff0e2c133bdda9c80d | |
parent | b271c76c069c8fda8297cbb672d1692ceaa1e791 (diff) | |
download | gtk+-97b997d59e654c398d56b7883d671fc99d53f43b.tar.gz |
testpixbuf-save: Use the draw signal
-rw-r--r-- | demos/testpixbuf-save.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/demos/testpixbuf-save.c b/demos/testpixbuf-save.c index f3e9f046d9..e7cdd6034c 100644 --- a/demos/testpixbuf-save.c +++ b/demos/testpixbuf-save.c @@ -307,21 +307,16 @@ close_app (GtkWidget *widget, gpointer data) return TRUE; } -static int -expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data) +static gboolean +draw_cb (GtkWidget *drawing_area, cairo_t *cr, gpointer data) { GdkPixbuf *pixbuf; - cairo_t *cr; pixbuf = (GdkPixbuf *) g_object_get_data (G_OBJECT (drawing_area), "pixbuf"); - cr = gdk_cairo_create (evt->window); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); - gdk_cairo_rectangle (cr, &evt->area); - cairo_fill (cr); - - cairo_destroy (cr); + cairo_paint (cr); return FALSE; } @@ -377,8 +372,8 @@ main (int argc, char **argv) gtk_widget_set_size_request (GTK_WIDGET (drawing_area), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf)); - g_signal_connect (drawing_area, "expose_event", - G_CALLBACK (expose_cb), NULL); + g_signal_connect (drawing_area, "draw", + G_CALLBACK (draw_cb), NULL); g_signal_connect (drawing_area, "configure_event", G_CALLBACK (configure_cb), NULL); |