Author: rharabien Date: Fri Oct 21 14:54:22 2011 New Revision: 54223
URL: http://svn.reactos.org/svn/reactos?rev=54223&view=rev Log: [WIN32K] - Don't set every loaded layout as default. Instead implement SPI_SETDEFAULTINPUTLANG. Fixes some minor problems with wrong layout loaded. - Fix removing hotkey not associated with window (fixes winetest).
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c
Modified: trunk/reactos/subsystems/win32/win32k/include/input.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/include/input.h [iso-8859-1] Fri Oct 21 14:54:22 2011 @@ -68,8 +68,8 @@ 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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/hotkey.c [iso-8859-1] Fri Oct 21 14:54:22 2011 @@ -448,14 +448,13 @@ 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)
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c [iso-8859-1] Fri Oct 21 14:54:22 2011 @@ -324,6 +324,7 @@ * Gets KL object from hkl value */ PKL +NTAPI UserHklToKbl(HKL hKl) { PKL pKl = gspklBaseLayout; @@ -340,6 +341,25 @@ } while (pKl != gspklBaseLayout);
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; }
/* @@ -598,9 +618,6 @@ /* 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);
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/sysparams.c [iso-8859-1] Fri Oct 21 14:54:22 2011 @@ -1167,8 +1167,19 @@ 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");