mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
input: Some more tuning.
* in_sdl.c: Remove the over-zealous "no events for unknown keys" checks introduced in r1085. Events for unknown keys can be useful for "press any key" situations. * keys.c: In input grab mode, update the "lastkey" member only for key down events. * keys.c/console.c: Adapt input grab mode to properly support catching "any key" presses. git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1089 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
4eee84a9fc
commit
cec23e9fa5
3 changed files with 13 additions and 15 deletions
|
@ -1243,7 +1243,7 @@ void Con_NotifyBox (const char *text)
|
|||
Sys_Sleep (16);
|
||||
t2 = Sys_DoubleTime ();
|
||||
realtime += t2-t1; // make the cursor blink
|
||||
} while (lastkey == 0 && lastchar == 0);
|
||||
} while (lastkey == -1 && lastchar == -1);
|
||||
Key_EndInputGrab ();
|
||||
|
||||
Con_Printf ("\n");
|
||||
|
|
|
@ -625,11 +625,11 @@ void IN_SendKeyEvents (void)
|
|||
// SDL2: We use SDL_TEXTINPUT for typing in the console / chat.
|
||||
// SDL2 uses the local keyboard layout and handles modifiers
|
||||
// (shift for uppercase, etc.) for us.
|
||||
if (!lastKeyDown || !Key_IgnoreTextInput(lastKeyDown))
|
||||
if (!Key_IgnoreTextInput(lastKeyDown))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; event.text.text[i]; i++)
|
||||
if ((event.text.text[i] & 0x80) == 0)
|
||||
if ((event.text.text[i] & ~0x7F) == 0)
|
||||
Char_Event (event.text.text[i]);
|
||||
}
|
||||
break;
|
||||
|
@ -660,11 +660,10 @@ void IN_SendKeyEvents (void)
|
|||
key = IN_SDL_KeysymToQuakeKey(event.key.keysym.sym);
|
||||
#endif
|
||||
|
||||
// Filter out key down events for numpad keys when we expect them
|
||||
// Filter key down events for numpad keys when we expect them
|
||||
// to also send a char event. Doing this only for key down events
|
||||
// can generate some stray numpad key up events, but that's much
|
||||
// less problematic than the missing key up events that could be
|
||||
// caused if we'd also filter those out.
|
||||
// will generate some stray key up events, but that's much less
|
||||
// problematic than missing key up events.
|
||||
if (down && textmode && numlock && IN_IsNumpadKey(key))
|
||||
key = 0;
|
||||
|
||||
|
@ -672,12 +671,10 @@ void IN_SendKeyEvents (void)
|
|||
lastKeyDown = down ? key : 0;
|
||||
#endif
|
||||
|
||||
if (key)
|
||||
Key_Event (key, down);
|
||||
Key_Event (key, down);
|
||||
|
||||
#if !defined(USE_SDL2)
|
||||
if (down && (!key || !Key_IgnoreTextInput(key)) &&
|
||||
(event.key.keysym.unicode & ~0x7F) == 0)
|
||||
if (down && !Key_IgnoreTextInput(key) && (event.key.keysym.unicode & ~0x7F) == 0)
|
||||
Char_Event (event.key.keysym.unicode);
|
||||
#endif
|
||||
break;
|
||||
|
|
|
@ -904,7 +904,7 @@ static struct {
|
|||
qboolean active;
|
||||
int lastkey;
|
||||
int lastchar;
|
||||
} key_inputgrab;
|
||||
} key_inputgrab = { false, -1, -1 };
|
||||
|
||||
/*
|
||||
===================
|
||||
|
@ -916,8 +916,8 @@ void Key_BeginInputGrab (void)
|
|||
Key_ClearStates ();
|
||||
|
||||
key_inputgrab.active = true;
|
||||
key_inputgrab.lastkey = 0;
|
||||
key_inputgrab.lastchar = 0;
|
||||
key_inputgrab.lastkey = -1;
|
||||
key_inputgrab.lastchar = -1;
|
||||
|
||||
IN_UpdateInputMode ();
|
||||
}
|
||||
|
@ -983,7 +983,8 @@ void Key_Event (int key, qboolean down)
|
|||
|
||||
if (key_inputgrab.active)
|
||||
{
|
||||
key_inputgrab.lastkey = key;
|
||||
if (down)
|
||||
key_inputgrab.lastkey = key;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue