author Sam Lantinga <>
Wed, 03 Oct 2012 20:49:16 -0700
changeset 6555 f2c03c06d987
parent 3561 00e7c6b7eb03
child 6878 30579e86ac24
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.
     2 To compile and install SDL:
     4     0.  If you have downloaded this from the website, skip to the next step.
     5         If you have checked this out from subversion, you'll need to run
     6         ./ to build the configure script. 
     8     1.  Run './configure; make; make install'
    10         If you are compiling for Windows using gcc, read the FAQ at:
    13         If you are compiling using Visual C++ on Win32, you should read
    14         the file VisualC.html
    16     2.  Look at the example programs in ./test, and check out the HTML
    17         documentation in ./docs to see how to use the SDL library.
    19     3.  Join the SDL developer mailing list by sending E-mail to
    21         and put "subscribe" in the subject of the message.
    23         Or alternatively you can use the web interface:
    26 That's it!
    27 Sam Lantinga <>