From: terencehill Date: Sun, 22 Sep 2024 08:09:37 +0000 (+0200) Subject: On Windows ignore repeat events for keys that don't need key repetition while pressed... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2acc658a82164c5aefdc1bde5d05b28c56cb7eb6;p=xonotic%2Fdarkplaces.git On Windows ignore repeat events for keys that don't need key repetition while pressed down --- diff --git a/vid_sdl.c b/vid_sdl.c index ea6fe26e..2a006989 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -1061,6 +1061,27 @@ void Sys_SDL_HandleEvents(void) host.state = host_shutdown; break; case SDL_KEYDOWN: +#ifdef WIN32 + if (event.key.repeat) + { + // ignore repeat events for keys that don't need key repetition while pressed down + bool ignore = false; + switch(event.key.keysym.sym) + { + case SDLK_LCTRL: case SDLK_LSHIFT: case SDLK_LALT: + case SDLK_RCTRL: case SDLK_RSHIFT: case SDLK_RALT: + case SDLK_ESCAPE: case SDLK_PAUSE: + case SDLK_CAPSLOCK: case SDLK_INSERT: + case SDLK_SCROLLLOCK: case SDLK_NUMLOCKCLEAR: +#ifdef DEBUGSDLEVENTS + Con_DPrintf("SDL_Event: SDL_KEYDOWN %i IGNORED\n", event.key.keysym.sym); +#endif + ignore = true; + } + if (ignore) break; + } + // fallthrough +#endif case SDL_KEYUP: #ifdef DEBUGSDLEVENTS if (event.type == SDL_KEYDOWN)