Skip to content

image_viewer: Add pinch event support#47351

Merged
MrSubidubi merged 15 commits intozed-industries:mainfrom
MostlyKIGuess:feature/gesture-pinch-support
Mar 11, 2026
Merged

image_viewer: Add pinch event support#47351
MrSubidubi merged 15 commits intozed-industries:mainfrom
MostlyKIGuess:feature/gesture-pinch-support

Conversation

@MostlyKIGuess
Copy link
Copy Markdown
Contributor

This change implements pinch / magnification gesture handling.

This uses the following wayland protocol. And the following API for mac.

Release Notes:

  • Zooming works with pinching in and out inside Image Viewer

- Add platform support for pinch gestures:
  - macOS: NSEventType::NSEventTypeMagnify
  - Wayland: zwp_pointer_gesture_pinch_v1 protocol
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Jan 22, 2026
@MrSubidubi MrSubidubi assigned MrSubidubi and unassigned rgbkrk Jan 22, 2026
@MrSubidubi MrSubidubi changed the title repl: add gesture(pinch) event support image_viewer: Add pinch event support Jan 22, 2026
@olegKusov

This comment was marked as off-topic.

agu-z
agu-z previously requested changes Feb 11, 2026
Copy link
Copy Markdown
Contributor

@agu-z agu-z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MostlyKIGuess Thank you for your contribution. This is working well in my testing.

Before merging, I’d like to change the new GPUI methods to use [cfg(any(target_os = "linux", target_os = "macos"))] so consumers of the API are aware that this event isn’t available on Windows.

In the doc comments, we should also clarify that the event only works on macOS and Wayland, and explain how Windows simulates scroll wheel + Ctrl events on pinch.

In the future we may want to handle this complexity at the GPUI level, but I don’t think it’s a blocker as long as the API doesn’t suggest it should work when it won’t.

@MostlyKIGuess MostlyKIGuess requested a review from agu-z February 11, 2026 16:20
@MostlyKIGuess
Copy link
Copy Markdown
Contributor Author

@MrSubidubi Sorry for the tag, is there anything that should be done here?

Copy link
Copy Markdown
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - I should hit merge.

Thank you!

@MrSubidubi MrSubidubi merged commit ac2f097 into zed-industries:main Mar 11, 2026
27 checks passed
tommyming pushed a commit to tommyming/zed that referenced this pull request Mar 13, 2026
This change implements pinch / magnification gesture handling.

This uses the following wayland
[protocol](https://wayland.app/protocols/pointer-gestures-unstable-v1).
And the following
[API](https://developer.apple.com/documentation/appkit/nsevent/magnification)
for mac.

- Original: gpui-ce/gpui-ce#11

Release Notes:

- Zooming works with pinching in and out inside Image Viewer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants