[gtk+/rendering-cleanup-next: 118/155] testgtk: Connect to draw signal in alpha test



commit 0e027f49a8a6c5f55cd52bedfa953d35adb91603
Author: Benjamin Otte <otte redhat com>
Date:   Wed Sep 8 22:25:50 2010 +0200

    testgtk: Connect to draw signal in alpha test
    
    Test still behaves weird, no idea why though.

 tests/testgtk.c |   30 ++++++++++++------------------
 1 files changed, 12 insertions(+), 18 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 2279db1..ffc5c8e 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -127,24 +127,20 @@ build_option_menu (gchar           *items[],
 
 
 static gboolean
-on_alpha_window_expose (GtkWidget      *widget,
-			GdkEventExpose *expose)
+on_alpha_window_draw (GtkWidget *widget,
+                      cairo_t   *cr)
 {
-  GtkAllocation allocation;
-  cairo_t *cr;
   cairo_pattern_t *pattern;
-  int radius;
-
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
+  int radius, width, height;
 
-  gtk_widget_get_allocation (widget, &allocation);
-
-  radius = MIN (allocation.width, allocation.height) / 2;
-  pattern = cairo_pattern_create_radial (allocation.width / 2,
-                                         allocation.height / 2,
+  width = gtk_widget_get_allocated_width (widget);
+  height = gtk_widget_get_allocated_height (widget);
+  radius = MIN (width, height) / 2;
+  pattern = cairo_pattern_create_radial (width / 2,
+                                         height / 2,
 					 0.0,
-                                         allocation.width / 2,
-                                         allocation.height / 2,
+                                         width / 2,
+                                         height / 2,
 					 radius * 1.33);
 
   if (gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)) &&
@@ -167,8 +163,6 @@ on_alpha_window_expose (GtkWidget      *widget,
   cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
   cairo_paint (cr);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
@@ -299,8 +293,8 @@ create_alpha_window (GtkWidget *widget)
 					    NULL);
 
       gtk_widget_set_app_paintable (window, TRUE);
-      g_signal_connect (window, "expose-event",
-			G_CALLBACK (on_alpha_window_expose), NULL);
+      g_signal_connect (window, "draw",
+			G_CALLBACK (on_alpha_window_draw), NULL);
 
       content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
       



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