[gtk+/rendering-cleanup-next: 123/203] 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: 123/203] gtk-demo: Use draw signal in color selection demo
- Date: Thu, 23 Sep 2010 10:41:26 +0000 (UTC)
commit a1111bc194c8442545251098b7bfdeefe53465bc
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 | 30 +++++++++---------------------
1 files changed, 9 insertions(+), 21 deletions(-)
---
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index 61bdbbf..d1fbe32 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]