[fadb19bfbddde11ed6828a22e742cc97f5589ce48ac8ec8f94a6510ad5f16b8b/gnome-3-36] clutter/box-layout: Add spacing when computing opposite orientation size



commit 77dc3a5065379ed19b66ebb3748fc31a689e2dfe
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Sun Jun 28 14:04:11 2020 +0200

    clutter/box-layout: Add spacing when computing opposite orientation size
    
    ClutterBoxLayout calculates the preferred size of the opposite
    orientation (so for example the height if the orientation is horizontal)
    by getting the preferred size of the real orientation first, and then
    the preferred size of the opposite orientation, using the other size as
    for_width/height when doing the request.
    
    Right now, for non-homogeneous layouts this for_width/height does not
    adjust for the spacing set on the box layout. This leads to children
    being passed a slightly larger for_width/height, which in case of
    ClutterText might cause the line to not wrap when it actually should.
    This in turn means we can end up with an incorrect preferred size for
    the opposite orientation, leading to a wrong allocation.
    
    So fix that and adjust for the spacing just as we do for homogeneous
    layouts by subtracting the total spacing from the available size that is
    distributed between children.
    
    This fixes the wrong height of the checkbox label reported in
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2574.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1333

 clutter/clutter/clutter-box-layout.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/clutter/clutter/clutter-box-layout.c b/clutter/clutter/clutter-box-layout.c
index a3197f43f3..3f5b9db2ab 100644
--- a/clutter/clutter/clutter-box-layout.c
+++ b/clutter/clutter/clutter-box-layout.c
@@ -623,6 +623,8 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout   *self,
     }
   else
     {
+      size -= (nvis_children - 1) * priv->spacing;
+
       /* Bring children up to size first */
       if (isnormal (size) || size == 0)
         {


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