From f0cb3ea994e0a10117832c17222fc8a4a6df9a0d Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 4 Jul 2016 14:09:06 +0000 Subject: [PATCH] SDL2 layer: in Mapster32, fix menu Ctrl-F in case NumLock is on. git-svn-id: https://svn.eduke32.com/eduke32@5808 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/sdlayer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index c2afad46d..d9ebaf277 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -2123,13 +2123,19 @@ int32_t handleevents_pollsdl(void) const SDL_Scancode sc = ev.key.keysym.scancode; code = keytranslation[sc]; + // Modifiers that have to be held down to be effective + // (excludes KMOD_NUM, for example). + static const int MODIFIERS = + KMOD_LSHIFT|KMOD_RSHIFT|KMOD_LCTRL|KMOD_RCTRL| + KMOD_LALT|KMOD_RALT|KMOD_LGUI|KMOD_RGUI; + // XXX: see osd.c, OSD_HandleChar(), there are more... if (ev.key.type == SDL_KEYDOWN && !keyascfifo_isfull() && (sc == SDL_SCANCODE_RETURN || sc == SDL_SCANCODE_KP_ENTER || sc == SDL_SCANCODE_ESCAPE || sc == SDL_SCANCODE_BACKSPACE || sc == SDL_SCANCODE_TAB || - (ev.key.keysym.mod==KMOD_LCTRL && + (((ev.key.keysym.mod) & MODIFIERS) == KMOD_LCTRL && (sc >= SDL_SCANCODE_A && sc <= SDL_SCANCODE_Z)))) { char keyvalue;