mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-13 00:34:11 +00:00
input: Some cleanup regarding the special treatment of '`' and '~' in the console.
This was hardcoded in in_sdl.c, now it is handled by Char_Console() itself, like it is in Key_Event(). git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1024 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
3b539b156c
commit
d687676d5a
2 changed files with 12 additions and 14 deletions
|
@ -494,8 +494,12 @@ static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
|
||||||
void IN_SendKeyEvents (void)
|
void IN_SendKeyEvents (void)
|
||||||
{
|
{
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
int sym, state, modstate;
|
int sym;
|
||||||
static int lastKeyDown = 0;
|
#if defined(USE_SDL2)
|
||||||
|
unsigned char *ch;
|
||||||
|
#else
|
||||||
|
int state, modstate;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
{
|
{
|
||||||
|
@ -523,13 +527,9 @@ void IN_SendKeyEvents (void)
|
||||||
// SDL2: We use SDL_TEXTINPUT for typing in the console / chat.
|
// SDL2: We use SDL_TEXTINPUT for typing in the console / chat.
|
||||||
// SDL2 uses the local keyboard layout and handles modifiers
|
// SDL2 uses the local keyboard layout and handles modifiers
|
||||||
// (shift for uppercase, etc.) for us.
|
// (shift for uppercase, etc.) for us.
|
||||||
if (lastKeyDown != '`') // don't add a ` to the console when the player brings it down
|
for (ch = (unsigned char *)event.text.text; ch[0] != 0 && ch[0] < 128; ch++)
|
||||||
{
|
{
|
||||||
unsigned char *ch;
|
Char_Event (ch[0]);
|
||||||
for (ch = (unsigned char *)event.text.text; ch[0] != 0 && ch[0] < 128; ch++)
|
|
||||||
{
|
|
||||||
Char_Event (ch[0]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -554,11 +554,6 @@ void IN_SendKeyEvents (void)
|
||||||
// on the key cap.
|
// on the key cap.
|
||||||
sym = IN_SDL2_ScancodeToQuakeKey(event.key.keysym.scancode);
|
sym = IN_SDL2_ScancodeToQuakeKey(event.key.keysym.scancode);
|
||||||
|
|
||||||
if (event.type == SDL_KEYDOWN)
|
|
||||||
lastKeyDown = sym;
|
|
||||||
else
|
|
||||||
lastKeyDown = 0;
|
|
||||||
|
|
||||||
Key_Event (sym, event.key.state == SDL_PRESSED);
|
Key_Event (sym, event.key.state == SDL_PRESSED);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
|
@ -788,7 +783,7 @@ void IN_SendKeyEvents (void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Key_Event (sym, state);
|
Key_Event (sym, state);
|
||||||
if (event.type == SDL_KEYDOWN && sym != '`' && sym != '~')
|
if (event.type == SDL_KEYDOWN)
|
||||||
Char_Event (sym);
|
Char_Event (sym);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -443,6 +443,9 @@ void Char_Console (int key)
|
||||||
if (key < 32 || key > 126)
|
if (key < 32 || key > 126)
|
||||||
return; // non printable
|
return; // non printable
|
||||||
|
|
||||||
|
if (!consolekeys[key])
|
||||||
|
return; // bindable key
|
||||||
|
|
||||||
if (keydown[K_CTRL])
|
if (keydown[K_CTRL])
|
||||||
return; // control character
|
return; // control character
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue