Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS & Wayland events for trackpad zoom and rotate gestures #2419

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

pfgithub
Copy link

@pfgithub pfgithub commented Oct 22, 2023

Implements #90 for macOS with two new events: TrackpadZoom and TrackpadRotate. These events can also be implemented for Windows and Linux X11/Wayland, but I do not have a way to test those platforms. Zoom will need to make sure to use a similar scale on all platforms and rotate should use degrees.

  • Change log entry in README.md, listing all new symbols
  • News page entry, briefly describing the feature
  • Guide documentation, with minimal examples, in the relevant guide
  • Reference documentation, with all applicable tags
  • Cross-references and mentions in appropriate places
  • Credits entries for all authors of the feature
  • If it adds a new callback, support for it must be added to tests/event.c.

@cblc
Copy link

cblc commented Mar 12, 2024

Please, merge this 🙏 🙏 🙏 I really want Magic Trackpad gestures in my apps...

@pfgithub pfgithub changed the title Add macOS events for trackpad zoom and rotate gestures Add macOS & Wayland events for trackpad zoom and rotate gestures Apr 12, 2024
@pfgithub
Copy link
Author

pfgithub commented Apr 12, 2024

I added wayland support, but I'm not really sure where to call _glfwAddPointerGesturesListeners from. The current place works it seems. Also, this needs a rebase to be mergable.

@pfgithub
Copy link
Author

This is done. I can't add Windows or X11 support because I can't test them, but if someone wants to here's information:

Windows

Add in src/win32_window in the switch with all the other events like WM_MOUSEWHEEL.

Firefox has an example of using these events: https://searchfox.org/mozilla-central/rev/f2c181a7ab3bfea4d2266521e6eac713630479b3/widget/windows/nsWinGesture.cpp#142-204

You might need to set up gesture config, as described above in that file.

Make sure that the resulting value sent to _glfwInputTrackpadZoom is a scale factor, and _glfwInputTrackpadRotate receives this event's angle minus the previous events angle in degrees centered at 0 (-180 to 180 rather than 0 to 360)

Make sure that zooming doesn't emit ctrl + scroll events once implemented. I'm not sure if it does this currently, but there was a reference to that in the windows documentation.

X11

Example from Gdk: https://gitlab.gnome.org/GNOME/gtk/-/blob/58c49ce6b044c1b08e099cb232f06e71365c5232/gdk/x11/gdkdevicemanager-xi2.c?page=2#L1907-1963

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