[gtk+] iconview: Use gdk_window_new_child()



commit 3fc32511b5a2b98ebdcb486e2269e6fd2d7dacf7
Author: Benjamin Otte <otte redhat com>
Date:   Tue Oct 18 00:20:02 2016 +0200

    iconview: Use gdk_window_new_child()

 gtk/gtkiconview.c |   48 ++++++++++++++++--------------------------------
 1 files changed, 16 insertions(+), 32 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 444143b..4e828b2 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1267,48 +1267,32 @@ gtk_icon_view_realize (GtkWidget *widget)
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
   GtkAllocation allocation;
   GdkWindow *window;
-  GdkWindowAttr attributes;
-  gint attributes_mask;
 
   gtk_widget_set_realized (widget, TRUE);
 
   gtk_widget_get_allocation (widget, &allocation);
 
   /* Make the main, clipping window */
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.x = allocation.x;
-  attributes.y = allocation.y;
-  attributes.width = allocation.width;
-  attributes.height = allocation.height;
-  attributes.wclass = GDK_INPUT_OUTPUT;
-  attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
-
-  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),
+                                 GDK_VISIBILITY_NOTIFY_MASK,
+                                 &allocation);
   gtk_widget_set_window (widget, window);
   gtk_widget_register_window (widget, window);
 
-  gtk_widget_get_allocation (widget, &allocation);
-
   /* Make the window for the icon view */
-  attributes.x = 0;
-  attributes.y = 0;
-  attributes.width = MAX (icon_view->priv->width, allocation.width);
-  attributes.height = MAX (icon_view->priv->height, allocation.height);
-  attributes.event_mask = (GDK_SCROLL_MASK |
-                           GDK_SMOOTH_SCROLL_MASK |
-                           GDK_POINTER_MOTION_MASK |
-                           GDK_LEAVE_NOTIFY_MASK |
-                           GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_KEY_PRESS_MASK |
-                           GDK_KEY_RELEASE_MASK) |
-    gtk_widget_get_events (widget);
-  
-  icon_view->priv->bin_window = gdk_window_new (window,
-                                               &attributes, attributes_mask);
+  icon_view->priv->bin_window = gdk_window_new_child (window,
+                                                      gtk_widget_get_events (widget)
+                                                      | GDK_SCROLL_MASK
+                                                      | GDK_SMOOTH_SCROLL_MASK
+                                                      | GDK_POINTER_MOTION_MASK
+                                                      | GDK_LEAVE_NOTIFY_MASK
+                                                      | GDK_BUTTON_PRESS_MASK
+                                                      | GDK_BUTTON_RELEASE_MASK
+                                                      | GDK_KEY_PRESS_MASK
+                                                      | GDK_KEY_RELEASE_MASK,
+                                                      &(GdkRectangle) { 0, 0,
+                                                      MAX (icon_view->priv->width, allocation.width),
+                                                      MAX (icon_view->priv->height, allocation.height)});
   gtk_widget_register_window (widget, icon_view->priv->bin_window);
   gdk_window_show (icon_view->priv->bin_window);
 }


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