officecfg/registry/schema/org/openoffice/Office/Common.xcs | 10 +++++++++ vcl/osx/salframeview.mm | 14 +++++++++++++ 2 files changed, 24 insertions(+)
New commits: commit 1c4c24042cbe0ede59513d30a676442f7f238b62 Author: Patrick Luby <guibmac...@gmail.com> AuthorDate: Mon Mar 10 10:08:41 2025 -0400 Commit: Patrick Luby <guibomac...@gmail.com> CommitDate: Tue Mar 18 23:38:36 2025 +0100 tdf#151423 allow trackpad or Magic Mouse to behave like a regular mouse Give both trackpad and Magic Mouse users the option to restore the legacy zoom via Command+swipe gesture. The IgnoreKeysWhenScrollingWithTrackpadOrMagicMouse preference is set to true by default and that disables zooming via swiping. The problem is that while trackpad users are able to zoom via a magnify gesture, the Magic Mouse doesn't have a magnify gesture. Since I have not found a reliable way to distinguish a Magic Mouse from a trackpad, Magic Mouse users have no obvious replacement for the zoom via Command+swipe gesture. Change-Id: Ic2fa5ba153ecb3d7a7cd4711549288b28e6591d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182740 Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Tested-by: Jenkins Reviewed-by: Patrick Luby <guibomac...@gmail.com> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index a7fedae390a2..969df405cc10 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -701,6 +701,16 @@ </info> <value>15</value> </prop> + <group oor:name="macOS"> + <prop oor:name="IgnoreKeysWhenScrollingWithTrackpadOrMagicMouse" oor:type="xs:boolean" oor:nillable="false"> + <info> + <desc>Specifies if the Command, Option, Control, and Shift keys + should be ignored or not when scrolling on a trackpad or a + Magic Mouse.</desc> + </info> + <value>true</value> + </prop> + </group> </group> <group oor:name="Passwords"> <info> diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 3373ca2091b5..74da526f6ba4 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -22,6 +22,7 @@ #include <memory> #include <basegfx/numeric/ftools.hxx> +#include <officecfg/Office/Common.hxx> #include <sal/macros.h> #include <tools/helpers.hxx> #include <tools/long.hxx> @@ -240,6 +241,19 @@ static void freezeWindowSizeAndReschedule( NSWindow *pWindow ) static bool isMouseScrollWheelEvent( NSEvent *pEvent ) { + // tdf#151423 allow trackpad or Magic Mouse to behave like a regular mouse + // Give both trackpad and Magic Mouse users the option to restore + // the legacy zoom via Command+swipe gesture. + // The IgnoreKeysWhenScrollingWithTrackpadOrMagicMouse preference is + // set to true by default and that disables zooming via swiping. + // The problem is that while trackpad users are able to zoom via a + // magnify gesture, the Magic Mouse doesn't have a magnify gesture. + // Since I have not found a reliable way to distinguish a Magic Mouse + // from a trackpad, Magic Mouse users have no obvious replacement + // for the zoom via Command+swipe gesture. + if ( !officecfg::Office::Common::VCL::macOS::IgnoreKeysWhenScrollingWithTrackpadOrMagicMouse::get() ) + return true; + return ( pEvent && [pEvent type] == NSEventTypeScrollWheel && [pEvent phase] == NSEventPhaseNone && [pEvent momentumPhase] == NSEventPhaseNone ); }