From: Holger Schemel Date: Sat, 7 Oct 2017 19:52:36 +0000 (+0200) Subject: fixed frame delay debug keys by only allowing 'normal' modifier keys X-Git-Tag: 4.0.1.1~42 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0ce1ebb5632789d3dcd7093e2e6f964af7b59fca;p=rocksndiamonds.git fixed frame delay debug keys by only allowing 'normal' modifier keys --- diff --git a/src/events.c b/src/events.c index 5b1e5771..aa20e2d0 100644 --- a/src/events.c +++ b/src/events.c @@ -1470,7 +1470,7 @@ void HandleKeysDebug(Key key) if (game_status == GAME_MODE_PLAYING || !setup.debug.frame_delay_game_only) { - boolean mod_key_pressed = (GetKeyModState() != KMOD_None); + boolean mod_key_pressed = ((GetKeyModState() & KMOD_Valid) != KMOD_None); for (i = 0; i < NUM_DEBUG_FRAME_DELAY_KEYS; i++) { diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 9ee6c69d..075b99bb 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -430,6 +430,12 @@ struct MouseCursorInfo #define KMOD_Meta (KMOD_Meta_L | KMOD_Meta_R) #define KMOD_Alt (KMOD_Alt_L | KMOD_Alt_R) +/* this only contains "valid" key modifiers (and ignores keys like "NumLock") */ +#define KMOD_Valid (KMOD_Shift | \ + KMOD_Control | \ + KMOD_Meta | \ + KMOD_Alt) + #if defined(TARGET_SDL2) #define KMOD_TextInput (KMOD_Shift | KMOD_Alt_R) #endif