mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
sdlayer.c: for Windows, switch keyboard layout to/from US on init/uninit.
Taking over the code from winlayer.c. git-svn-id: https://svn.eduke32.com/eduke32@4482 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
e61afe6d88
commit
4ea4bf2ea9
1 changed files with 45 additions and 0 deletions
|
@ -626,6 +626,44 @@ void debugprintf(const char *f, ...)
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static void switchlayout(const char *layout)
|
||||||
|
{
|
||||||
|
char layoutname[KL_NAMELENGTH];
|
||||||
|
|
||||||
|
GetKeyboardLayoutName(layoutname);
|
||||||
|
|
||||||
|
if (!Bstrcmp(layoutname, layout))
|
||||||
|
return;
|
||||||
|
|
||||||
|
initprintf("Switching keyboard layout from %s to %s\n", layoutname, layout);
|
||||||
|
LoadKeyboardLayout(layout, KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void W_SetKeyboardLayoutUS(int32_t resetp)
|
||||||
|
{
|
||||||
|
static char defaultlayoutname[KL_NAMELENGTH];
|
||||||
|
|
||||||
|
if (!resetp)
|
||||||
|
{
|
||||||
|
static int done = 0;
|
||||||
|
|
||||||
|
if (!done)
|
||||||
|
{
|
||||||
|
GetKeyboardLayoutName(defaultlayoutname);
|
||||||
|
// 00000409 is "American English"
|
||||||
|
switchlayout("00000409");
|
||||||
|
|
||||||
|
done = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (defaultlayoutname[0])
|
||||||
|
{
|
||||||
|
switchlayout(defaultlayoutname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// static int32_t joyblast=0;
|
// static int32_t joyblast=0;
|
||||||
static SDL_Joystick *joydev = NULL;
|
static SDL_Joystick *joydev = NULL;
|
||||||
|
|
||||||
|
@ -636,6 +674,10 @@ int32_t initinput(void)
|
||||||
{
|
{
|
||||||
int32_t i,j;
|
int32_t i,j;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
W_SetKeyboardLayoutUS(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
|
// force OS X to operate in >1 button mouse mode so that LMB isn't adulterated
|
||||||
if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1");
|
if (!getenv("SDL_HAS3BUTTONMOUSE")) putenv("SDL_HAS3BUTTONMOUSE=1");
|
||||||
|
@ -718,6 +760,9 @@ int32_t initinput(void)
|
||||||
//
|
//
|
||||||
void uninitinput(void)
|
void uninitinput(void)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
W_SetKeyboardLayoutUS(1);
|
||||||
|
#endif
|
||||||
uninitmouse();
|
uninitmouse();
|
||||||
|
|
||||||
if (joydev)
|
if (joydev)
|
||||||
|
|
Loading…
Reference in a new issue