diff --git a/reactos/subsystems/win32/win32k/include/input.h b/reactos/subsystems/win32/win32k/include/input.h index c5f3e11a599..5239843703d 100644 --- a/reactos/subsystems/win32/win32k/include/input.h +++ b/reactos/subsystems/win32/win32k/include/input.h @@ -68,8 +68,8 @@ BOOL NTAPI UserSendKeyboardInput(KEYBDINPUT *pKbdInput, BOOL bInjected); VOID NTAPI UserProcessMouseInput(PMOUSE_INPUT_DATA Data, ULONG InputCount); BOOL FASTCALL IntBlockInput(PTHREADINFO W32Thread, BOOL BlockIt); BOOL FASTCALL IntMouseInput(MOUSEINPUT *mi, BOOL Injected); -BOOL UserInitDefaultKeyboardLayout(VOID); -PKL UserHklToKbl(HKL hKl); +PKL NTAPI UserHklToKbl(HKL hKl); +BOOL NTAPI UserSetDefaultInputLang(HKL hKl); VOID NTAPI KeyboardThreadMain(PVOID StartContext); DWORD NTAPI CreateSystemThreads(UINT Type); BOOL FASTCALL UserAttachThreadInput(PTHREADINFO,PTHREADINFO,BOOL); diff --git a/reactos/subsystems/win32/win32k/ntuser/hotkey.c b/reactos/subsystems/win32/win32k/ntuser/hotkey.c index d0b86077cf1..0e2fa2d1405 100644 --- a/reactos/subsystems/win32/win32k/ntuser/hotkey.c +++ b/reactos/subsystems/win32/win32k/ntuser/hotkey.c @@ -448,14 +448,13 @@ BOOL APIENTRY NtUserUnregisterHotKey(HWND hWnd, int id) { PHOT_KEY pHotKey = gphkFirst, phkNext, *pLink = &gphkFirst; - PWND pWnd; BOOL bRet = FALSE; TRACE("Enter NtUserUnregisterHotKey\n"); UserEnterExclusive(); - pWnd = UserGetWindowObject(hWnd); - if (!pWnd) + /* Fail if given window is invalid */ + if (hWnd && !UserGetWindowObject(hWnd)) goto cleanup; while (pHotKey) diff --git a/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c b/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c index f49f9e88421..34ce5a00694 100644 --- a/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c +++ b/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c @@ -324,6 +324,7 @@ W32kGetDefaultKeyLayout(VOID) * Gets KL object from hkl value */ PKL +NTAPI UserHklToKbl(HKL hKl) { PKL pKl = gspklBaseLayout; @@ -342,6 +343,25 @@ UserHklToKbl(HKL hKl) return NULL; } +/* + * UserSetDefaultInputLang + * + * Sets default kyboard layout for system. Called from UserSystemParametersInfo. + */ +BOOL +NTAPI +UserSetDefaultInputLang(HKL hKl) +{ + PKL pKl; + + pKl = UserHklToKbl(hKl); + if (!pKl) + return FALSE; + + gspklBaseLayout = pKl; + return TRUE; +} + /* * co_UserActivateKbl * @@ -598,9 +618,6 @@ NtUserLoadKeyboardLayoutEx( /* If this layout was prepared to unload, undo it */ pKl->dwKL_Flags &= ~KLF_UNLOAD; - /* Loaded keyboard layout became the default */ - gspklBaseLayout = pKl; - /* Activate this layout in current thread */ if (Flags & KLF_ACTIVATE) co_UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKl, Flags); diff --git a/reactos/subsystems/win32/win32k/ntuser/sysparams.c b/reactos/subsystems/win32/win32k/ntuser/sysparams.c index 77f145dd5c3..9ff4e4765d3 100644 --- a/reactos/subsystems/win32/win32k/ntuser/sysparams.c +++ b/reactos/subsystems/win32/win32k/ntuser/sysparams.c @@ -1167,8 +1167,19 @@ SpiGetSet(UINT uiAction, UINT uiParam, PVOID pvParam, FLONG fl) break; case SPI_SETDEFAULTINPUTLANG: - ERR("SPI_SETDEFAULTINPUTLANG is unimplemented\n"); - break; + { + HKL hkl; + + if (!SpiSet(&hkl, pvParam, sizeof(hkl), fl)) + return FALSE; + + if (fl & SPIF_UPDATEINIFILE) + { + // FIXME: what to do? + } + + return UserSetDefaultInputLang(hkl); + } case SPI_SETLANGTOGGLE: ERR("SPI_SETLANGTOGGLE is unimplemented\n");