diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-16 09:48:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-16 12:11:39 +0200 |
commit | f33b6e341fb7dd1ab3acd4fe5457b716be316e89 (patch) | |
tree | f85f91deeaffc76e3f5ddfa647fc69c6885e3e7e | |
parent | 350972a8bffc1a74b531e0336954bf54b1356025 (diff) |
overlapping scrollbars when both visible
Change-Id: I75644c526e401ce0bc9a46a66d3d31e90bafb1d6
Reviewed-on: https://gerrit.libreoffice.org/80874
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/window/layout.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 609a7ca5d66b..c9dda1e98f9a 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1802,27 +1802,32 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) Size aInnerSize(rAllocation); aInnerSize.AdjustWidth(-2); aInnerSize.AdjustHeight(-2); - long nScrollBarWidth = 0, nScrollBarHeight = 0; + + bool bBothVisible = m_pVScroll->IsVisible() && m_pHScroll->IsVisible(); + auto nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width(); + auto nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height(); if (m_pVScroll->IsVisible()) { - nScrollBarWidth = getLayoutRequisition(*m_pVScroll).Width(); Point aScrollPos(rAllocation.Width() - nScrollBarWidth - 2, 1); Size aScrollSize(nScrollBarWidth, rAllocation.Height() - 2); + if (bBothVisible) + aScrollSize.AdjustHeight(-nScrollBarHeight); setLayoutAllocation(*m_pVScroll, aScrollPos, aScrollSize); aInnerSize.AdjustWidth( -nScrollBarWidth ); } if (m_pHScroll->IsVisible()) { - nScrollBarHeight = getLayoutRequisition(*m_pHScroll).Height(); Point aScrollPos(1, rAllocation.Height() - nScrollBarHeight); Size aScrollSize(rAllocation.Width() - 2, nScrollBarHeight); + if (bBothVisible) + aScrollSize.AdjustWidth(-nScrollBarWidth); setLayoutAllocation(*m_pHScroll, aScrollPos, aScrollSize); aInnerSize.AdjustHeight( -nScrollBarHeight ); } - if (m_pVScroll->IsVisible() && m_pHScroll->IsVisible()) + if (bBothVisible) { Point aBoxPos(aInnerSize.Width() + 1, aInnerSize.Height() + 1); m_aScrollBarBox->SetPosSizePixel(aBoxPos, Size(nScrollBarWidth, nScrollBarHeight)); |