[gtk+/rendering-cleanup-next: 122/153] gtk-demo: Use draw signal in color selection demo
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 122/153] gtk-demo: Use draw signal in color selection demo
- Date: Sat, 11 Sep 2010 05:01:41 +0000 (UTC)
commit 18de42c0954202342149844f3fecfa8bca1cd4b6
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 9 00:57:05 2010 +0200
gtk-demo: Use draw signal in color selection demo
demos/gtk-demo/colorsel.c | 32 +++++++++++---------------------
1 files changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index 61bdbbf..b30e86a 100644
--- a/demos/gtk-demo/colorsel.c
+++ b/demos/gtk-demo/colorsel.c
@@ -15,28 +15,18 @@ 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,
+ int width,
+ int height,
+ 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 +102,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]