mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 09:10:54 +00:00
input: Minor tuning.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1086 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
14f5275a2c
commit
5ca58d55b0
1 changed files with 10 additions and 13 deletions
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue