Android.mk
author Sam Lantinga <slouken@libsdl.org>
Wed, 03 Oct 2012 20:49:16 -0700
changeset 6555 f2c03c06d987
parent 6448 64a6297a8b93
child 7311 56e66417dcee
permissions -rwxr-xr-x
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
http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
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 LOCAL_PATH := $(call my-dir)
     2 
     3 ###########################
     4 #
     5 # SDL shared library
     6 #
     7 ###########################
     8 
     9 include $(CLEAR_VARS)
    10 
    11 LOCAL_MODULE := SDL2
    12 
    13 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    14 
    15 LOCAL_SRC_FILES := \
    16 	$(subst $(LOCAL_PATH)/,, \
    17 	$(wildcard $(LOCAL_PATH)/src/*.c) \
    18 	$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
    19 	$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
    20 	$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
    21 	$(LOCAL_PATH)/src/atomic/SDL_atomic.c \
    22 	$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
    23 	$(wildcard $(LOCAL_PATH)/src/core/android/*.cpp) \
    24 	$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
    25 	$(wildcard $(LOCAL_PATH)/src/events/*.c) \
    26 	$(wildcard $(LOCAL_PATH)/src/file/*.c) \
    27 	$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
    28 	$(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \
    29 	$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
    30 	$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
    31 	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
    32 	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
    33 	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
    34 	$(wildcard $(LOCAL_PATH)/src/render/*.c) \
    35 	$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
    36 	$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
    37 	$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
    38 	$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
    39 	$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
    40 	$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
    41 	$(wildcard $(LOCAL_PATH)/src/video/*.c) \
    42 	$(wildcard $(LOCAL_PATH)/src/video/android/*.c))
    43 
    44 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
    45 LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog
    46 
    47 include $(BUILD_SHARED_LIBRARY)