https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b76602ff229d9ad0e9d09…
commit b76602ff229d9ad0e9d09b2b6b54cd62b6373f05
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Tue Sep 13 14:32:39 2022 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Tue Sep 13 14:32:39 2022 +0900
[NTUSER] Fix UserSetDefaultInputLang by using reordering
- Move IntReorderKeyboardLayouts function.
- Fix UserSetDefaultInputLang function.
CORE-11700
---
win32ss/user/ntuser/kbdlayout.c | 42 ++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c
index 45e055d8758..2f1aed71039 100644
--- a/win32ss/user/ntuser/kbdlayout.c
+++ b/win32ss/user/ntuser/kbdlayout.c
@@ -556,6 +556,26 @@ UserHklToKbl(HKL hKl)
return NULL;
}
+// Win: ReorderKeyboardLayouts
+VOID FASTCALL
+IntReorderKeyboardLayouts(
+ _Inout_ PWINSTATION_OBJECT pWinSta,
+ _Inout_ PKL pNewKL)
+{
+ PKL pOldKL = gspklBaseLayout;
+
+ if ((pWinSta->Flags & WSS_NOIO) || pNewKL == pOldKL)
+ return;
+
+ pNewKL->pklPrev->pklNext = pNewKL->pklNext;
+ pNewKL->pklNext->pklPrev = pNewKL->pklPrev;
+ pNewKL->pklNext = pOldKL;
+ pNewKL->pklPrev = pOldKL->pklPrev;
+ pOldKL->pklPrev->pklNext = pNewKL;
+ pOldKL->pklPrev = pNewKL;
+ gspklBaseLayout = pNewKL; /* Should we use UserAssignmentLock? */
+}
+
/*
* UserSetDefaultInputLang
*
@@ -571,7 +591,7 @@ UserSetDefaultInputLang(HKL hKl)
if (!pKl)
return FALSE;
- gspklBaseLayout = pKl;
+ IntReorderKeyboardLayouts(IntGetProcessWindowStation(NULL), pKl);
return TRUE;
}
@@ -741,26 +761,6 @@ co_UserActivateKeyboardLayout(
return hOldKL;
}
-// Win: ReorderKeyboardLayouts
-VOID FASTCALL
-IntReorderKeyboardLayouts(
- _Inout_ PWINSTATION_OBJECT pWinSta,
- _Inout_ PKL pNewKL)
-{
- PKL pOldKL = gspklBaseLayout;
-
- if ((pWinSta->Flags & WSS_NOIO) || pNewKL == pOldKL)
- return;
-
- pNewKL->pklPrev->pklNext = pNewKL->pklNext;
- pNewKL->pklNext->pklPrev = pNewKL->pklPrev;
- pNewKL->pklNext = pOldKL;
- pNewKL->pklPrev = pOldKL->pklPrev;
- pOldKL->pklPrev->pklNext = pNewKL;
- pOldKL->pklPrev = pNewKL;
- gspklBaseLayout = pNewKL; /* Should we use UserAssignmentLock? */
-}
-
/* Win: xxxActivateKeyboardLayout */
HKL APIENTRY
co_IntActivateKeyboardLayout(