- simplified key repeat detection in SDL backend

This commit is contained in:
alexey.lysiuk 2018-06-29 12:26:30 +03:00
parent 0342bf532d
commit 0703030be3

View file

@ -64,8 +64,6 @@ EXTERN_CVAR (Bool, fullscreen)
extern int WaitingForKey, chatmodeon;
extern constate_e ConsoleState;
static bool DownState[SDL_NUM_SCANCODES];
static const SDL_Keycode DIKToKeySym[256] =
{
0, SDLK_ESCAPE, SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5, SDLK_6,
@ -190,10 +188,6 @@ static void I_CheckGUICapture ()
if (wantCapt != GUICapture)
{
GUICapture = wantCapt;
if (wantCapt)
{
memset (DownState, 0, sizeof(DownState));
}
ResetButtonStates();
}
}
@ -441,18 +435,10 @@ void MessagePump (const SDL_Event &sev)
((kmod & KMOD_CTRL) ? GKM_CTRL : 0) |
((kmod & KMOD_ALT) ? GKM_ALT : 0);
if (event.subtype == EV_GUI_KeyDown)
{
if (DownState[sev.key.keysym.scancode])
if (event.subtype == EV_GUI_KeyDown && sev.key.repeat)
{
event.subtype = EV_GUI_KeyRepeat;
}
DownState[sev.key.keysym.scancode] = 1;
}
else
{
DownState[sev.key.keysym.scancode] = 0;
}
switch (sev.key.keysym.sym)
{