[gtk+/rendering-cleanup-next: 121/153] testtooltips: Connect to draw signal
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 121/153] testtooltips: Connect to draw signal
- Date: Sat, 11 Sep 2010 05:01:36 +0000 (UTC)
commit e7f72e633d13ea35aa48ae4af3e2ae02f94780c5
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 9 00:33:57 2010 +0200
testtooltips: Connect to draw signal
tests/testtooltips.c | 25 ++++++++-----------------
1 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 35a7de0..0b01cf1 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -205,23 +205,16 @@ query_tooltip_drawing_area_cb (GtkWidget *widget,
}
static gboolean
-drawing_area_expose (GtkWidget *drawing_area,
- GdkEventExpose *event,
- gpointer data)
+drawing_area_draw (GtkWidget *drawing_area,
+ cairo_t *cr,
+ int width,
+ int height,
+ gpointer data)
{
- GtkAllocation allocation;
- GdkWindow *window;
gint i;
- cairo_t *cr;
- window = gtk_widget_get_window (drawing_area);
-
- cr = gdk_cairo_create (window);
-
- gtk_widget_get_allocation (drawing_area, &allocation);
- cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- cairo_fill (cr);
+ cairo_paint (cr);
for (i = 0; i < G_N_ELEMENTS (rectangles); i++)
{
@@ -236,8 +229,6 @@ drawing_area_expose (GtkWidget *drawing_area,
cairo_fill (cr);
}
- cairo_destroy (cr);
-
return FALSE;
}
@@ -402,8 +393,8 @@ main (int argc, char *argv[])
drawing_area = gtk_drawing_area_new ();
gtk_widget_set_size_request (drawing_area, 320, 240);
g_object_set (drawing_area, "has-tooltip", TRUE, NULL);
- g_signal_connect (drawing_area, "expose_event",
- G_CALLBACK (drawing_area_expose), NULL);
+ g_signal_connect (drawing_area, "draw",
+ G_CALLBACK (drawing_area_draw), NULL);
g_signal_connect (drawing_area, "query-tooltip",
G_CALLBACK (query_tooltip_drawing_area_cb), NULL);
gtk_box_pack_start (GTK_BOX (box), drawing_area, FALSE, FALSE, 2);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]