sfx2/source/sidebar/SidebarController.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
New commits: commit 334b44affe24340f44216021a4699699dd5dde96 Author: xuenhua <xuenhua2...@sina.com> AuthorDate: Wed Jun 1 15:29:49 2022 +0800 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Jun 18 05:53:33 2022 +0200 tdf#149431 Fix the sidebar's width When click the wider sidebar and then go back to the narrow one in Writer, the narrow one becomes the same width as wider one, it's not suitable and doesn't look good. Fix the width to smallest width unless you drag the splitter. Take the maximum width from the smallest width and mnWidthOnSplitterButtonDown. Change-Id: I60aaab84593d59ac28b96c2d3c3bd62a4bbddbbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135220 Tested-by: Jenkins Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 0ec2b93c28093c80572c43f7be261630bd85f232) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136039 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index cff76a95850b..088384641efd 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -506,6 +506,8 @@ void SidebarController::ProcessNewWidth (const sal_Int32 nNewWidth) { // Deck became large enough to be shown. Show it. mnSavedSidebarWidth = nNewWidth; + // Store nNewWidth to mnWidthOnSplitterButtonDown when dragging sidebar Splitter + mnWidthOnSplitterButtonDown = nNewWidth; if (!*mbIsDeckOpen) RequestOpenDeck(); } @@ -653,8 +655,12 @@ void SidebarController::OpenThenToggleDeck ( if (mpCurrentDeck && mpTabBar) { sal_Int32 nRequestedWidth = mpCurrentDeck->GetMinimalWidth() + TabBar::GetDefaultWidth(); - if (mnSavedSidebarWidth < nRequestedWidth) + // if sidebar was dragged + if(mnWidthOnSplitterButtonDown > 0 && mnWidthOnSplitterButtonDown > nRequestedWidth){ + SetChildWindowWidth(mnWidthOnSplitterButtonDown); + }else{ SetChildWindowWidth(nRequestedWidth); + } } } @@ -1060,7 +1066,6 @@ IMPL_LINK(SidebarController, WindowEventHandler, VclWindowEvent&, rEvent, void) case VclEventId::WindowMouseButtonUp: { ProcessNewWidth(mpParentWindow->GetSizePixel().Width()); - mnWidthOnSplitterButtonDown = 0; break; }