mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 00:30:08 +00:00
pixbuf-demo: Use draw signal
This commit is contained in:
parent
f1171c9c07
commit
ebba458336
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user