-
Notifications
You must be signed in to change notification settings - Fork 927
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
Asking for more KeyAction events when using android keyboard. #4067
Comments
The idea is to keep only action_down and action_multiple. For example to make an ô you will have action_down ("o") + action_down (del) + action_multiple ("ô") |
Hi, I investigated it a bit more and IMO the only way how to get a character when |
Can't we enhance event::ElementState with these events ? here: winit/src/platform_impl/android/mod.rs Line 461 in 5ea81ef
|
@mvvvv Where the |
This is very specific to the older versions of android. ACTION_MULTIPLE is deprecated see https://developer.android.com/reference/android/view/KeyEvent#ACTION_MULTIPLE. So I wouldn't pollute |
The warning messages are from Android ViewRootImpl because there is a problem of focus or event handling as I do not have a view. As I said I receive event::ElementState::Pressed and event::ElementState::Released. I believe (but I can't test) it's from this code: winit/src/platform_impl/android/mod.rs Line 461 in 5ea81ef
|
Unfortunately I can't see any of these events in logs on my Android device. After picking letter
I enhanced the logs with 3 println! (android-actvity, winit and application layer)
The information about pressed key is lost and not visible for |
Unfortunately I haven't been successful. Apparently there is no possible workaround unless you have the newest Android 15, where a new function AInputEvent_toJava is introduced https://developer.android.com/ndk/reference/group/input#group___input_1gaed0e10fd09a1560029a870455257a247 IMO without that function it is not possible to convert NDK event to the Java one and call KeyEvent.getCharacters function with JNI. I tried to cast ndk event directly to the jobject, but it didn't work - it is not java accessible object :( The finding is in align with https://issuetracker.google.com/issues/36950127 I researched before. |
Description
This issue also concerns the PR rust-mobile/android-activity#178 from @jancespivo
With Openxr/StereoKit-rust, as I can't use neither Window::set_ime_allowed nor app.show_soft_input(), I tested the Android keyboard launched via JNI on the Meta Quest2. It works exactly like any Android device.
https://github.com/mvvvv/StereoKit-rust/blob/master/src/tools/os_api.rs#L191
Winit blocks many characters including accented characters which it replaces completely with a backspace and erases the character typed previously. I made a short video: https://youtu.be/os8cucfF3D8
The problem is that I can only rely on
event::ElementState::Pressed
andevent::ElementState::Released
which are the only events retained (winit/src/platform_impl/android/mod.rs
Line 461 in 5ea81ef
Having access to ACTION_MULTIPLE event seems to be the only way to get enhanced characters(here ò), smileys and utf8 characters.
Device and Android version
Meta Quest 2 Horizon OS v72 (android 12.1)
Winit version
0.30.7
The text was updated successfully, but these errors were encountered: