Rename some (recently added) functions.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1092 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Sander van Dijk 2014-10-08 18:30:17 +00:00
parent 5e73eb18a4
commit c23a0197d6
5 changed files with 30 additions and 25 deletions

View File

@ -261,12 +261,17 @@ void IN_Deactivate (qboolean free_cursor)
void IN_Init (void)
{
textmode = Key_InputtingText();
textmode = Key_TextEntry();
#if !defined(USE_SDL2)
SDL_EnableUNICODE (textmode);
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
#else
if (textmode)
SDL_StartTextInput();
else
SDL_StopTextInput();
#endif
if (safemode || COM_CheckParm("-nomouse"))
{
@ -355,7 +360,7 @@ void IN_ClearStates (void)
void IN_UpdateInputMode (void)
{
qboolean want_textmode = Key_InputtingText();
qboolean want_textmode = Key_TextEntry();
if (textmode != want_textmode)
{
textmode = want_textmode;
@ -569,16 +574,7 @@ static inline int IN_SDL2_ScancodeToQuakeKey(SDL_Scancode scancode)
}
#endif
static inline qboolean IN_ExpectingCharEvent (SDL_Event event)
{
#if defined(USE_SDL2)
return (SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_TEXTINPUT, SDL_TEXTINPUT) > 0);
#else
return (event.key.keysym.unicode != 0);
#endif
}
static inline qboolean IN_IsNumpadKey (int key)
static inline qboolean IN_NumpadKey (int key)
{
switch (key)
{
@ -599,6 +595,15 @@ static inline qboolean IN_IsNumpadKey (int key)
}
}
static inline qboolean IN_ExpectCharEvent (SDL_Event event)
{
#if defined(USE_SDL2)
return (SDL_PeepEvents(&event, 1, SDL_PEEKEVENT, SDL_TEXTINPUT, SDL_TEXTINPUT) > 0);
#else
return (event.key.keysym.unicode != 0);
#endif
}
void IN_SendKeyEvents (void)
{
SDL_Event event;
@ -672,7 +677,7 @@ void IN_SendKeyEvents (void)
// to also send a char event. Doing this only for key down events
// will generate some stray key up events, but that's much less
// problematic than missing key up events.
if (down && textmode && IN_IsNumpadKey(key) && IN_ExpectingCharEvent(event))
if (down && textmode && IN_NumpadKey(key) && IN_ExpectCharEvent(event))
key = 0;
#if defined(USE_SDL2)

View File

@ -1113,10 +1113,10 @@ void Char_Event (int key)
/*
===================
Key_InputtingText
Key_TextEntry
===================
*/
qboolean Key_InputtingText (void)
qboolean Key_TextEntry (void)
{
if (key_inputgrab.active)
return true;
@ -1126,7 +1126,7 @@ qboolean Key_InputtingText (void)
case key_message:
return true;
case key_menu:
return M_InputtingText();
return M_TextEntry();
case key_game:
if (!con_forcedup)
return false;

View File

@ -171,7 +171,7 @@ void Key_GetGrabbedInput (int *lastkey, int *lastchar);
void Key_Event (int key, qboolean down);
void Char_Event (int key);
qboolean Key_InputtingText (void);
qboolean Key_TextEntry (void);
qboolean Key_IgnoreTextInput (int key);
void Key_SetBinding (int keynum, const char *binding);

View File

@ -861,7 +861,7 @@ void M_Setup_Char (int k)
}
qboolean M_Setup_InputtingText (void)
qboolean M_Setup_TextEntry (void)
{
return (setup_cursor == 0 || setup_cursor == 1);
}
@ -1641,7 +1641,7 @@ void M_Quit_Char (int key)
}
qboolean M_Quit_InputtingText (void)
qboolean M_Quit_TextEntry (void)
{
return true;
}
@ -1889,7 +1889,7 @@ void M_LanConfig_Char (int key)
}
qboolean M_LanConfig_InputtingText (void)
qboolean M_LanConfig_TextEntry (void)
{
return (lanConfig_cursor == 0 || lanConfig_cursor == 2);
}
@ -2725,16 +2725,16 @@ void M_Charinput (int key)
}
qboolean M_InputtingText (void)
qboolean M_TextEntry (void)
{
switch (m_state)
{
case m_setup:
return M_Setup_InputtingText ();
return M_Setup_TextEntry ();
case m_quit:
return M_Quit_InputtingText ();
return M_Quit_TextEntry ();
case m_lanconfig:
return M_LanConfig_InputtingText ();
return M_LanConfig_TextEntry ();
default:
return false;
}

View File

@ -54,7 +54,7 @@ extern qboolean m_entersound;
void M_Init (void);
void M_Keydown (int key);
void M_Charinput (int key);
qboolean M_InputtingText (void);
qboolean M_TextEntry (void);
void M_ToggleMenu_f (void);
void M_Menu_Main_f (void);