summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-09-09 00:57:05 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:11:41 +0200
commitf1171c9c078a3987735abbbe0a80dabded06157a (patch)
tree6ae1e0381fb1a795f70d31d8559a7247a963e6db /demos
parentc6f28c3dbcf39e36b23402a99b4a3f589c94cec3 (diff)
downloadgtk+-f1171c9c078a3987735abbbe0a80dabded06157a.tar.gz
gtk-demo: Use draw signal in color selection demo
Diffstat (limited to 'demos')
-rw-r--r--demos/gtk-demo/colorsel.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index 61bdbbf615..d1fbe327e1 100644
--- a/demos/gtk-demo/colorsel.c
+++ b/demos/gtk-demo/colorsel.c
@@ -15,28 +15,16 @@ static GtkWidget *frame;
/* Expose callback for the drawing area
*/
static gboolean
-expose_event_callback (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
+draw_callback (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
- GdkWindow *window;
+ GtkStyle *style;
- window = gtk_widget_get_window (widget);
- if (window)
- {
- GtkStyle *style;
- cairo_t *cr;
-
- style = gtk_widget_get_style (widget);
-
- cr = gdk_cairo_create (window);
+ style = gtk_widget_get_style (widget);
- gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
- gdk_cairo_rectangle (cr, &event->area);
- cairo_fill (cr);
-
- cairo_destroy (cr);
- }
+ gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
+ cairo_paint (cr);
return TRUE;
}
@@ -112,8 +100,8 @@ do_colorsel (GtkWidget *do_widget)
da = gtk_drawing_area_new ();
- g_signal_connect (da, "expose_event",
- G_CALLBACK (expose_event_callback), NULL);
+ g_signal_connect (da, "draw",
+ G_CALLBACK (draw_callback), NULL);
/* set a minimum size */
gtk_widget_set_size_request (da, 200, 200);