[libhandy] carousel-box: Don't allocate more than the carousel's size



commit 4de740a4f27ec6b20e6b61870775d45fe0d445ab
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Tue Jul 27 14:18:09 2021 +0200

    carousel-box: 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/hdy-carousel-box.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/hdy-carousel-box.c b/src/hdy-carousel-box.c
index 7d02481d..1e545fe5 100644
--- a/src/hdy-carousel-box.c
+++ b/src/hdy-carousel-box.c
@@ -842,14 +842,14 @@ hdy_carousel_box_size_allocate (GtkWidget     *widget,
       if (gtk_widget_get_hexpand (child))
         child_size = MAX (min, allocation->width);
       else
-        child_size = MAX (min, nat);
+        child_size = CLAMP (nat, min, allocation->width);
     } else {
       gtk_widget_get_preferred_height_for_width (child, allocation->width,
                                                  &min, &nat);
       if (gtk_widget_get_vexpand (child))
         child_size = MAX (min, allocation->height);
       else
-        child_size = MAX (min, nat);
+        child_size = CLAMP (nat, min, allocation->height);
     }
 
     size = MAX (size, child_size);


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