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

Can't get multitouch to work with native activity #146

Closed
griffi-gh opened this issue Nov 21, 2023 · 4 comments · Fixed by #147
Closed

Can't get multitouch to work with native activity #146

griffi-gh opened this issue Nov 21, 2023 · 4 comments · Fixed by #147

Comments

@griffi-gh
Copy link

griffi-gh commented Nov 21, 2023

Not sure who to blame here (me, android-activity or winit), but after switching from ndk_glue to this crate + latest winit version my application no longer receives Touch start/end/cancel events for the second finger, only move ones; and even those are broken (position is in the center of two fingers)

@griffi-gh
Copy link
Author

Code_0deOcabduw

@rib
Copy link
Collaborator

rib commented Dec 20, 2023

Curious - I'm working with multi-touch based on android-activity and as far as I know, multi touch should be working ok.

I work on an application that has independent camera controls for moving the camera with one finger and rotating the camera with another and that's been working for some time so I'd be surprised if start/end/cancel events weren't being sent as expected for multiple fingers. (Also based on Winit)

Maybe you could try out one of the egui examples here: https://github.com/rust-mobile/rust-android-examples and see if the multitouch input is working as expected there.

I'm also hoping to update those examples and can aim to double check the behaviour of multitouch.

@ArthurCose
Copy link
Contributor

There's an order to the inputs that makes it hard to reproduce, it might not always be visible.

Releasing the first-touch first will allow the second touch to receive start/end/cancel events. Releasing the second-touch first will create a MotionAction::__Unknown that's ignored by winit.

The __Unknown appears to be created from ndk_sys::AKeyEvent_getAction() returning a number that stores the "pointer index".

The issue disappeared for me when I applied the same filter used by game activity:

let action = self.ga_event.action as u32 & ndk_sys::AMOTION_EVENT_ACTION_MASK;

@rib rib closed this as completed in #147 Jan 30, 2024
@rib
Copy link
Collaborator

rib commented Jan 30, 2024

This should be fixed by #147 (thanks @ArthurCose)

I'll look at rolling a 0.5.2 release now.

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 a pull request may close this issue.

3 participants