[gtk+] tests: Use gdk_window_new_child()



commit dff5a7bd648e507c15fc2165e25f69fbfd94e529
Author: Benjamin Otte <otte redhat com>
Date:   Mon Oct 17 20:17:03 2016 +0200

    tests: Use gdk_window_new_child()

 tests/gtkoffscreenbox.c |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/tests/gtkoffscreenbox.c b/tests/gtkoffscreenbox.c
index f8e2f00..2879be6 100644
--- a/tests/gtkoffscreenbox.c
+++ b/tests/gtkoffscreenbox.c
@@ -262,26 +262,16 @@ gtk_offscreen_box_realize (GtkWidget *widget)
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.event_mask = gtk_widget_get_events (widget)
-                       | GDK_EXPOSURE_MASK
-                       | GDK_POINTER_MOTION_MASK
-                       | GDK_BUTTON_PRESS_MASK
-                       | GDK_BUTTON_RELEASE_MASK
-                       | GDK_SCROLL_MASK
-                       | GDK_ENTER_NOTIFY_MASK
-                       | GDK_LEAVE_NOTIFY_MASK;
-
-  attributes.wclass = GDK_INPUT_OUTPUT;
-
-  attributes_mask = GDK_WA_X | GDK_WA_Y;
-
-  window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                           &attributes, attributes_mask);
+  window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
+                                 gtk_widget_get_events (widget)
+                                 | GDK_EXPOSURE_MASK
+                                 | GDK_POINTER_MOTION_MASK
+                                 | GDK_BUTTON_PRESS_MASK
+                                 | GDK_BUTTON_RELEASE_MASK
+                                 | GDK_SCROLL_MASK
+                                 | GDK_ENTER_NOTIFY_MASK
+                                 | GDK_LEAVE_NOTIFY_MASK,
+                                 &allocation);
   gtk_widget_set_window (widget, window);
   gdk_window_set_user_data (window, widget);
 
@@ -289,9 +279,22 @@ gtk_offscreen_box_realize (GtkWidget *widget)
                    G_CALLBACK (pick_offscreen_child), offscreen_box);
 
   attributes.window_type = GDK_WINDOW_OFFSCREEN;
+  attributes.wclass = GDK_INPUT_OUTPUT;
+  attributes.event_mask = gtk_widget_get_events (widget)
+                          | GDK_EXPOSURE_MASK
+                          | GDK_POINTER_MOTION_MASK
+                          | GDK_BUTTON_PRESS_MASK
+                          | GDK_BUTTON_RELEASE_MASK
+                          | GDK_SCROLL_MASK
+                          | GDK_ENTER_NOTIFY_MASK
+                          | GDK_LEAVE_NOTIFY_MASK;
+
+  attributes_mask = GDK_WA_X | GDK_WA_Y;
 
   /* Child 1 */
   attributes.x = attributes.y = 0;
+  attributes.width = allocation.width;
+  attributes.height = allocation.height;
   if (offscreen_box->child1 && gtk_widget_get_visible (offscreen_box->child1))
     {
       gtk_widget_get_allocation (offscreen_box->child1, &child_area);


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