vcl/inc/listbox.hxx | 4 ++++ vcl/source/control/imp_listbox.cxx | 19 ++++++++++++++----- vcl/source/window/floatwin.cxx | 23 +++++++++++++---------- 3 files changed, 31 insertions(+), 15 deletions(-)
New commits: commit 3c8bf431e33ed367d83370eb5a44b6adca284ed4 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sat Aug 17 15:11:45 2024 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Fri Feb 21 23:37:22 2025 +0100 tdf#150524 Cannot traverse entire font lists in combo box with Windows scaling, the widget extends off display Applies to gen(x11)/win/qt5 VCL plugins. Change-Id: Ic5df291ba68ab8a19dd950dacd8a7dd61224c913 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171966 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/vcl/inc/listbox.hxx b/vcl/inc/listbox.hxx index 8b3756297187..b37a633cbf5b 100644 --- a/vcl/inc/listbox.hxx +++ b/vcl/inc/listbox.hxx @@ -223,6 +223,8 @@ private: /// Listbox is actually a dropdown (either combobox, or popup window treated as dropdown) bool mbIsDropdown : 1; + Point mnLastPosPixel = Point(); + Link<ImplListBoxWindow*,void> maScrollHdl; Link<LinkParamNone*,void> maSelectHdl; Link<LinkParamNone*,void> maCancelHdl; @@ -368,6 +370,8 @@ public: using Control::ImplInitSettings; virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + void ResetLastPosPixel() { mnLastPosPixel = Point(); } + private: // ISearchableStringList virtual vcl::StringEntryIdentifier CurrentEntry( OUString& _out_entryText ) const override; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 45b84c7db4ea..f132cb71920c 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -885,6 +885,15 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) if( !aRect.Contains( rMEvt.GetPosPixel() ) ) return; + // prevent initial mouse move event from selecting an entry when the listbox is started + if (mnLastPosPixel == Point()) + { + mnLastPosPixel = rMEvt.GetPosPixel(); + return; + } + if (mnLastPosPixel == rMEvt.GetPosPixel()) + return; + if ( IsMouseMoveSelect() ) { sal_Int32 nSelect = GetEntryPosForPoint( rMEvt.GetPosPixel() ); @@ -2937,8 +2946,9 @@ Size ImplListBoxFloatingWindow::CalcFloatSize() const aFloatSz.setWidth( nDesktopWidth ); } - if ( aFloatSz.Height() > nMaxHeight ) - aFloatSz.setHeight( nMaxHeight ); + tools::Long nDesktopHeight = GetDesktopRectPixel().getOpenHeight(); + if (aFloatSz.Height() > nDesktopHeight) + aFloatSz.setHeight(nDesktopHeight); // Minimal height, in case height is not set to Float height. // The parent of FloatWin must be DropDown-Combo/Listbox. @@ -3010,20 +3020,19 @@ void ImplListBoxFloatingWindow::StartFloat( bool bStartTracking ) if( pGrandparent->GetOutDev()->ImplIsAntiparallel() ) pGrandparentOutDev->ReMirror( aRect ); + mpImplLB->GetMainWindow()->ResetLastPosPixel(); // mouse-button right: close the List-Box-Float-win and don't stop the handling fdo#84795 StartPopupMode( aRect, LISTBOX_FLOATWINPOPUPFLAGS ); if( nPos != LISTBOX_ENTRY_NOTFOUND ) mpImplLB->ShowProminentEntry( nPos ); - if( bStartTracking ) - mpImplLB->GetMainWindow()->EnableMouseMoveSelect( true ); + mpImplLB->GetMainWindow()->EnableMouseMoveSelect(bStartTracking); if ( mpImplLB->GetMainWindow()->IsGrabFocusAllowed() ) mpImplLB->GetMainWindow()->GrabFocus(); mpImplLB->GetMainWindow()->ImplClearLayoutData(); - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 196f2126cf5b..f1311674f556 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -404,18 +404,23 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, if (bLOKActive) break; + // set bBreak true on last attempt + if (nArrangeIndex + 1 == nArrangeAttempts) + bBreak = true; + // adjust if necessary if (bBreak) { - if ( (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Left) || - (nArrangeAry[nArrangeIndex] == FloatWinPopupFlags::Right) ) + if (aPos.Y() + aSize.Height() > aScreenRect.Bottom()) { - if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() ) - { - aPos.setY( devRect.Bottom()-aSize.Height()+1 ); - if ( aPos.Y() < aScreenRect.Top() ) - aPos.setY( aScreenRect.Top() ); - } + aPos.setY(devRect.Bottom() - aSize.Height() + 1); + if (aPos.Y() < aScreenRect.Top()) + aPos.setY(aScreenRect.Top()); + // move to the right or left of the parent if possible + if (devRect.Right() + 4 + aSize.Width() < aScreenRect.Right()) + aPos.setX(devRect.Right() + 4); + else if (devRect.Left() - 4 - aSize.Width() > aScreenRect.Left()) + aPos.setX(devRect.Left() - 4 - aSize.Width()); } else { @@ -436,8 +441,6 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, if ( bBreak ) break; } - if (nArrangeIndex >= nArrangeAttempts) - nArrangeIndex = nArrangeAttempts - 1; rArrangeIndex = nArrangeIndex;