mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[USER32] Load keyboard layouts on logon correctly (#4686)
- Add IntLoadPreloadKeyboardLayouts helper function to load the layouts on log-on. - In UpdatePerUserSystemParameters function, call CliImmInitializeHotKeys and IntLoadPreloadKeyboardLayouts functions. CORE-16600
This commit is contained in:
parent
e215a088f9
commit
8e110335e7
3 changed files with 71 additions and 0 deletions
|
@ -130,5 +130,7 @@ HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom, BOOLEAN SystemProp);
|
|||
BOOL WINAPI InitializeImmEntryTable(VOID);
|
||||
HRESULT User32GetImmFileName(_Out_ LPWSTR lpBuffer, _In_ size_t cchBuffer);
|
||||
BOOL WINAPI UpdatePerUserImmEnabling(VOID);
|
||||
VOID APIENTRY CliImmInitializeHotKeys(DWORD dwAction, HKL hKL);
|
||||
VOID IntLoadPreloadKeyboardLayouts(VOID);
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -104,5 +104,11 @@ UpdatePerUserSystemParameters(DWORD dwReserved,
|
|||
// Update Imm support and load Imm32.dll.
|
||||
UpdatePerUserImmEnabling();
|
||||
|
||||
/* Delete all the IME hotkeys */
|
||||
CliImmInitializeHotKeys(SETIMEHOTKEY_DELETEALL, NULL);
|
||||
|
||||
/* Load Preload keyboard layouts */
|
||||
IntLoadPreloadKeyboardLayouts();
|
||||
|
||||
return NtUserUpdatePerUserSystemParameters(dwReserved, bEnable);
|
||||
}
|
||||
|
|
|
@ -143,6 +143,69 @@ Failure:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* Win: LoadPreloadKeyboardLayouts */
|
||||
VOID IntLoadPreloadKeyboardLayouts(VOID)
|
||||
{
|
||||
UINT nNumber, uFlags;
|
||||
DWORD cbValue, dwType;
|
||||
WCHAR szNumber[32], szValue[KL_NAMELENGTH];
|
||||
HKEY hPreloadKey;
|
||||
BOOL bOK = FALSE;
|
||||
HKL hKL, hDefaultKL = NULL;
|
||||
|
||||
if (RegOpenKeyW(HKEY_CURRENT_USER,
|
||||
L"Keyboard Layout\\Preload",
|
||||
&hPreloadKey) != ERROR_SUCCESS)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (nNumber = 1; nNumber <= 1000; ++nNumber)
|
||||
{
|
||||
_ultow(nNumber, szNumber, 10);
|
||||
|
||||
cbValue = sizeof(szValue);
|
||||
if (RegQueryValueExW(hPreloadKey,
|
||||
szNumber,
|
||||
NULL,
|
||||
&dwType,
|
||||
(LPBYTE)szValue,
|
||||
&cbValue) != ERROR_SUCCESS)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (dwType != REG_SZ)
|
||||
continue;
|
||||
|
||||
if (nNumber == 1) /* The first entry is for default keyboard layout */
|
||||
uFlags = KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET;
|
||||
else
|
||||
uFlags = KLF_SUBSTITUTE_OK | KLF_NOTELLSHELL | KLF_REPLACELANG;
|
||||
|
||||
hKL = LoadKeyboardLayoutW(szValue, uFlags);
|
||||
if (hKL)
|
||||
{
|
||||
bOK = TRUE;
|
||||
if (nNumber == 1) /* The first entry */
|
||||
hDefaultKL = hKL;
|
||||
}
|
||||
}
|
||||
|
||||
RegCloseKey(hPreloadKey);
|
||||
|
||||
if (hDefaultKL)
|
||||
SystemParametersInfoW(SPI_SETDEFAULTINPUTLANG, 0, &hDefaultKL, 0);
|
||||
|
||||
if (!bOK)
|
||||
{
|
||||
/* Fallback to English (US) */
|
||||
LoadKeyboardLayoutW(L"00000409", KLF_SUBSTITUTE_OK | KLF_ACTIVATE | KLF_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL APIENTRY
|
||||
CliSaveImeHotKey(DWORD dwID, UINT uModifiers, UINT uVirtualKey, HKL hKL, BOOL bDelete)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue