[gtk+/rendering-cleanup-next: 115/203] tests: Connect to draw signal in testellipsise



commit 2f29a7ff0f4b62fb05b6ee30b7535bf1ec601855
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 8 22:17:48 2010 +0200

    tests: Connect to draw signal in testellipsise
    
    The test seems broken, not sure why.

 tests/testellipsise.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index 1020456..e4d2b8c 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -64,27 +64,22 @@ scale_changed_cb (GtkRange *range,
 }
 
 static gboolean
-ebox_expose_event_cb (GtkWidget      *widget,
-                      GdkEventExpose *event,
-                      gpointer        data)
+ebox_draw_cb (GtkWidget *widget,
+              cairo_t   *cr,
+              gpointer   data)
 {
   PangoLayout *layout;
   const double dashes[] = { 6, 18 };
-  GtkAllocation allocation, label_allocation;
+  GtkAllocation label_allocation;
   GtkRequisition minimum_size, natural_size;
   GtkWidget *label = data;
-  cairo_t *cr;
   gint x, y;
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
   cairo_translate (cr, -0.5, -0.5);
   cairo_set_line_width (cr, 1);
 
-  gtk_widget_get_allocation (widget, &allocation);
-
   cairo_set_source_rgb (cr, 1, 1, 1);
-  cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
-  cairo_fill (cr);
+  cairo_paint (cr);
 
   gtk_widget_translate_coordinates (label, widget, 0, 0, &x, &y);
   layout = gtk_widget_create_pango_layout (widget, "");
@@ -123,8 +118,6 @@ ebox_expose_event_cb (GtkWidget      *widget,
   cairo_set_dash (cr, dashes, 2, 12.5);
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
@@ -169,7 +162,7 @@ main (int argc, char *argv[])
 
   g_signal_connect (combo, "changed", G_CALLBACK (combo_changed_cb), label);
   g_signal_connect (scale, "value-changed", G_CALLBACK (scale_changed_cb), label);
-  g_signal_connect (ebox, "expose-event", G_CALLBACK (ebox_expose_event_cb), label);
+  g_signal_connect (ebox, "draw", G_CALLBACK (ebox_draw_cb), label);
 
   gtk_widget_show_all (window);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]