-
Notifications
You must be signed in to change notification settings - Fork 501
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
Android Hardware Keyboard/Back Button Support #869
base: master
Are you sure you want to change the base?
Conversation
- Add SAPP keycode for the Android Back Button - Implement KEY_DOWN/KEY_UP/CHAR events with repeat support - Implemented quit_requested/quit_ordered so that sapp_request_quit() works These changes allows Android app to recieve an action for a back button press and respond to it themselves (including navigation and exiting the application) and allows Android HW keyboards to function just like the Windows/macOS/Linux keyboards.
I have a couple of nitpicks, but first, do you know if I can test the hardware keyboard support somehow with my Android phone (e.g. can I attach a USB keyboard for testing?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of formatting things to take care of.
Please also check the errors CI (sign-conversion warning - yes the CI pipeline settings are very picky), and SOKOL_LOG has been replaced, but I guess you can just remove all logs unless they are actual warnings and errors.
Not sure, but the Android Emulator in Android Studio relays the computer keyboard input as Android hardware keyboard events. I'll also work through those recommended changes later tonight. |
I was also wondering, do you want me to wire up all the android specific keycodes to new sokol scan codes (tv remotes, gamepad keys, etc), or just keep to the minimal set here. |
… block propagation of all consumed events
If it's just a handful or so and you think it's a good idea to do so, feel free to add those as |
Also please have a look at the 'new' errors in CI, there's some problem when compiling as C++, those JNI calls may need some Lines 8376 to 8390 in 47d92ff
PS: I mean the errors in here: https://github.com/floooh/sokol/actions/runs/5876724894/job/15942332488?pr=869 ...ignore the Odin-related issue in that other CI job, don't know yet what's up with that, but it's definitely not related to your PR. |
Its going to be quite a few if we want to cover the complete android keyset, take a look at this switch statement below to see what the full list looks like.
|
Oh hmm ok, that's a lot more than I was hoping. Are there any other important keys that would make sense to support except the Back button? I was thinking up to 10 or so Android-specific keys would be ok (or we can just go with the just the Back button for now and add more on demand later). |
These changes allow Android apps to receive an event for a back button press and respond to it themselves (including consuming it for their navigation purposes and exiting the application) and allows Android HW keyboards to function just like the Windows/macOS/Linux keyboards.
Overview of the changes: