X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Fevents.c;h=6fc55ea5d32433f31304c3ac969b94452ea07a81;hp=50a39762865d8b0e6e1c5ee3714f998ec164d49a;hb=36cfa0205e5a618c59e2e24c1c6650597a59ddca;hpb=307f92e3ee14cdab72466e5998eef66c0ef3ae38 diff --git a/src/events.c b/src/events.c index 50a39762..6fc55ea5 100644 --- a/src/events.c +++ b/src/events.c @@ -477,19 +477,35 @@ void HandleFingerEvent(FingerEvent *event) #endif } +static boolean checkTextInputKeyModState() +{ + // 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); +} + void HandleTextEvent(TextEvent *event) { char *text = event->text; Key key = getKeyFromKeyName(text); #if DEBUG_EVENTS - Error(ERR_DEBUG, "TEXT EVENT: text == '%s', resulting key == %d (%s)", + Error(ERR_DEBUG, "TEXT EVENT: text == '%s' [%d byte(s), '%c'/%d], resulting key == %d (%s)", text, + strlen(text), + text[0], (int)(text[0]), key, getKeyNameFromKey(key)); #endif - if (game_status != GAME_MODE_PLAYING && GetKeyModState() != KMOD_None) + // if (game_status != GAME_MODE_PLAYING && GetKeyModState() != KMOD_None) + /* + if (game_status != GAME_MODE_PLAYING && + (GetKeyModState() & KMOD_TextInput) != KMOD_None) + */ + if (checkTextInputKeyModState()) { HandleKey(key, KEY_PRESSED); HandleKey(key, KEY_RELEASED); @@ -528,13 +544,18 @@ void HandleKeyEvent(KeyEvent *event) key = KSYM_Escape; #endif -#if defined(TARGET_SDL2) HandleKeyModState(keymod, key_status); - if (game_status == GAME_MODE_PLAYING || GetKeyModState() == KMOD_None) +#if defined(TARGET_SDL2) + + // if (game_status == GAME_MODE_PLAYING || GetKeyModState() == KMOD_None) + /* + if (game_status == GAME_MODE_PLAYING || + (GetKeyModState() & KMOD_TextInput) == KMOD_None) + */ + if (!checkTextInputKeyModState()) HandleKey(key, key_status); #else - HandleKeyModState(keymod, key_status); HandleKey(key, key_status); #endif }