From 87ee51a248224b6de6260613f05e7f66baf65700 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 3 May 2015 07:02:23 +0000 Subject: [PATCH] Menus: Call SDL_Start/StopTextInput() at the appropriate times so that touch devices display the on-screen keyboard when the user is prompted for text input. git-svn-id: https://svn.eduke32.com/eduke32@5170 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/menus.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index be71df49f..08c2c62fd 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -3413,6 +3413,10 @@ void M_ChangeMenu(MenuID_t cm) { typebuf[0] = 0; ((MenuTextForm_t*)m_currentMenu->object)->input = typebuf; + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StartTextInput(); +#endif } else if (m_currentMenu->type == FileSelect) M_MenuFileSelectInit((MenuFileSelect_t*)m_currentMenu->object); @@ -5175,6 +5179,10 @@ static void M_RunMenuInput_MenuEntryString_Activate(MenuEntry_t *entry) object->maxlength = TYPEBUFSIZE; M_MenuEntryStringActivate(/*entry*/); + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StartTextInput(); +#endif } static void M_RunMenuInput_MenuEntryString_Submit(MenuEntry_t *entry, MenuString_t *object) @@ -5183,6 +5191,10 @@ static void M_RunMenuInput_MenuEntryString_Submit(MenuEntry_t *entry, MenuString Bstrncpy(object->variable, object->editfield, object->maxlength); object->editfield = NULL; + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StopTextInput(); +#endif } static void M_RunMenuInput_MenuEntryString_Cancel(/*MenuEntry_t *entry, */MenuString_t *object) @@ -5190,6 +5202,10 @@ static void M_RunMenuInput_MenuEntryString_Cancel(/*MenuEntry_t *entry, */MenuSt M_MenuEntryStringCancel(/*entry*/); object->editfield = NULL; + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StopTextInput(); +#endif } static void M_RunMenuInput_FileSelect_MovementVerify(MenuFileSelect_t *object) @@ -5313,6 +5329,10 @@ static void M_RunMenuInput(Menu_t *cm) object->input = NULL; M_ChangeMenuAnimate(cm->parentID, cm->parentAnimation); + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StopTextInput(); +#endif } else if (hitstate == 1 || M_RunMenuInput_MouseAdvance()) { @@ -5321,6 +5341,10 @@ static void M_RunMenuInput(Menu_t *cm) M_MenuTextFormSubmit(object->input); object->input = NULL; + +#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1 + SDL_StopTextInput(); +#endif } break; }