[gtk/wip/otte/boxes: 15/20] window: Properly detect if size allocation is needed



commit 537fcba7d630dd9eb7da03ffec367b095681e68a
Author: Benjamin Otte <otte redhat com>
Date:   Tue Feb 12 02:20:36 2019 +0100

    window: Properly detect if size allocation is needed
    
    Instead of looking at the allocation, just look at the alloc_needed
    widget flag that tracks if an allocation is needed.

 gtk/gtkwindow.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 77bdc43472..abe113e758 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6431,13 +6431,8 @@ gtk_window_realize (GtkWidget *widget)
   if (!priv->client_decorated && gtk_window_should_use_csd (window))
     create_decoration (widget);
 
-  _gtk_widget_get_allocation (widget, &allocation);
-
   /* ensure widget tree is properly size allocated */
-  if (allocation.x == -1 &&
-      allocation.y == -1 &&
-      allocation.width == 1 &&
-      allocation.height == 1)
+  if (_gtk_widget_get_alloc_needed (widget))
     {
       GdkRectangle request;
 
@@ -6454,16 +6449,15 @@ gtk_window_realize (GtkWidget *widget)
       g_return_if_fail (!_gtk_widget_get_realized (widget));
     }
 
+  _gtk_widget_get_allocation (widget, &allocation);
+
   if (priv->hardcoded_surface)
     {
       surface = priv->hardcoded_surface;
-      _gtk_widget_get_allocation (widget, &allocation);
       gdk_surface_resize (surface, allocation.width, allocation.height);
     }
   else
     {
-      _gtk_widget_get_allocation (widget, &allocation);
-
       switch (priv->type)
         {
         case GTK_WINDOW_TOPLEVEL:


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