Skip to content

Add touchpad magnify gesture support for Windows.#2501

Closed
killianc3 wants to merge 4 commits into
rust-windowing:masterfrom
killianc3:dev
Closed

Add touchpad magnify gesture support for Windows.#2501
killianc3 wants to merge 4 commits into
rust-windowing:masterfrom
killianc3:dev

Conversation

@killianc3
Copy link
Copy Markdown
Contributor

After seeing touchpad gestures implemented on macOS ( #2157 ), I looked for an implementation for Windows.

According to the microsfot documentation, there is a WM_GESTURE message that can be processed to support touchpad gestures. But at first I couldn't get one of these messages, then after searching, it seems that no one has implemented this message yet.

Then, in the microsoft doc, I saw this table https://bit.ly/3LDVdRd which describes how the gestures correspond to the existing messages, so based on that and on #2157, I implemented the zoom gesture.

What do you think about it ?
Thanks in advance.

@madsmtm madsmtm added DS - win32 Affects the Win32/Windows backend S - platform parity Unintended platform differences labels Sep 22, 2022
Comment thread CHANGELOG.md Outdated
@killianc3
Copy link
Copy Markdown
Contributor Author

I was thinking that maybe some people have already implemented the magnification gesture in their code by checking if the control key is activated when they receive a MouseWheel event. But with these changes, their code might not work on Windows anymore because MouseWheel will no longer be emitted.

And I also follow this #2157 wich is also a note as a break change.

@madsmtm
Copy link
Copy Markdown
Member

madsmtm commented Sep 23, 2022

Yeah, I could guess - I was more thinking explaining it in the changelog, so that the user knows "oh, I gotta check for my usage of MouseWheel, and see if I do that"

@killianc3
Copy link
Copy Markdown
Contributor Author

Oh yes, I see, so something like that should be more understandable ?

Copy link
Copy Markdown
Member

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

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

Yup, that looks wonderful.

Can't say anything about the implementation, @msiglreith will likely do that at some point

@msiglreith
Copy link
Copy Markdown
Member

The implementation looks fine but I'm a bit unsure about doing this inside winit:

  • There seems no clear mapping from mouse wheel values to magnification factor. Mapping from -1/1 to zoom factors seems more application specific. Support Direct Manipulation or other Windows API in the future might lead to inconsistent behavior here.
  • Not totally sure about other platforms but such a keybind should be platform-agnostic.

@killianc3
Copy link
Copy Markdown
Contributor Author

Yes, you're right, after thinking about it a bit, I also think these changes are not very much in line with Winit's goals, my bad.

Thanks for your time !

@killianc3 killianc3 closed this Sep 24, 2022
@killianc3 killianc3 deleted the dev branch September 24, 2022 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - win32 Affects the Win32/Windows backend S - platform parity Unintended platform differences

Development

Successfully merging this pull request may close these issues.

3 participants