X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fevents.c;h=4140ab5f0ef38e0694d4b42f53c5ea1708dd58d5;hb=3eb5d3a10dc341e94a1290bbe1f9735e18e83e5f;hp=c32f35e91356cf6800d7a9a50a56c5ab028bda74;hpb=543cccf0bf7339f16c7d40276ce87114a4b99f39;p=rocksndiamonds.git diff --git a/src/events.c b/src/events.c index c32f35e9..4140ab5f 100644 --- a/src/events.c +++ b/src/events.c @@ -4,7 +4,7 @@ // (c) 1995-2014 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // events.c // ============================================================================ @@ -1380,13 +1380,14 @@ static void HandleButtonOrFinger(int mx, int my, int button) } } -static boolean checkTextInputKeyModState(void) +static boolean checkTextInputKey(Key key) { // when playing, only handle raw key events and ignore text input if (game_status == GAME_MODE_PLAYING) return FALSE; - return ((GetKeyModState() & KMOD_TextInput) != KMOD_None); + // else handle all printable keys as text input + return KSYM_PRINTABLE(key); } void HandleTextEvent(TextEvent *event) @@ -1404,16 +1405,12 @@ void HandleTextEvent(TextEvent *event) GetKeyModState()); #endif -#if !defined(HAS_SCREEN_KEYBOARD) - // non-mobile devices: only handle key input with modifier keys pressed here - // (every other key input is handled directly as physical key input event) - if (!checkTextInputKeyModState()) - return; -#endif - - // process text input as "classic" (with uppercase etc.) key input event - HandleKey(key, KEY_PRESSED); - HandleKey(key, KEY_RELEASED); + if (checkTextInputKey(key)) + { + // process printable keys (with uppercase etc.) in text input mode + HandleKey(key, KEY_PRESSED); + HandleKey(key, KEY_RELEASED); + } } void HandlePauseResumeEvent(PauseResumeEvent *event) @@ -1470,8 +1467,8 @@ void HandleKeyEvent(KeyEvent *event) HandleKeyModState(keymod, key_status); - // only handle raw key input without text modifier keys pressed - if (!checkTextInputKeyModState()) + // process all keys if not in text input mode or if non-printable keys + if (!checkTextInputKey(key)) HandleKey(key, key_status); }