input: Minor tuning.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1086 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
svdijk 2014-10-05 19:03:48 +00:00
parent 94733d49c6
commit c164408ebf
1 changed files with 10 additions and 13 deletions

View File

@ -593,7 +593,7 @@ static qboolean IN_IsNumpadKey (int key)
void IN_SendKeyEvents (void) void IN_SendKeyEvents (void)
{ {
SDL_Event event; SDL_Event event;
int sym; int key;
qboolean down, numlock; qboolean down, numlock;
#if defined(USE_SDL2) #if defined(USE_SDL2)
static int lastKeyDown = 0; static int lastKeyDown = 0;
@ -655,9 +655,9 @@ void IN_SendKeyEvents (void)
#if defined(USE_SDL2) #if defined(USE_SDL2)
// SDL2: we interpret the keyboard as the US layout, so keybindings // SDL2: we interpret the keyboard as the US layout, so keybindings
// are based on key position, not the label on the key cap. // are based on key position, not the label on the key cap.
sym = IN_SDL2_ScancodeToQuakeKey(event.key.keysym.scancode); key = IN_SDL2_ScancodeToQuakeKey(event.key.keysym.scancode);
#else #else
sym = IN_SDL_KeysymToQuakeKey(event.key.keysym.sym); key = IN_SDL_KeysymToQuakeKey(event.key.keysym.sym);
#endif #endif
// Filter out key down events for numpad keys when we expect them // Filter out key down events for numpad keys when we expect them
@ -665,23 +665,20 @@ void IN_SendKeyEvents (void)
// can generate some stray numpad key up events, but that's much // can generate some stray numpad key up events, but that's much
// less problematic than the missing key up events that could be // less problematic than the missing key up events that could be
// caused if we'd also filter those out. // caused if we'd also filter those out.
if (down && textmode && numlock && IN_IsNumpadKey(sym)) if (down && textmode && numlock && IN_IsNumpadKey(key))
sym = 0; key = 0;
#if defined(USE_SDL2) #if defined(USE_SDL2)
lastKeyDown = down ? sym : 0; lastKeyDown = down ? key : 0;
#endif #endif
if (sym) if (key)
Key_Event (sym, down); Key_Event (key, down);
#if !defined(USE_SDL2) #if !defined(USE_SDL2)
if (down && (!sym || !Key_IgnoreTextInput(sym)) && if (down && (!key || !Key_IgnoreTextInput(key)) &&
(event.key.keysym.unicode & ~0x7F) == 0) (event.key.keysym.unicode & ~0x7F) == 0)
{ Char_Event (event.key.keysym.unicode);
sym = event.key.keysym.unicode & 0x7F;
Char_Event (sym);
}
#endif #endif
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN: