SDL: Tentative fix for buggy keyboards that send ASCII symbols without keysym
This commit is contained in:
Submodule project/jni/application/hid-pc-keyboard/src updated: a883fb6410...f619f28882
@@ -188,8 +188,6 @@ extern void SDL_ANDROID_MainThreadPushKeyboardKey(int pressed, SDL_scancode key,
|
||||
keysym.unicode = unicode;
|
||||
if( (keysym.unicode & 0xFF80) != 0 )
|
||||
keysym.sym = SDLK_WORLD_0;
|
||||
//else if( keysym.sym < 0x80 )
|
||||
// keysym.unicode = keysym.sym;
|
||||
|
||||
if( pressed == SDL_RELEASED )
|
||||
keysym.unicode = 0;
|
||||
|
||||
@@ -949,6 +949,7 @@ void SDL_ANDROID_WarpMouse(int x, int y)
|
||||
JNIEXPORT jint JNICALL
|
||||
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action, jint unicode )
|
||||
{
|
||||
SDL_scancode keycode;
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
#else
|
||||
if( !SDL_CurrentVideoSurface )
|
||||
@@ -966,15 +967,29 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
|
||||
return 1;
|
||||
}
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d action %d translated %d unicode %d", key, action, TranslateKey(key), unicode);
|
||||
keycode = TranslateKey(key);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d action %d translated %d unicode %d", key, action, keycode, unicode);
|
||||
|
||||
if( TranslateKey(key) == SDLK_NO_REMAP || (TranslateKey(key) == SDLK_UNKNOWN && (unicode & 0xFF80) == 0) )
|
||||
if( keycode == SDLK_NO_REMAP || (keycode == SDLK_UNKNOWN && unicode == 0) )
|
||||
return 0;
|
||||
|
||||
if( TranslateKey(key) != SDLK_UNKNOWN )
|
||||
if( keycode == SDLK_UNKNOWN && (unicode & 0xFF80) == 0 )
|
||||
{
|
||||
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( keycode != SDLK_UNKNOWN )
|
||||
unicode = 0;
|
||||
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, TranslateKey(key), unicode );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( action ? SDL_PRESSED : SDL_RELEASED, keycode, unicode );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,7 @@ extern void SDL_ANDROID_MainThreadPushAppActive(int active);
|
||||
|
||||
// Internal input queue stuff
|
||||
extern SDLKey SDL_android_keymap[];
|
||||
extern int SDL_android_KeysymFromUnicodeShiftNeeded(int unicode);
|
||||
extern unsigned char SDL_android_keysym_to_scancode[SDLK_LAST];
|
||||
extern SDL_Joystick *SDL_ANDROID_CurrentJoysticks[];
|
||||
extern int SDL_ANDROID_isMouseUsed;
|
||||
|
||||
4
todo.txt
4
todo.txt
@@ -39,4 +39,6 @@ TODO, which will get actually done
|
||||
|
||||
- OpenTTD: text input freezes OpenTTD and servers kick it.
|
||||
|
||||
- GIMP & Debian: update proot, update proot tmpdir patch to use env var PROOT_TMPDIR, update XSDL, update system images, set R9X as default XFWM4 theme.
|
||||
- GIMP & Debian: update proot, update proot tmpdir patch to use env var PROOT_TMPDIR.
|
||||
|
||||
- GIMP & Debian: update XSDL, update system images, set R9X as default XFWM4 theme, recompile Inkscape to remove /dev/zero hack.
|
||||
|
||||
Reference in New Issue
Block a user