mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 06:41:59 +00:00
sdlayer: Place SDL_KEYDOWN events into keyasciififo[] when SDL_TEXTINPUT events are disabled.
This way, SDL_StopTextInput() does not break text entry for code that uses keyasciififo[] but does not currently call SDL_StartTextInput(), or if it cannot, such as Duke's cheat entry. Technically we could revert r5326 and r5331, but since we only currently have support for showing ASCII text glyphs as bitmap fonts in ART tiles, there is no point to showing an IME on platforms that don't need an on-screen keyboard. git-svn-id: https://svn.eduke32.com/eduke32@5968 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
2b38557f49
commit
be22de78ad
1 changed files with 51 additions and 0 deletions
|
@ -2208,6 +2208,57 @@ int32_t handleevents_pollsdl(void)
|
|||
if (OSD_HandleChar(keyvalue))
|
||||
keyascfifo_insert(keyvalue);
|
||||
}
|
||||
else if (ev.key.type == SDL_KEYDOWN && (unsigned)ev.key.keysym.sym <= 0x7Fu &&
|
||||
ev.key.keysym.sym != scantoasc[OSD_OSDKey()] && !keyascfifo_isfull() &&
|
||||
!SDL_IsTextInputActive())
|
||||
{
|
||||
/*
|
||||
Necessary for Duke 3D's method of entering cheats to work without showing IMEs.
|
||||
SDL_TEXTINPUT is preferable overall, but with bitmap fonts it has no advantage.
|
||||
*/
|
||||
char keyvalue = ev.key.keysym.sym;
|
||||
|
||||
if ('a' <= keyvalue && keyvalue <= 'z')
|
||||
{
|
||||
if (!!(ev.key.keysym.mod & KMOD_SHIFT) ^ !!(ev.key.keysym.mod & KMOD_CAPS))
|
||||
keyvalue -= 'a'-'A';
|
||||
}
|
||||
else if (ev.key.keysym.mod & KMOD_SHIFT)
|
||||
{
|
||||
switch (keyvalue)
|
||||
{
|
||||
case '\'': keyvalue = '"'; break;
|
||||
|
||||
case ',': keyvalue = '<'; break;
|
||||
case '-': keyvalue = '_'; break;
|
||||
case '.': keyvalue = '>'; break;
|
||||
case '/': keyvalue = '?'; break;
|
||||
case '0': keyvalue = ')'; break;
|
||||
case '1': keyvalue = '!'; break;
|
||||
case '2': keyvalue = '@'; break;
|
||||
case '3': keyvalue = '#'; break;
|
||||
case '4': keyvalue = '$'; break;
|
||||
case '5': keyvalue = '%'; break;
|
||||
case '6': keyvalue = '^'; break;
|
||||
case '7': keyvalue = '&'; break;
|
||||
case '8': keyvalue = '*'; break;
|
||||
case '9': keyvalue = '('; break;
|
||||
|
||||
case ';': keyvalue = ':'; break;
|
||||
|
||||
case '=': keyvalue = '+'; break;
|
||||
|
||||
case '[': keyvalue = '{'; break;
|
||||
case '\\': keyvalue = '|'; break;
|
||||
case ']': keyvalue = '}'; break;
|
||||
|
||||
case '`': keyvalue = '~'; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (OSD_HandleChar(keyvalue))
|
||||
keyascfifo_insert(keyvalue);
|
||||
}
|
||||
|
||||
// initprintf("SDL2: got key %d, %d, %u\n", ev.key.keysym.scancode, code, ev.key.type);
|
||||
|
||||
|
|
Loading…
Reference in a new issue