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:
Sander van Dijk 2014-09-13 01:34:02 +00:00
parent 3b539b156c
commit d687676d5a
2 changed files with 12 additions and 14 deletions

View file

@ -494,8 +494,12 @@ static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
void IN_SendKeyEvents (void)
{
SDL_Event event;
int sym, state, modstate;
static int lastKeyDown = 0;
int sym;
#if defined(USE_SDL2)
unsigned char *ch;
#else
int state, modstate;
#endif
while (SDL_PollEvent(&event))
{
@ -523,13 +527,9 @@ 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 != '`') // 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;
for (ch = (unsigned char *)event.text.text; ch[0] != 0 && ch[0] < 128; ch++)
{
Char_Event (ch[0]);
}
Char_Event (ch[0]);
}
break;
#endif
@ -554,11 +554,6 @@ void IN_SendKeyEvents (void)
// on the key cap.
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);
break;
#else
@ -788,7 +783,7 @@ void IN_SendKeyEvents (void)
break;
}
Key_Event (sym, state);
if (event.type == SDL_KEYDOWN && sym != '`' && sym != '~')
if (event.type == SDL_KEYDOWN)
Char_Event (sym);
break;
#endif

View file

@ -443,6 +443,9 @@ void Char_Console (int key)
if (key < 32 || key > 126)
return; // non printable
if (!consolekeys[key])
return; // bindable key
if (keydown[K_CTRL])
return; // control character