Skip to content

Fix darkroom scroll zooming on macOS using magic mouse and pinch zooming on 2nd window#21058

Draft
da-phil wants to merge 2 commits into
darktable-org:masterfrom
da-phil:fix_scroll_zooming_on_mac_os_with_magic_mouse
Draft

Fix darkroom scroll zooming on macOS using magic mouse and pinch zooming on 2nd window#21058
da-phil wants to merge 2 commits into
darktable-org:masterfrom
da-phil:fix_scroll_zooming_on_mac_os_with_magic_mouse

Conversation

@da-phil
Copy link
Copy Markdown
Contributor

@da-phil da-phil commented May 17, 2026

This PR tries to fix the following regressions caused in #20812:

@da-phil
Copy link
Copy Markdown
Contributor Author

da-phil commented May 17, 2026

@MStraeten can you please give this fix a try and share the logs? Thanks.
Does scroll zoom work while holding CTRL?

@MStraeten
Copy link
Copy Markdown
Collaborator

zooming by dragging on magic mouse and trackpad is fine - unless pinch and zoom was done on trackpad.
After that zooming in by mouse / trackpad is just possible in combination with control key. In a zoomed in view draging scrolls the view.

log.txt

@da-phil
Copy link
Copy Markdown
Contributor Author

da-phil commented May 17, 2026

zooming by dragging on magic mouse and trackpad is fine - unless pinch and zoom was done on trackpad. After that zooming in by mouse / trackpad is just possible in combination with control key. In a zoomed in view draging scrolls the view.

log.txt

Ah yes, that's also the behavior on Linux with a mouse & touchpad, given that we cannot resolve the ambiguity between scroll-zooming (linearly moving both fingers up/down in parallel) and panning gestures (moving both fingers in either direction), without using another key to differentiate them. As far as I remember, dragging (moving mouse / single finger while clicking) has always been doing a panning motion.
I thought that the Apple Magic Mouse was doing something special here, it seems that it works the same as on Linux.

Then we come to the design decision which was

The rationale:

Adds touchpad gestures in Darkroom:

pinch zoom in/out
two-finger pan

After above PRs were merged, two finger gestures (including the scroll one) became the panning gesture, just like the usual dragging works (holding left click / touchpad tap and then moving). And zooming is done with the dedicated and universally used pinch-zoom gesture.
At least I could verify locally on my Linux setup when going back before #20451 that this behavior changed.

Does reverting my PR / going back to a commit before my PR merged (e.g. d436623) bring back the behavior you expect?
This would be very surprising for me.

@da-phil da-phil changed the title Fix scroll zooming on macOS using magic mouse Fix darkroom scroll zooming on macOS using magic mouse and pinch zooming on 2nd window May 18, 2026
@da-phil da-phil force-pushed the fix_scroll_zooming_on_mac_os_with_magic_mouse branch from d52d66e to f0c75a8 Compare May 18, 2026 07:48
@da-phil
Copy link
Copy Markdown
Contributor Author

da-phil commented May 18, 2026

zooming by dragging on magic mouse and trackpad is fine - unless pinch and zoom was done on trackpad. After that zooming in by mouse / trackpad is just possible in combination with control key. In a zoomed in view draging scrolls the view.

log.txt

By the way, thanks for the log file, this made the following clear:
The failure isn't "broken zoom" in general - it's that on macOS, Magic Mouse and trackpad share a GdkDevice instance, and after the trackpad pinch binds _touchpad to that shared device, every Magic Mouse scroll satisfies matches_last_gesture_device and gets routed to pan. Now clearing _touchpad on pinch END/CANCEL fixes the Magic Mouse case but as your description and log shows, it would re-break the design intent that trackpad two-finger drag should pan even without a prior pinch. The two fixes are mutually exclusive as long as we rely on device identity to discriminate them.

I need to have another look if I find more time later.

Also refactor code to avoid code duplication across
main & second window pinch zoom handling
@da-phil da-phil force-pushed the fix_scroll_zooming_on_mac_os_with_magic_mouse branch from ac56042 to dbccd35 Compare May 18, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants