diff --git a/src/m_menu.c b/src/m_menu.c index 4ae7174db..740e006a6 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -3937,7 +3937,6 @@ boolean M_Responder(event_t *ev) case KEY_BACKSPACE: if ((currentMenu->menuitems[itemOn].status) == IT_CONTROL) { - menu_text_input = false; //never use native layout for control setup // detach any keys associated with the game control G_ClearControlKeys(setupcontrols, currentMenu->menuitems[itemOn].alphaKey); S_StartSound(NULL, sfx_shldls); @@ -12136,6 +12135,7 @@ static void M_DrawControl(void) char tmp[50]; INT32 x, y, i, max, cursory = 0, iter; INT32 keys[2]; + menu_text_input = false; //never use native layout for control setup x = currentMenu->x; y = currentMenu->y; @@ -12252,6 +12252,7 @@ static void M_ChangecontrolResponse(event_t *ev) INT32 control; INT32 found; INT32 ch = ev->data1; + menu_text_input = false; //never use native layout for control setup // ESCAPE cancels; dummy out PAUSE if (ch != KEY_ESCAPE && ch != KEY_PAUSE) diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 3fa5d28c0..1ad0798c4 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -408,6 +408,7 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Scancode code) static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) { SDL_Event next_event; + boolean Text_Input_Only = (chat_on || CON_Ready() || (menu_text_input && menuactive)); //only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) // Special cases, where we always return a fixed value. switch (sym->sym) @@ -418,10 +419,13 @@ static INT32 GetTypedChar(SDL_Scancode code, SDL_Keysym *sym) break; } - while (SDL_PollEvent(&next_event) && next_event.type == SDL_TEXTINPUT) + if (Text_Input_Only) { - if (next_event.text.text[1] == '\0') // limit to ASCII - return next_event.text.text[0]; + while (SDL_PollEvent(&next_event) && next_event.type == SDL_TEXTINPUT) + { + if (next_event.text.text[1] == '\0') // limit to ASCII + return next_event.text.text[0]; + } } return Impl_SDL_Scancode_To_Keycode(code); //fallback @@ -820,7 +824,7 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) return; } - if (cv_keyboardlayout.value == 2 && (chat_on || CON_Ready() || (menu_text_input && menuactive))) //only use this this if on chat or console or the current menu wants inputs from us (except if its the control setup menu ig) + if (cv_keyboardlayout.value == 2) event.data1 = GetTypedChar(evt.keysym.scancode, &evt.keysym); else if (cv_keyboardlayout.value == 3) event.data1 = Impl_SDL_Keysym_To_Keycode(evt.keysym);