[libadwaita/wip/exalm/fixes: 2/6] clamp: Fix measuring child with for_size == -1




commit edd1d99f9218d59f03f2609118527ab3da38cf25
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Mon Aug 9 18:46:34 2021 +0500

    clamp: Fix measuring child with for_size == -1
    
    Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/225

 src/adw-clamp-layout.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-clamp-layout.c b/src/adw-clamp-layout.c
index 93ca317e..6cf9b157 100644
--- a/src/adw-clamp-layout.c
+++ b/src/adw-clamp-layout.c
@@ -129,11 +129,14 @@ get_child_size (AdwClampLayout *self,
                 int            *lower_threshold,
                 int            *upper_threshold)
 {
-  int min = 0, max = 0, lower = 0, upper = 0;
+  int min = 0, nat = 0, max = 0, lower = 0, upper = 0;
   double amplitude, progress;
 
   if (gtk_widget_get_visible (child))
-    gtk_widget_measure (child, self->orientation, -1, &min, NULL, NULL, NULL);
+    gtk_widget_measure (child, self->orientation, -1, &min, &nat, NULL, NULL);
+
+  if (for_size < 0)
+    return nat;
 
   lower = MAX (MIN (self->tightening_threshold, self->maximum_size), min);
   max = MAX (lower, self->maximum_size);


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