SDL: fixed keys @#+ not working with CompatibilityHacksTextInputEmulatesHwKeyboard=y

This commit is contained in:
Sergii Pylypenko
2015-09-24 21:21:27 +03:00
parent 19addf50f9
commit c8fc91b310

View File

@@ -961,6 +961,8 @@ JNIEXPORT jint JNICALL
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action, jint unicode )
{
SDL_scancode keycode;
int unshifted = unicode;
int shiftRequired = checkShiftRequired(&unshifted);
#if SDL_VERSION_ATLEAST(1,3,0)
#else
if( !SDL_CurrentVideoSurface )
@@ -984,22 +986,14 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
if( keycode == SDLK_NO_REMAP || (keycode == SDLK_UNKNOWN && unicode == 0) )
return 0;
if( keycode == SDLK_UNKNOWN && (unicode & 0xFF80) == 0 )
if( keycode == SDLK_UNKNOWN || unicode != unshifted )
{
int shiftRequired = checkShiftRequired(&unicode);
keycode = unicode;
if (shiftRequired)
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, SDLK_LSHIFT, 0 );
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, keycode, 0 );
if (shiftRequired)
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, SDLK_LSHIFT, 0 );
action = 0; // Android won't send 'key released' action for keys that do not have keysym, so we simulate it below
unicode = 0;
if ((unshifted & 0xFF80) == 0)
keycode = unshifted;
if (unicode != unshifted)
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, SDLK_LSHIFT, 0 );
}
if( keycode != SDLK_UNKNOWN )
unicode = 0;
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, keycode, unicode );
return 1;
}