We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3382 - Android hardware keyboard does not produce SDL_TEXTINPUT events for space bar
Summary: Android hardware keyboard does not produce SDL_TEXTINPUT events for space bar
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.1
Hardware: ARM Android (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-04 14:45 UTC by Cole Campbell
Modified: 2016-10-01 17:31 UTC (History)
0 users

See Also:


Attachments
Adds KEYCODE_SPACE as a character to commit as text. (1.34 KB, text/plain)
2016-07-04 14:45 UTC, Cole Campbell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cole Campbell 2016-07-04 14:45:05 UTC
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.
Comment 1 Sam Lantinga 2016-10-01 17:31:19 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/c65f7a25fb0e