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:23:44 +0100
commitb4541590a6d5d41e92b9274727d6da887410a344 (patch)
tree08ed0e2d091de0fe8d3bfcc414428c43abf2b3ee
parent8e561b4380580e3c1feafbb88b5ef2d0f8e479db (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/+/178380 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();