[gtk/wip/otte/for-master: 4/8] stack: Make sure to not under-measure children




commit 6c94835f5d690b2e0436b6cb635695b21a596d40
Author: Benjamin Otte <otte redhat com>
Date:   Sat Nov 20 05:42:20 2021 +0100

    stack: Make sure to not under-measure children
    
    When the stack is homogeneous in only one direction, the other direction
    may produce min sizes to small for all children. Make sure to query at
    least the min size for those.

 gtk/gtkstack.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index a57db53631..facf7ca3eb 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -2578,7 +2578,16 @@ gtk_stack_measure (GtkWidget      *widget,
 
       if (gtk_widget_get_visible (child))
         {
-          gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
+          if (!priv->homogeneous[OPPOSITE_ORIENTATION(orientation)] && priv->visible_child != child_info)
+            {
+              int min_for_size;
+
+              gtk_widget_measure (child, OPPOSITE_ORIENTATION (orientation), -1, &min_for_size, NULL, NULL, 
NULL);
+              
+              gtk_widget_measure (child, orientation, MAX (min_for_size, for_size), &child_min, &child_nat, 
NULL, NULL);
+            }
+          else
+            gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
 
           *minimum = MAX (*minimum, child_min);
           *natural = MAX (*natural, child_nat);


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