vcl/source/control/spinfld.cxx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
New commits: commit d6e2acd584bb7c289a6dffe4b1e58ed2546b6c8a Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Sat Dec 21 19:25:41 2024 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Dec 23 10:15:06 2024 +0100 tdf#164233 vcl: Fix and simplify spin field mouse over check Instead of checking individually whether the mouse pos is over the SpinField's up or down button or the `mpEdit`, just check the SpinField's whole rectangle. The mouse event pos is relative to the SpinField, so use (0, 0) for the top left position of the SpinField's rect used in the check. This is not only simpler, but also fixes the case of the UNO control when the "Spin Button" options is disabled in which case there are no buttons and `mpEdit` is null, so `bMouseHovered` would always be false and adjusting the spin field value for that control using the mouse wheel wouldn't even work when mouse-hovered after the initial check was introduced in commit 869b88488ac443cc64943254064da20b0f361c56 Author: Michael Weghorn <m.wegh...@posteo.de> Date: Mon May 13 16:37:45 2024 +0200 tdf#160824 vcl: Require mouse over spinfield to mouse-wheel through values Change-Id: I3a2ee3af8af872e4a330a4d5e9f5cd6a2de89754 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179085 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit 6eb53d3ecc839d5988a581132c81bfdf9ee2fa69) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179088 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index 1eb8357a2940..2bdbdad66c75 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -543,13 +543,9 @@ bool SpinField::EventNotify(NotifyEvent& rNEvt) { if ((rNEvt.GetCommandEvent()->GetCommand() == CommandEventId::Wheel) && !IsReadOnly()) { + const tools::Rectangle aRect(Point(0, 0), GetSizePixel()); const Point& rMousePos = rNEvt.GetCommandEvent()->GetMousePosPixel(); - bool bMouseHovered = maUpperRect.Contains(rMousePos) || maLowerRect.Contains(rMousePos); - if (!bMouseHovered && mpEdit) - { - const tools::Rectangle aEditRect(mpEdit->GetPosPixel(), mpEdit->GetSizePixel()); - bMouseHovered = aEditRect.Contains(rMousePos); - } + const bool bMouseHovered = aRect.Contains(rMousePos); MouseWheelBehaviour nWheelBehavior(GetSettings().GetMouseSettings().GetWheelBehavior()); if (bMouseHovered