winit icon indicating copy to clipboard operation
winit copied to clipboard

api: move primary from FingerId to Pointer events

Open kchibisov opened this issue 1 year ago • 4 comments

Whether the pointer event is primary or not generally matters for the context where all input is done by the same event, so users can ignore non-primary events since they are likely from users clicking something else with their other fingers.

Having it only on a FingerId made it useless, since it's usually used to avoid multi-touch, but if you start mapping on touch event you already can track things like that yourself.

Fixes #3943.

--

@daxpedda I left the web, since it's starting to get messy with those callbacks, so you might want to refactor things to your liking. I could still plumb those bools though. That's also the reason PR doesn't really build.

@madsmtm I did only true for ios, which is likely fine, but I guess we could track based on some Option<Touch>? I decided not to, since ios uses pointer casts for its id, etc.

kchibisov avatar Oct 11 '24 17:10 kchibisov

Pointer cast for ID is the proper way to do this on iOS according to my research I did last time already. I don't believe its fine to merge it with just true.

true is more correct in general, since false will potentially prevent you from processing valid input.

In general, my main issue is not that to e.g. track fingers like you did, but which styles + finger should result in primary tracking stuff. For example, all ios input is done the same way via touch, as I said, so e.g. pencil/pen/whatever is also going here, and given that ID is a pointer cast, it's not really a touch in some cases, and according to the primary in the web docs, it seems like for pen/whatever it should be true.

kchibisov avatar Oct 13 '24 18:10 kchibisov

In general, my main issue is not that to e.g. track fingers like you did, but which styles + finger should result in primary tracking stuff. For example, all ios input is done the same way via touch, as I said, so e.g. pencil/pen/whatever is also going here, and given that ID is a pointer cast, it's not really a touch in some cases, and according to the primary in the web docs, it seems like for pen/whatever it should be true.

Yes, good point, we should only apply false for touch input. I'm gonna go ahead and do just that for Android and iOS.

daxpedda avatar Oct 13 '24 18:10 daxpedda

I'm gonna go ahead and do just that for Android and iOS.

That already works for Android though the way I've implemented If I read the docs correctly, it's not though for ios here, but its docs are not that clear what things actually are. That's the reason I check those up/down events on android since it tells that some of them are primary and the rest is not primary.

kchibisov avatar Oct 13 '24 18:10 kchibisov

I've pushed a separate commit with merging all the FingerId under the same thing and squashed what was present.

kchibisov avatar Oct 15 '24 14:10 kchibisov

Rebased/changed the type to FingerId on ios/and also made Wayland backend to follow ios behavior.

kchibisov avatar Oct 29 '24 19:10 kchibisov