[Libreoffice-commits] core.git: vcl/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue May 12 18:25:08 UTC 2020
vcl/source/window/floatwin.cxx | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
New commits:
commit 822f94e260b8351dc3459d2c05180af2de96d4c7
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 12 15:57:11 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue May 12 20:24:32 2020 +0200
tdf#132435 only place menu vertically if up/down requested
don't fallback to left/right if it doesn't fit, just scroll the
menu instead
Change-Id: I20b261fd7fee78555bf87b25dfeed33c23602493
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94065
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 749ceacd09d0..a9a3e7163bb2 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -265,6 +265,7 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
Application::GetBestScreen( bRTL ? devRectRTL : devRect ) );
FloatWinPopupFlags nArrangeAry[5];
+ sal_uInt16 nArrangeAttempts = 5;
Point e1,e2; // the common edge between the item rect and the floating window
if ( nFlags & FloatWinPopupFlags::Left )
@@ -287,23 +288,21 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
{
nArrangeAry[0] = FloatWinPopupFlags::Up;
nArrangeAry[1] = FloatWinPopupFlags::Down;
- nArrangeAry[2] = FloatWinPopupFlags::Right;
- nArrangeAry[3] = FloatWinPopupFlags::Left;
- nArrangeAry[4] = FloatWinPopupFlags::Up;
+ nArrangeAry[2] = FloatWinPopupFlags::Up;
+ nArrangeAttempts = 3;
}
else
{
nArrangeAry[0] = FloatWinPopupFlags::Down;
nArrangeAry[1] = FloatWinPopupFlags::Up;
- nArrangeAry[2] = FloatWinPopupFlags::Right;
- nArrangeAry[3] = FloatWinPopupFlags::Left;
- nArrangeAry[4] = FloatWinPopupFlags::Down;
+ nArrangeAry[2] = FloatWinPopupFlags::Down;
+ nArrangeAttempts = 3;
}
sal_uInt16 nArrangeIndex = 0;
const bool bLOKActive = comphelper::LibreOfficeKit::isActive();
- for ( ; nArrangeIndex < 5; nArrangeIndex++ )
+ for ( ; nArrangeIndex < nArrangeAttempts; nArrangeIndex++ )
{
bool bBreak = true;
switch ( nArrangeAry[nArrangeIndex] )
@@ -428,8 +427,8 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow,
if ( bBreak )
break;
}
- if ( nArrangeIndex > 4 )
- nArrangeIndex = 4;
+ if (nArrangeIndex >= nArrangeAttempts)
+ nArrangeIndex = nArrangeAttempts - 1;
rArrangeIndex = nArrangeIndex;
More information about the Libreoffice-commits
mailing list