https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7dd081e945a1d3756666c2e4c32b32ac74fe7b03

commit 7dd081e945a1d3756666c2e4c32b32ac74fe7b03
Author:     Katayama Hirofumi MZ <katayama.hirofumi...@gmail.com>
AuthorDate: Mon Jul 29 19:30:49 2024 +0900
Commit:     GitHub <nore...@github.com>
CommitDate: Mon Jul 29 19:30:49 2024 +0900

    [SDK][NTUSER] s/KLF_UNLOAD/KL_UNLOAD/ (#7196)
    
    JIRA issue: CORE-19268
    - Rename KLF_UNLOAD as KL_UNLOAD.
    - Move it from win32ss/user/ntuser/input.h
      to sdk/include/reactos/undocuser.h.
    - Add UKL_NOACTIVATENEXT constant
      and use it.
---
 sdk/include/reactos/undocuser.h |  6 ++++++
 win32ss/user/ntuser/input.h     |  3 ---
 win32ss/user/ntuser/kbdlayout.c | 32 +++++++++++++-------------------
 win32ss/user/ntuser/keyboard.c  |  2 +-
 4 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/sdk/include/reactos/undocuser.h b/sdk/include/reactos/undocuser.h
index b2bc7a8ccc9..ab289d056b9 100644
--- a/sdk/include/reactos/undocuser.h
+++ b/sdk/include/reactos/undocuser.h
@@ -175,6 +175,12 @@ extern "C" {
 #define SBRG_PAGEDOWNLEFT  4 /* the page down or page left region */
 #define SBRG_BOTTOMLEFTBTN 5 /* the bottom or left button */
 
+// Keyboard Layout undocumented flags
+#define KL_UNLOAD 0x20000000
+
+// co_IntUnloadKeyboardLayoutEx undocumented flags
+#define UKL_NOACTIVATENEXT 0x80000000
+
 BOOL WINAPI UpdatePerUserSystemParameters(DWORD dwReserved, BOOL bEnable);
 BOOL WINAPI SetLogonNotifyWindow(HWND Wnd);
 BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);
diff --git a/win32ss/user/ntuser/input.h b/win32ss/user/ntuser/input.h
index 35105947d68..fdf8c13cc5f 100644
--- a/win32ss/user/ntuser/input.h
+++ b/win32ss/user/ntuser/input.h
@@ -47,9 +47,6 @@ typedef struct _ATTACHINFO
 
 extern PATTACHINFO gpai;
 
-/* Keyboard layout undocumented flags */
-#define KLF_UNLOAD 0x20000000
-
 /* Key States */
 #define KS_DOWN_BIT      0x80
 #define KS_LOCK_BIT      0x01
diff --git a/win32ss/user/ntuser/kbdlayout.c b/win32ss/user/ntuser/kbdlayout.c
index 31c016d3e97..d72b561a38b 100644
--- a/win32ss/user/ntuser/kbdlayout.c
+++ b/win32ss/user/ntuser/kbdlayout.c
@@ -32,7 +32,6 @@ typedef PVOID (*PFN_KBDLAYERDESCRIPTOR)(VOID);
 /*
  * Retrieves a PKL by an input locale identifier (HKL).
  * @implemented
- * Win: HKLtoPKL
  */
 PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
 {
@@ -50,7 +49,7 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL 
hKL)
         do
         {
             pKL = pKL->pklNext;
-            if (!(pKL->dwKL_Flags & KLF_UNLOAD))
+            if (!(pKL->dwKL_Flags & KL_UNLOAD))
                 return pKL;
         } while (pKL != pFirstKL);
     }
