diff --git a/Quake/in_sdl.c b/Quake/in_sdl.c index 651aee11..caa7e4dd 100644 --- a/Quake/in_sdl.c +++ b/Quake/in_sdl.c @@ -1059,7 +1059,8 @@ void IN_SendKeyEvents (void) key = IN_SDL_KeysymToQuakeKey(event.key.keysym.sym); #endif - Key_Event (key, down); + // also pass along the underlying keycode using the proper current layout for Y/N prompts. + Key_EventWithKeycode (key, down, event.key.keysym.sym); #if !defined(USE_SDL2) if (down && (event.key.keysym.unicode & ~0x7F) == 0) diff --git a/Quake/keys.c b/Quake/keys.c index aad581b7..aaaee991 100644 --- a/Quake/keys.c +++ b/Quake/keys.c @@ -948,6 +948,21 @@ Should NOT be called during an interrupt! =================== */ void Key_Event (int key, qboolean down) +{ + Key_EventWithKeycode (key, down, 0); +} + +/* +=================== +Key_EventWithKeycode + +Called by the system between frames for both key up and key down events +Should NOT be called during an interrupt! +keycode parameter should have the key's actual keycode using the current keyboard layout, +not necessarily the US-keyboard-based scancode. Pass 0 if not applicable. +=================== +*/ +void Key_EventWithKeycode (int key, qboolean down, int keycode) { char *kb; char cmd[1024]; @@ -981,7 +996,11 @@ void Key_Event (int key, qboolean down) if (key_inputgrab.active) { if (down) + { key_inputgrab.lastkey = key; + if (keycode > 0) + key_inputgrab.lastchar = keycode; + } return; } @@ -1135,7 +1154,11 @@ Key_TextEntry qboolean Key_TextEntry (void) { if (key_inputgrab.active) - return true; + { + // This path is used for simple single-letter inputs (y/n prompts) that also + // accept controller input, so we don't want an onscreen keyboard for this case. + return false; + } switch (key_dest) { diff --git a/Quake/keys.h b/Quake/keys.h index 2e178efc..29beddd8 100644 --- a/Quake/keys.h +++ b/Quake/keys.h @@ -182,6 +182,7 @@ void Key_EndInputGrab (void); void Key_GetGrabbedInput (int *lastkey, int *lastchar); void Key_Event (int key, qboolean down); +void Key_EventWithKeycode (int key, qboolean down, int keycode); void Char_Event (int key); qboolean Key_TextEntry (void);