Description: Enable normal up/down events for Caps-Lock and Num-Lock keys by setting SDL_DISABLE_LOCK_KEYS (which requires SDL > 1.2.14). This fixes handling of capslock when capslock is mapped to something else in host system. Author: Benjamin Drung Bug-Ubuntu: https://launchpad.net/bugs/427612 --- a/ui/sdl.c 2010-10-20 15:31:32 +0000 +++ b/ui/sdl.c 2010-11-24 14:20:02 +0000 @@ -390,12 +390,6 @@ else modifiers_state[keycode] = 1; break; - case 0x45: /* num lock */ - case 0x3a: /* caps lock */ - /* SDL does not send the key up event, so we generate it */ - kbd_put_keycode(keycode); - kbd_put_keycode(keycode | SCANCODE_UP); - return; } /* now send the key code */ @@ -833,6 +827,10 @@ setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 0); } + // Enable normal up/down events for Caps-Lock and Num-Lock keys. + // This requires SDL >= 1.2.14 + setenv("SDL_DISABLE_LOCK_KEYS", "1", 1); + flags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; if (SDL_Init (flags)) { fprintf(stderr, "Could not initialize SDL(%s) - exiting\n",