summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Luby <guibmacdev@gmail.com>2024-12-12 10:45:21 -0500
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2024-12-12 19:28:27 +0100
commit7a74370a82fa0abd69556634ce54f7d84cf684e5 (patch)
tree36a1320c2db809bb04580f4a702438f9c3e8a5ea
parentf0551cd1ad33cc115a29353d14d9d510613bfe39 (diff)
tdf#147067 Jump to clicked spot if left mouse click with Option key
Most macOS applications such as TextEdit and Safari jump to the clicked spot if the Option key is pressed during a left mouse click. Change-Id: I56149e42daf1825cfebde8be8cfbb53645b31928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178369 Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomacdev@gmail.com> (cherry picked from commit 94508506e7f6b9e53c77b631c5d7de1e06ff78d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178382 Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--vcl/source/control/scrbar.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 7218b1485bbb..fc56cc4be24a 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -834,6 +834,13 @@ void ScrollBar::ImplDragThumb( const Point& rMousePos )
void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
{
bool bPrimaryWarps = GetSettings().GetStyleSettings().GetPrimaryButtonWarpsSlider();
+#ifdef MACOSX
+ // tdf#147067 Jump to clicked spot if left mouse click with Option key
+ // Most macOS applications such as TextEdit and Safari jump to the
+ // clicked spot if the Option key is pressed during a left mouse click.
+ if (!bPrimaryWarps && rMEvt.IsLeft() && rMEvt.GetModifier() == KEY_MOD2)
+ bPrimaryWarps = true;
+#endif
bool bWarp = bPrimaryWarps ? rMEvt.IsLeft() : rMEvt.IsMiddle();
bool bPrimaryWarping = bWarp && rMEvt.IsLeft();
bool bPage = bPrimaryWarps ? rMEvt.IsRight() : rMEvt.IsLeft();