rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.77k stars 891 forks source link

Adding touchpad multitouch support #2379

Open simon-frankau opened 2 years ago

simon-frankau commented 2 years ago

Hi.

I'm interested in adding touchpad multitouch support to winit, with an implementation for MacOS. I'm new to winit, so I'd be keen to get feedback on whether this is worth implementing before I start coding. I'll try to pre-empt a few questions here:

As I said at the start, I'm new to winit, so I may have made some incorrect assumptions, or be thinking about this incorrectly. Please do correct me.

Thanks, Simon.

maroider commented 2 years ago

I suppose that would be useful, but I'm not sure if we can implement it on other platforms (or how you'd even implement it on macOS).

madsmtm commented 2 years ago

We'll probably be merging https://github.com/rust-windowing/winit/pull/2157, so that part is at least covered.

Good issue description, I agree that this is in-scope and the path you've laid out (modifying the Touch enum) sounds fine. Ping me when you have something!

simon-frankau commented 2 years ago

Ooops, sorry for not replying earlier - some "real-world issues" got in the way.

If "single platform only implementation" is an problem, I can understand if people want to call it out of scope. I can also take a quick look to see if other platforms have a way to support this (even if I'm not in a position to implement it myself).

My proof-of-concept implementation relies on listening for touches{Began,Moved,Ended,Cancelled}WithEvent: events. The main issues I have so far are:

I'll try to follow up when I have something worth looking at, but the "real-world issues" mentioned above might still slow me down somewhat. In the meantime, I'm glad to hear #2157 is likely to get merged.

madsmtm commented 2 years ago

Take your time, no worries!

Thoughts on how to correctly handle "multi-touch"

Honestly, no idea, but I guess any API is better than no API, so just getting something that somewhat works to begin with would be an improvement