[libadwaita] carousel: Don't allocate more than the carousel's size



commit 020a1df7bb15a6bbcfffd4f4a4b551d1ff73a925
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 27 14:40:11 2021 +0200

    carousel: Don't allocate more than the carousel's size
    
    This prevents children whose natural size is larger than the carousel's
    size to pop out of it.

 src/adw-carousel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-carousel.c b/src/adw-carousel.c
index c91d6171..a498b751 100644
--- a/src/adw-carousel.c
+++ b/src/adw-carousel.c
@@ -618,14 +618,14 @@ adw_carousel_size_allocate (GtkWidget *widget,
       if (gtk_widget_get_hexpand (child))
         child_size = MAX (min, width);
       else
-        child_size = MAX (min, nat);
+        child_size = CLAMP (nat, min, width);
     } else {
       gtk_widget_measure (child, self->orientation,
                           width, &min, &nat, NULL, NULL);
       if (gtk_widget_get_vexpand (child))
         child_size = MAX (min, height);
       else
-        child_size = MAX (min, nat);
+        child_size = CLAMP (nat, min, height);
     }
 
     size = MAX (size, child_size);


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