Cut out text input from SDL2 until it can be tested

This commit is contained in:
Michael Martin
2019-08-25 15:38:42 -07:00
parent f1e29a0fda
commit a07e65ffd3
+25
View File
@@ -33,13 +33,16 @@
static int kbdhead=0, kbdtail=0;
static UniChar kbdbuf[KBDBUFSIZE];
static UniChar lastchar;
#ifdef SDL_MAJOR_VERSION == 1
static unsigned int num_keys = 0;
static int *kbdstate = NULL;
// Holds all SDL keys +1 for holding invalid values
#endif // Later versions of SDL use the text input API instead
static volatile int *menu_vec;
static int num_menu;
// The last vector element is the character repeat "key"
// This is only used in SDL1 input but it's mostly harmless everywhere else
#define KEY_MENU_ANY (num_menu - 1)
static volatile int *flight_vec;
static int num_templ;
@@ -193,8 +196,10 @@ initKeyConfig (void)
static void
resetKeyboardState (void)
{
#if SDL_MAJOR_VERSION == 1
memset (kbdstate, 0, sizeof (int) * num_keys);
menu_vec[KEY_MENU_ANY] = 0;
#endif
}
void
@@ -221,9 +226,11 @@ TFB_InitInput (int driver, int flags)
(void)driver;
(void)flags;
#if SDL_MAJOR_VERSION == 1
SDL_EnableUNICODE(1);
(void)SDL_GetKeyState (&num_keys);
kbdstate = (int *)HMalloc (sizeof (int) * (num_keys + 1));
#endif
#ifdef HAVE_JOYSTICK
@@ -329,6 +336,8 @@ ProcessMouseEvent (const SDL_Event *e)
}
}
#if SDL_MAJOR_VERSION == 1
static inline int
is_numpad_char_event (const SDL_Event *Event)
{
@@ -397,6 +406,22 @@ ProcessInputEvent (const SDL_Event *Event)
}
}
}
#else
void
ProcessInputEvent (const SDL_Event *Event)
{
if (!InputInitialized)
return;
ProcessMouseEvent (Event);
/* TODO: Block numpad input when NUM_LOCK is on */
VControl_HandleEvent (Event);
/* TODO: Handle SDL_TEXTINPUT events */
}
#endif
void
TFB_ResetControls (void)