[mutter] clutter/box-layout: Add spacing when computing opposite orientation size



commit 7f12099ead12eb71f6d25851ee6b9b4ab8281526
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 bcb339bba2..17b4c77d9b 100644
--- a/clutter/clutter/clutter-box-layout.c
+++ b/clutter/clutter/clutter-box-layout.c
@@ -315,6 +315,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]