shithub: zelda3

Download patch

ref: aefcb0828b2f9faf27f53f3a75545e0efa66d82f
parent: 9b4d7febd218e0a80a770ad5342fb4bc36d190d5
author: FitzRoyX <[email protected]>
date: Sun Mar 5 13:08:48 EST 2023

fix modifier keys doing nothing as bindings (#217) (#229)


--- a/config.c
+++ b/config.c
@@ -109,9 +109,13 @@
 int FindCmdForSdlKey(SDL_Keycode code, SDL_Keymod mod) {
   if (code & ~(SDLK_SCANCODE_MASK | 0x1ff))
     return 0;
-  int key = mod & KMOD_ALT ? kKeyMod_Alt : 0;
-  key |= mod & KMOD_CTRL ? kKeyMod_Ctrl : 0;
-  key |= mod & KMOD_SHIFT ? kKeyMod_Shift : 0;
+  int key = 0;
+  if (code != SDLK_LALT && code != SDLK_RALT)
+    key |=  mod & KMOD_ALT ? kKeyMod_Alt : 0;
+  if (code != SDLK_LCTRL && code != SDLK_RCTRL)
+    key |= mod & KMOD_CTRL ? kKeyMod_Ctrl : 0;
+  if (code != SDLK_LSHIFT && code != SDLK_RSHIFT)
+    key |= mod & KMOD_SHIFT ? kKeyMod_Shift : 0;
   key |= REMAP_SDL_KEYCODE(code);
   return KeyMapHash_Find(key);
 }