pixbuf-demo: Use draw signal

This commit is contained in:
Benjamin Otte 2010-09-09 00:58:30 +02:00
parent f1171c9c07
commit ebba458336

View File

@ -86,17 +86,11 @@ load_pixbufs (void)
}
/* Expose callback for the drawing area */
static gint
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
static gboolean
draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
{
cairo_t *cr;
cr = gdk_cairo_create (event->window);
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
gdk_cairo_rectangle (cr, &event->area);
cairo_fill (cr);
cairo_destroy (cr);
cairo_paint (cr);
return TRUE;
}
@ -214,8 +208,8 @@ main (int argc, char **argv)
da = gtk_drawing_area_new ();
g_signal_connect (da, "expose_event",
G_CALLBACK (expose_cb), NULL);
g_signal_connect (da, "draw",
G_CALLBACK (draw_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), da);