[gtk+] testgtk: Draw the right area in alpha window test



commit f4e1a2b8497bd6cfcd6ec63996de2c7bcd540cac
Author: Benjamin Otte <otte redhat com>
Date:   Wed Nov 8 16:09:17 2017 +0100

    testgtk: Draw the right area in alpha window test
    
    Even broken stuff is easier now.

 tests/testgtk.c |   14 ++++----------
 1 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 2e0eae0..4aaba2d 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -132,19 +132,13 @@ on_alpha_window_draw (GtkWidget *widget,
   int radius, width, height;
   GdkDisplay *display;
 
-  /* Get the child allocation to avoid painting over the borders */
-  GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
-  GtkAllocation child_allocation;
+  width = gtk_widget_get_width (widget);
+  height = gtk_widget_get_height (widget);
 
-  gtk_widget_get_allocation (child, &child_allocation);
-
-  cairo_translate (cr, child_allocation.x, child_allocation.y);
-
-  cairo_rectangle (cr, 0, 0, child_allocation.width, child_allocation.height);
+  /* avoid painting over the borders */
+  cairo_rectangle (cr, 0, 0, width, height);
   cairo_clip (cr);
 
-  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,


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