author Sam Lantinga <>
Wed, 03 Oct 2012 20:49:16 -0700
changeset 6555 f2c03c06d987
parent 6251 3e8c673cad58
child 6568 1a6b0ae81937
permissions -rw-r--r--
Fixed bug 1614 - SDL for Android does not implement TextInput API

Andrey Isakov 2012-10-03 08:30:25 PDT

I've found out in the process of porting one OS project to Android/SDL2 that
there is no support for TextInput events/APIs on Android.
So I implemented some kind of initial support of that feature, and at the very
least it seems to work fine with latin chars input with soft and hardware
keyboards on my Moto Milestone2. I've also tried playing around with more
complex IMEs, like japanese, logging the process and it seemed to work too. I'm
not sure since the app itself I am working on does not have support for
non-latin input.

The main point of the patch is to place a fake input view in the region
specified by SDL_SetTextInputRect and create a custom InputConnection for it.
The reason to make it a separate view is to support Android's pan&scan on input
feature properly. For details please refer to
Even though the manual states that SetTextInputRect is used to determine the
IME variants position, I thought this would be a proper use for this too.
     1 2.0 release checklist:
     2  *
     4  * See why windows are being rearranged.  Is the shield window not up?
     5  * Make sure you can create and show a fullscreen window in one step
     6  * Write automated test case for multi-draw APIs
     7  * Implement assertion code on iPhone
     8  * Add __WINDOWS__ in addition to __WIN32__
    10  * Check 1.2 revisions:
    11 	3554 - Need to resolve semantics for locking keys on different platforms
    12 	4874 - Do we want screen rotation?  At what level?
    13 	4974 - Windows file code needs to convert UTF-8 to Unicode, but we don't need to tap dance for Windows 95/98
    14 	4484, 4485 - Verify that SDL's Windows keyboard handling works correctly
    15 	4865 - See if this is still needed (mouse coordinate clamping)
    16 	4866 - See if this is still needed (blocking window repositioning)