| Summary: | Android hardware keyboard does not produce SDL_TEXTINPUT events for space bar | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Cole Campbell <cole.campbell> |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | ARM | ||
| OS: | Android (All) | ||
| Attachments: | Adds KEYCODE_SPACE as a character to commit as text. | ||
Fixed, thanks! https://hg.libsdl.org/SDL/rev/c65f7a25fb0e |
Created attachment 2525 [details] Adds KEYCODE_SPACE as a character to commit as text. Pressing the space bar on the Android software keyboard produces an SDL_TEXTINPUT event with the text " ", as expected, but doing so on a hardware keyboard does not. It looks like the software keyboard calls the input connection's commitText() method directly, whereas the hardware keyboard just generates key events against the DummyEdit widget, which SDL translates into commits against the input connection inside of onKey() and sendKeyEvent(). However, SDL only does this for keys which Android considers "printing keys" -- which does not include space. The attached patch just makes SDLActivity call commitText() for KEYCODE_SPACE as well as for explicitly printable keycodes. I've tested it on both a physical Bluetooth keyboard as well as the Visual Studio Emulator for Android, and it seems to do the trick.