vcl/source/control/PriorityMergedHBox.cxx |   28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

New commits:
commit 2cdb48eee93a3a93074184c5c8a82e571fb0bd04
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Mon May 22 13:53:25 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed May 24 19:50:44 2023 +0200

    tdf#141684 tdf#147740 notebookbar: fix disappearing icons in groupbar #2
    
    AFAICS, the code was non-sensical before.
    Hopefully now it is logical.
    
    Apparently returning the correct width doesn't mean much,
    but that is the only thing that should be changing in this patch.
    I would assume that returning an accurate width
    is the proper thing to do for this function...
    
    Change-Id: Iab26ac7fd8cd00127d2646f792fa552ec148dc74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152126
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/vcl/source/control/PriorityMergedHBox.cxx 
b/vcl/source/control/PriorityMergedHBox.cxx
index 3e67a13a8f4a..fd5aa5814dac 100644
--- a/vcl/source/control/PriorityMergedHBox.cxx
+++ b/vcl/source/control/PriorityMergedHBox.cxx
@@ -144,31 +144,23 @@ Size PriorityMergedHBox::calculateRequisition() const
     sal_uInt16 nVisibleChildren = 0;
 
     Size aSize;
-    for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
-         pChild = pChild->GetWindow(GetWindowType::Next))
-    {
-        if (!pChild->IsVisible())
-            continue;
-        ++nVisibleChildren;
-        Size aChildSize = getLayoutRequisition(*pChild);
-
-        tools::Long nPrimaryDimension = getPrimaryDimension(aChildSize);
-        nPrimaryDimension += pChild->get_padding() * 2;
-        setPrimaryDimension(aChildSize, nPrimaryDimension);
-
-        accumulateMaxes(aChildSize, aSize);
-    }
-
-    // find max height
+    // find max height and total width
     for (vcl::Window* pChild = GetWindow(GetWindowType::FirstChild); pChild;
          pChild = pChild->GetWindow(GetWindowType::Next))
     {
         Size aChildSize = getLayoutRequisition(*pChild);
-        setPrimaryDimension(aChildSize, getPrimaryDimension(aSize));
+        if (!pChild->IsVisible())
+            setPrimaryDimension(aChildSize, 0);
+        else
+        {
+            ++nVisibleChildren;
+            tools::Long nPrimaryDimension = getPrimaryDimension(aChildSize);
+            nPrimaryDimension += pChild->get_padding() * 2;
+            setPrimaryDimension(aChildSize, nPrimaryDimension);
+        }
         accumulateMaxes(aChildSize, aSize);
     }
 
-    setPrimaryDimension(aSize, 200);
     return finalizeMaxes(aSize, nVisibleChildren);
 }
 

Reply via email to