Menus: don't repeat #ifdef/#endif for SDL_{Start,Stop}TextInput().

git-svn-id: https://svn.eduke32.com/eduke32@5325 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-08-09 09:58:46 +00:00
parent 607f8e1d1c
commit 9b68ee5693

View file

@ -59,6 +59,20 @@ extern int32_t voting;
#define USERMAPENTRYLENGTH 25
static inline void WithSDL2_StartTextInput()
{
#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
SDL_StartTextInput();
#endif
}
static inline void WithSDL2_StopTextInput()
{
#if defined SDL_MAJOR_VERSION && SDL_MAJOR_VERSION > 1
SDL_StopTextInput();
#endif
}
#define mgametext(x,y,t) G_ScreenText(STARTALPHANUM, x, y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, -1<<16, 0, 0, 0, 0, xdim-1, ydim-1)
#define mgametextcenter(x,y,t) G_ScreenText(STARTALPHANUM, (MENU_MARGIN_CENTER<<16) + (x), y, 65536, 0, 0, t, 0, 0, 2|8|16|ROTATESPRITE_FULL16, 0, 5<<16, 8<<16, -1<<16, 1<<16, TEXT_XCENTER, 0, 0, xdim-1, ydim-1)
#define mminitext(x,y,t,p) minitext_(x, y, t, 0, p, 2|8|16|ROTATESPRITE_FULL16)
@ -3402,10 +3416,7 @@ 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
WithSDL2_StartTextInput();
}
else if (m_currentMenu->type == FileSelect)
M_MenuFileSelectInit((MenuFileSelect_t*)m_currentMenu->object);
@ -5168,10 +5179,7 @@ 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
WithSDL2_StartTextInput();
}
static void M_RunMenuInput_MenuEntryString_Submit(MenuEntry_t *entry, MenuString_t *object)
@ -5180,10 +5188,7 @@ 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
WithSDL2_StopTextInput();
}
static void M_RunMenuInput_MenuEntryString_Cancel(/*MenuEntry_t *entry, */MenuString_t *object)
@ -5191,10 +5196,7 @@ 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
WithSDL2_StopTextInput();
}
static void M_RunMenuInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
@ -5318,10 +5320,7 @@ 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
WithSDL2_StopTextInput();
}
else if (hitstate == 1 || M_RunMenuInput_MouseAdvance())
{
@ -5330,10 +5329,7 @@ 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
WithSDL2_StopTextInput();
}
break;
}