From 6c94835f5d690b2e0436b6cb635695b21a596d40 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 20 Nov 2021 05:42:20 +0100 Subject: [PATCH] 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);