@@ -59,13 +58,13 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL 
hKL)
         do
         {
             pKL = pKL->pklPrev;
-            if (!(pKL->dwKL_Flags & KLF_UNLOAD))
+            if (!(pKL->dwKL_Flags & KL_UNLOAD))
                 return pKL;
         } while (pKL != pFirstKL);
     }
     else if (HIWORD(hKL)) /* hKL is a full input locale identifier */
     {
-        /* No KLF_UNLOAD check */
+        /* No KL_UNLOAD check */
         do
         {
             if (pKL->hkl == hKL)
@@ -76,7 +75,7 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL 
hKL)
     }
     else  /* Language only specified */
     {
-        /* No KLF_UNLOAD check */
+        /* No KL_UNLOAD check */
         do
         {
             if (LOWORD(pKL->hkl) == LOWORD(hKL)) /* Low word is language ID */
@@ -92,7 +91,6 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL 
hKL)
 /*
  * A helper function for NtUserGetKeyboardLayoutList.
  * @implemented
- * Win: _GetKeyboardLayoutList
  */
 static UINT APIENTRY
 IntGetKeyboardLayoutList(
@@ -114,7 +112,7 @@ IntGetKeyboardLayoutList(
         /* Count the effective PKLs */
         do
         {
-            if (!(pKL->dwKL_Flags & KLF_UNLOAD))
+            if (!(pKL->dwKL_Flags & KL_UNLOAD))
                 ++ret;
             pKL = pKL->pklNext;
         } while (pKL != pFirstKL);
@@ -124,7 +122,7 @@ IntGetKeyboardLayoutList(
         /* Copy the effective HKLs to pHklBuff */
         do
         {
-            if (!(pKL->dwKL_Flags & KLF_UNLOAD))
+            if (!(pKL->dwKL_Flags & KL_UNLOAD))
             {
                 *pHklBuff = pKL->hkl;
                 ++pHklBuff;
@@ -489,7 +487,7 @@ UserUnloadKbl(PKL pKl)
     if (pKl->head.cLockObj > 1)
     {
         /* Layout is used by other threads */
-        pKl->dwKL_Flags |= KLF_UNLOAD;
+        pKl->dwKL_Flags |= KL_UNLOAD;
         return FALSE;
     }
 
@@ -521,7 +519,7 @@ W32kGetDefaultKeyLayout(VOID)
     /* Return not unloaded layout */
     do
     {
-        if (!(pKl->dwKL_Flags & KLF_UNLOAD))
+        if (!(pKl->dwKL_Flags & KL_UNLOAD))
             return pKl;
 
         pKl = pKl->pklPrev; /* Confirmed on Win2k */
@@ -556,7 +554,6 @@ UserHklToKbl(HKL hKl)
     return NULL;
 }
 
-// Win: ReorderKeyboardLayouts
 VOID FASTCALL
 IntReorderKeyboardLayouts(
     _Inout_ PWINSTATION_OBJECT pWinSta,
@@ -813,7 +810,6 @@ co_UserActivateKeyboardLayout(
     return hOldKL;
 }
 
-/* Win: xxxActivateKeyboardLayout */
 HKL APIENTRY
 co_IntActivateKeyboardLayout(
     _Inout_ PWINSTATION_OBJECT pWinSta,
@@ -837,7 +833,6 @@ co_IntActivateKeyboardLayout(
     return co_UserActivateKeyboardLayout(pKL, uFlags, pWnd);
 }
 
-// Win: xxxInternalUnloadKeyboardLayout
 static BOOL APIENTRY
 co_IntUnloadKeyboardLayoutEx(
     _Inout_ PWINSTATION_OBJECT pWinSta,
@@ -848,16 +843,16 @@ co_IntUnloadKeyboardLayoutEx(
     USER_REFERENCE_ENTRY Ref1, Ref2;
     PTHREADINFO pti = gptiCurrent;
 
-    if (pKL == gspklBaseLayout && !(dwFlags & 0x80000000))
+    if (pKL == gspklBaseLayout && !(dwFlags & UKL_NOACTIVATENEXT))
         return FALSE;
 
     UserRefObjectCo(pKL, &Ref1); /* Add reference */
 
     /* Regard as unloaded */
     UserMarkObjectDestroy(pKL);
-    pKL->dwKL_Flags |= KLF_UNLOAD;
+    pKL->dwKL_Flags |= KL_UNLOAD;
 
-    if (!(dwFlags & 0x80000000) && pti->KeyboardLayout == pKL)
+    if (!(dwFlags & UKL_NOACTIVATENEXT) && pti->KeyboardLayout == pKL)
     {
         pNextKL = IntHKLtoPKL(pti, UlongToHandle(HKL_NEXT));
         if (pNextKL)
@@ -885,7 +880,6 @@ co_IntUnloadKeyboardLayoutEx(
     return TRUE;
 }
 
-// Win: xxxUnloadKeyboardLayout
 static BOOL APIENTRY
 IntUnloadKeyboardLayout(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ HKL hKL)
 {
@@ -957,7 +951,7 @@ co_IntLoadKeyboardLayoutEx(
         {
             /* Find last not unloaded layout */
             PKL pLastKL = gspklBaseLayout->pklPrev;
-            while (pLastKL != gspklBaseLayout && (pLastKL->dwKL_Flags & 
KLF_UNLOAD))
+            while (pLastKL != gspklBaseLayout && (pLastKL->dwKL_Flags & 
KL_UNLOAD))
                 pLastKL = pLastKL->pklPrev;
 
             /* Add new layout to the list */
@@ -978,7 +972,7 @@ co_IntLoadKeyboardLayoutEx(
     }
 
     /* If this layout was prepared to unload, undo it */
-    pNewKL->dwKL_Flags &= ~KLF_UNLOAD;
+    pNewKL->dwKL_Flags &= ~KL_UNLOAD;
 
     /* Reorder if necessary */
     if (Flags & KLF_REORDER)
diff --git a/win32ss/user/ntuser/keyboard.c b/win32ss/user/ntuser/keyboard.c
index 3d8bed1ad25..3e187da36e4 100644
--- a/win32ss/user/ntuser/keyboard.c
+++ b/win32ss/user/ntuser/keyboard.c
@@ -807,7 +807,7 @@ IntGetNextKL(
     {
         pKL = (bNext ? pKL->pklNext : pKL->pklPrev);
 
-        if (!(pKL->dwKL_Flags & KLF_UNLOAD) && bSameLang == (LangID == 
LOWORD(pKL->hkl)))
+        if (!(pKL->dwKL_Flags & KL_UNLOAD) && bSameLang == (LangID == 
LOWORD(pKL->hkl)))
             return pKL;
     } while (pKL != pFirstKL);
 

Reply via email to