Author: tretiakov Date: Thu Feb 22 22:41:10 2007 New Revision: 25879
URL: http://svn.reactos.org/svn/reactos?rev=25879&view=rev Log: NtUserLoadKeyboardLayoutEx: Support KLF_REORDER and KLF_ACTIVATE. NtUserActivateKeyboardLayout: Support HKL_NEXT, HKL_PREV, KLF_REORDER.
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
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 (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/kbdlayout.c Thu Feb 22 22:41:10 2007 @@ -328,7 +328,7 @@ Thread->KeyboardLayout = pKbl; pKbl->RefCount++;
- // Post WM_INPUTLANGCHANGE to thread's focus window + // Send WM_INPUTLANGCHANGE to thread's focus window
Msg.hwnd = Thread->MessageQueue->FocusWindow; Msg.message = WM_INPUTLANGCHANGE; @@ -457,33 +457,46 @@ IN DWORD Unused4) { HKL Ret = NULL; - PKBL pKbl; + PKBL pKbl = NULL, Cur;
UserEnterExclusive();
- pKbl = KBLList; + Cur = KBLList; do { - if(pKbl->klid == dwKLID) - { - Ret = pKbl->hkl; + if(Cur->klid == dwKLID) + { + pKbl = Cur; + break; + } + + Cur = (PKBL) Cur->List.Flink; + } while(Cur != KBLList); + + if(!pKbl) + { + pKbl = UserLoadDllAndCreateKbl(dwKLID); + + if(!pKbl) + { goto the_end; }
- pKbl = (PKBL) pKbl->List.Flink; - } while(pKbl != KBLList); - - pKbl = UserLoadDllAndCreateKbl(dwKLID); - - if(!pKbl) - { - goto the_end; - } - - InsertTailList(&KBLList->List, &pKbl->List); + InsertTailList(&KBLList->List, &pKbl->List); + } + + if(Flags & KLF_REORDER) KBLList = pKbl; + + if(Flags & KLF_ACTIVATE) + { + UserActivateKbl(PsGetCurrentThreadWin32Thread(), pKbl); + } + Ret = pKbl->hkl;
//FIXME: Respect Flags! + // KLF_NOTELLSHELL KLF_SETFORPROCESS + // KLF_REPLACELANG KLF_SUBSTITUTE_OK
the_end: UserLeave(); @@ -502,17 +515,35 @@
UserEnterExclusive();
- pKbl = UserHklToKbl(hKl); - - //FIXME: Respect flags! + pWThread = PsGetCurrentThreadWin32Thread(); + + if(pWThread->KeyboardLayout->hkl == hKl) + { + Ret = hKl; + goto the_end; + } + + if(hKl == (HKL)HKL_NEXT) + { + pKbl = (PKBL)pWThread->KeyboardLayout->List.Flink; + } + else if(hKl == (HKL)HKL_PREV) + { + pKbl = (PKBL)pWThread->KeyboardLayout->List.Blink; + } + else pKbl = UserHklToKbl(hKl); + + //FIXME: KLF_RESET, KLF_SHIFTLOCK + //FIXME: KLF_SETFORPROCESS
if(pKbl) { - pWThread = PsGetCurrentThreadWin32Thread(); - - if(pWThread->KeyboardLayout->hkl == hKl) - { - Ret = hKl; + if(Flags & KLF_REORDER) + KBLList = pKbl; + + if(pKbl == pWThread->KeyboardLayout) + { + Ret = pKbl->hkl; } else { @@ -521,6 +552,7 @@ } }
+the_end: UserLeave(); return Ret; }