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



commit 04e5f7569ebf8b56a09b1da0e3186b5e34aed4ab
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 |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index 1020456..31e5453 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -64,27 +64,24 @@ 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,
+              int        width,
+              int        height,
+              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 +120,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 +164,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]