diff --git a/src/console.c b/src/console.c index 54d9f6c9e..0ada64454 100644 --- a/src/console.c +++ b/src/console.c @@ -1259,8 +1259,8 @@ boolean CON_Responder(event_t *ev) return true; } -#ifdef HAVE_TEXTINPUT - if (!cv_textinput.value) +#ifdef TEXTINPUTEVENTS + if (!cv_keyboardlocale.value) #endif { // allow people to use keypad in console (good for typing IP addresses) - Calum diff --git a/src/d_netcmd.c b/src/d_netcmd.c index e5e8e2251..8dbf22d4c 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -817,20 +817,20 @@ void D_RegisterClientCommands(void) CV_RegisterVar(&cv_joyscale); CV_RegisterVar(&cv_joyscale2); - // * cv_textinput allows "text input" events from SDL, - // so that console and chat is guaranteed to use - // the player's keyboard locale reliably - // * When disabled, the game will fallback to using - // keycode events, still following the player's locale - // * If cv_keyboardlocale is disabled, input will default - // to using the US keyboard layout - // * cv_forceqwerty forces a QWERTY layout, but only - // if text input events are disabled + // * cv_keyboardlocale uses text input events from the interface, + // so that the console, chat, and menu are guaranteed to + // use the player's keyboard locale. + // * If cv_usekeycodes is enabled, but cv_keyboardlocale is enabled, + // the game will use keycode events. + // * If cv_keyboardlocale is disabled, and cv_usekeycodes is disabled, + // the game will use scancode events. + // * cv_forceqwerty forces a QWERTY layout, + // if cv_keyboardlocale is disabled, and cv_usekeycodes is enabled. -#ifdef HAVE_TEXTINPUT - CV_RegisterVar (&cv_textinput); -#endif +#ifdef TEXTINPUTEVENTS CV_RegisterVar (&cv_keyboardlocale); +#endif + CV_RegisterVar (&cv_usekeycodes); CV_RegisterVar (&cv_forceqwerty); // Analog Control diff --git a/src/doomdef.h b/src/doomdef.h index 9b6002619..822f318b2 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -629,7 +629,7 @@ extern const char *compdate, *comptime, *comprevision, *compbranch; #define SECTORSPECIALSAFTERTHINK /// Text input events -#define HAVE_TEXTINPUT +#define TEXTINPUTEVENTS /// Sprite rotation #define ROTSPRITE diff --git a/src/g_input.c b/src/g_input.c index b66f016e8..6ab3b36e0 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -25,10 +25,10 @@ static CV_PossibleValue_t keyboardlocale_cons_t[] = { {2, "Only in text fields"}, {0, NULL}}; -#ifdef HAVE_TEXTINPUT -consvar_t cv_textinput = CVAR_INIT ("textinput", "On", CV_SAVE, CV_OnOff, NULL); +#ifdef TEXTINPUTEVENTS +consvar_t cv_keyboardlocale = CVAR_INIT ("keyboardlocale", "On", CV_SAVE, CV_OnOff, NULL); #endif -consvar_t cv_keyboardlocale = CVAR_INIT ("keyboardlocale", "Off", CV_SAVE, keyboardlocale_cons_t, NULL); +consvar_t cv_usekeycodes = CVAR_INIT ("usekeycodes", "Off", CV_SAVE, keyboardlocale_cons_t, NULL); consvar_t cv_forceqwerty = CVAR_INIT ("forceqwerty", "Off", CV_SAVE, CV_OnOff, NULL); #define MAXMOUSESENSITIVITY 100 // sensitivity steps diff --git a/src/g_input.h b/src/g_input.h index 3dde45c3c..37aba6526 100644 --- a/src/g_input.h +++ b/src/g_input.h @@ -111,10 +111,10 @@ typedef enum num_gamecontrolschemes } gamecontrolschemes_e; -#ifdef HAVE_TEXTINPUT -extern consvar_t cv_textinput; -#endif +#ifdef TEXTINPUTEVENTS extern consvar_t cv_keyboardlocale; +#endif +extern consvar_t cv_usekeycodes; extern consvar_t cv_forceqwerty; // mouse values are used once diff --git a/src/hu_stuff.c b/src/hu_stuff.c index f6ac0aabd..abc71eb61 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1167,8 +1167,8 @@ boolean HU_Responder(event_t *ev) c = (INT32)ev->data1; -#ifdef HAVE_TEXTINPUT - if (!cv_textinput.value) +#ifdef TEXTINPUTEVENTS + if (!cv_keyboardlocale.value) #endif { // I know this looks very messy but this works. If it ain't broke, don't fix it! diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index 765edfc31..f31d592c6 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -278,13 +278,13 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type) SDL_Keycode keycode = keysym.sym; boolean useqwerty = true; - boolean uselocale = (!!cv_keyboardlocale.value); + boolean uselocale = (!!cv_usekeycodes.value); -#ifdef HAVE_TEXTINPUT - if (cv_textinput.value) +#ifdef TEXTINPUTEVENTS + if (cv_keyboardlocale.value) uselocale = true; #else - if (cv_keyboardlocale.value == 2 + if (cv_usekeycodes.value == 2 && !(CON_AcceptInput() || M_TextInput() || HU_ChatActive())) uselocale = false; #endif @@ -338,8 +338,8 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type) // Send key up events to avoid stuck movement keys if (type != SDL_KEYUP && (!ctrldown)) { -#ifdef HAVE_TEXTINPUT - if (cv_textinput.value) +#ifdef TEXTINPUTEVENTS + if (cv_keyboardlocale.value) { // console input if (CON_AcceptInput()) @@ -476,11 +476,11 @@ static INT32 Impl_SDL_Scancode_To_Keycode(SDL_Keysym keysym, Uint32 type) return KEY_F1 + (scancode - SDL_SCANCODE_F1); } -#ifdef HAVE_TEXTINPUT +#ifdef TEXTINPUTEVENTS // Send key up events to avoid stuck movement keys if (type != SDL_KEYUP && (!ctrldown)) { - if (cv_textinput.value) + if (cv_keyboardlocale.value) { // console input if (CON_AcceptInput()) @@ -842,12 +842,12 @@ static void Impl_HandleKeyboardEvent(SDL_KeyboardEvent evt, Uint32 type) if (event.data1) D_PostEvent(&event); } -#ifdef HAVE_TEXTINPUT +#ifdef TEXTINPUTEVENTS static void Impl_HandleTextInputEvent(char *text) { event_t event; - if (!cv_textinput.value) + if (!cv_keyboardlocale.value) return; if (!(CON_AcceptInput() // console input @@ -1112,7 +1112,7 @@ void I_GetEvent(void) case SDL_KEYDOWN: Impl_HandleKeyboardEvent(evt.key, evt.type); break; -#ifdef HAVE_TEXTINPUT +#ifdef TEXTINPUTEVENTS case SDL_TEXTINPUT: Impl_HandleTextInputEvent(evt.text.text); break;