This change fixes a regression of commit
888ee049 (and
35da46e4) that
causes problems when handling text input in situations unrelated to
the Android screen keyboard, like entering key shortcuts to start and
end a game on non-Android platforms.
This commit fixes a bug that results in restarting the game when the
player has died and the "space" key (or other configured key) was used
to return to the main menu (or level editor).
if (game_status == GAME_MODE_PLAYING)
return FALSE;
+ // ignore raw keys as text input when not in text input mode
+ if (KSYM_RAW(key) && !textinput_status)
+ return FALSE;
+
// else handle all printable keys as text input
return KSYM_PRINTABLE(key);
}
#define KSYM_FKEY_LAST KSYM_F12
#define KSYM_NUM_FKEYS (KSYM_FKEY_LAST - KSYM_FKEY_FIRST + 1)
+#define KSYM_RAW(k) (((k) >= KSYM_a && \
+ (k) <= KSYM_z) || \
+ ((k) >= KSYM_0 && \
+ (k) <= KSYM_9) || \
+ (k) == KSYM_space)
+
#define KSYM_PRINTABLE(k) (((k) >= KSYM_space && \
(k) <= KSYM_z) || \
(k) == KSYM_Adiaeresis || \