cleanup IME_UpdateInputLocale

- do not store the HKL in a static variable
- always set the ime_candvertical value in case the HKL is changed
This commit is contained in:
pionere 2022-01-18 17:44:51 +01:00 committed by Ryan C. Gordon
parent 25aa7244dc
commit 32c7d5d352
1 changed files with 5 additions and 18 deletions

View File

@ -712,26 +712,13 @@ IME_SetWindow(SDL_VideoData* videodata, HWND hwnd)
static void static void
IME_UpdateInputLocale(SDL_VideoData *videodata) IME_UpdateInputLocale(SDL_VideoData *videodata)
{ {
static HKL hklprev = 0; HKL hklnext = GetKeyboardLayout(0);
videodata->ime_hkl = GetKeyboardLayout(0);
if (hklprev == videodata->ime_hkl) if (hklnext == videodata->ime_hkl)
return; return;
hklprev = videodata->ime_hkl; videodata->ime_hkl = hklnext;
switch (PRIMLANG()) { videodata->ime_candvertical = (PRIMLANG() == LANG_KOREAN || LANG() == LANG_CHS) ? SDL_FALSE : SDL_TRUE;
case LANG_CHINESE:
videodata->ime_candvertical = SDL_TRUE;
if (SUBLANG() == SUBLANG_CHINESE_SIMPLIFIED)
videodata->ime_candvertical = SDL_FALSE;
break;
case LANG_JAPANESE:
videodata->ime_candvertical = SDL_TRUE;
break;
case LANG_KOREAN:
videodata->ime_candvertical = SDL_FALSE;
break;
}
} }
static void static void