From 77dc3a5065379ed19b66ebb3748fc31a689e2dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Sun, 28 Jun 2020 14:04:11 +0200 Subject: [PATCH] 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 a3197f43f..3f5b9db2a 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) {