diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-08 11:50:40 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-12-12 08:16:51 +0100 |
commit | b0b5ae68cbc95990ad72653212005ef89d7f3ea3 (patch) | |
tree | 3cf63859a5ad7438177612ac308ad8536113d335 /vcl | |
parent | a9a882929bd7ed2d1c5a1bc68a912d0f6de301af (diff) |
tdf#158548 vcl: Require mouse over listbox to mouse-wheel through entries
As described in tdf#158548, it's unexpected that listbox/
combobox entries change when using the mouse wheel while the
listbox/combobox has keyboard focus, but the mouse cursor
is positioned somewhere else
Therefore, only do that for the VCL ListBox when the mouse cursor
is currently positioned above it, which also matches what
e.g. native Qt applications do.
(When using the gtk3 VCL plugin that uses a native GtkComboBox,
nothing changes on scroll independent of the position.)
Change-Id: I8a69628471c1cd4258194627b95145d6b8fb686a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160459
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
(cherry picked from commit 22250df05830700b2555348b8ac46ee1007d0e5d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160583
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/listbox.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 7e87ae390185..e189c8480f05 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -867,12 +867,14 @@ bool ListBox::PreNotify( NotifyEvent& rNEvt ) (rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel) && (rNEvt.GetWindow() == mpImplWin) ) { + const Point& rMousePos = rNEvt.GetCommandEvent()->GetMousePosPixel(); + const tools::Rectangle aWinRect(mpImplWin->GetPosPixel(), mpImplWin->GetSizePixel()); + const bool bMousePositionedOverWin = aWinRect.Contains(rMousePos); + MouseWheelBehaviour nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() ); - if ( ( nWheelBehavior == MouseWheelBehaviour::ALWAYS ) - || ( ( nWheelBehavior == MouseWheelBehaviour::FocusOnly ) - && HasChildPathFocus() - ) - ) + if (bMousePositionedOverWin + && ((nWheelBehavior == MouseWheelBehaviour::ALWAYS) + || ((nWheelBehavior == MouseWheelBehaviour::FocusOnly) && HasChildPathFocus()))) { bDone = mpImplLB->HandleWheelAsCursorTravel(*rNEvt.GetCommandEvent(), *this); } |