[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.
This commit is contained in:
Katayama Hirofumi MZ 2024-07-29 19:30:49 +09:00 committed by GitHub
parent 90a5b9a83f
commit 7dd081e945
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 20 additions and 23 deletions

View file

@ -175,6 +175,12 @@ extern "C" {
#define SBRG_PAGEDOWNLEFT 4 /* the page down or page left region */ #define SBRG_PAGEDOWNLEFT 4 /* the page down or page left region */
#define SBRG_BOTTOMLEFTBTN 5 /* the bottom or left button */ #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 UpdatePerUserSystemParameters(DWORD dwReserved, BOOL bEnable);
BOOL WINAPI SetLogonNotifyWindow(HWND Wnd); BOOL WINAPI SetLogonNotifyWindow(HWND Wnd);
BOOL WINAPI KillSystemTimer(HWND,UINT_PTR); BOOL WINAPI KillSystemTimer(HWND,UINT_PTR);

View file

@ -47,9 +47,6 @@ typedef struct _ATTACHINFO
extern PATTACHINFO gpai; extern PATTACHINFO gpai;
/* Keyboard layout undocumented flags */
#define KLF_UNLOAD 0x20000000
/* Key States */ /* Key States */
#define KS_DOWN_BIT 0x80 #define KS_DOWN_BIT 0x80
#define KS_LOCK_BIT 0x01 #define KS_LOCK_BIT 0x01

View file

@ -32,7 +32,6 @@ typedef PVOID (*PFN_KBDLAYERDESCRIPTOR)(VOID);
/* /*
* Retrieves a PKL by an input locale identifier (HKL). * Retrieves a PKL by an input locale identifier (HKL).
* @implemented * @implemented
* Win: HKLtoPKL
*/ */
PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL) PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
{ {
@ -50,7 +49,7 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
do do
{ {
pKL = pKL->pklNext; pKL = pKL->pklNext;
if (!(pKL->dwKL_Flags & KLF_UNLOAD)) if (!(pKL->dwKL_Flags & KL_UNLOAD))
return pKL; return pKL;
} while (pKL != pFirstKL); } while (pKL != pFirstKL);
} }
@ -59,13 +58,13 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
do do
{ {
pKL = pKL->pklPrev; pKL = pKL->pklPrev;
if (!(pKL->dwKL_Flags & KLF_UNLOAD)) if (!(pKL->dwKL_Flags & KL_UNLOAD))
return pKL; return pKL;
} while (pKL != pFirstKL); } while (pKL != pFirstKL);
} }
else if (HIWORD(hKL)) /* hKL is a full input locale identifier */ else if (HIWORD(hKL)) /* hKL is a full input locale identifier */
{ {
/* No KLF_UNLOAD check */ /* No KL_UNLOAD check */
do do
{ {
if (pKL->hkl == hKL) if (pKL->hkl == hKL)
@ -76,7 +75,7 @@ PKL FASTCALL IntHKLtoPKL(_Inout_ PTHREADINFO pti, _In_ HKL hKL)
} }
else /* Language only specified */ else /* Language only specified */
{ {
/* No KLF_UNLOAD check */ /* No KL_UNLOAD check */
do do
{ {
if (LOWORD(pKL->hkl) == LOWORD(hKL)) /* Low word is language ID */ 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. * A helper function for NtUserGetKeyboardLayoutList.
* @implemented * @implemented
* Win: _GetKeyboardLayoutList
*/ */
static UINT APIENTRY static UINT APIENTRY
IntGetKeyboardLayoutList( IntGetKeyboardLayoutList(
@ -114,7 +112,7 @@ IntGetKeyboardLayoutList(
/* Count the effective PKLs */ /* Count the effective PKLs */
do do
{ {
if (!(pKL->dwKL_Flags & KLF_UNLOAD)) if (!(pKL->dwKL_Flags & KL_UNLOAD))
++ret; ++ret;
pKL = pKL->pklNext; pKL = pKL->pklNext;
} while (pKL != pFirstKL); } while (pKL != pFirstKL);
@ -124,7 +122,7 @@ IntGetKeyboardLayoutList(
/* Copy the effective HKLs to pHklBuff */ /* Copy the effective HKLs to pHklBuff */
do do
{ {
if (!(pKL->dwKL_Flags & KLF_UNLOAD)) if (!(pKL->dwKL_Flags & KL_UNLOAD))
{ {
*pHklBuff = pKL->hkl; *pHklBuff = pKL->hkl;
++pHklBuff; ++pHklBuff;
@ -489,7 +487,7 @@ UserUnloadKbl(PKL pKl)
if (pKl->head.cLockObj > 1) if (pKl->head.cLockObj > 1)
{ {
/* Layout is used by other threads */ /* Layout is used by other threads */
pKl->dwKL_Flags |= KLF_UNLOAD; pKl->dwKL_Flags |= KL_UNLOAD;
return FALSE; return FALSE;
} }
@ -521,7 +519,7 @@ W32kGetDefaultKeyLayout(VOID)
/* Return not unloaded layout */ /* Return not unloaded layout */
do do
{ {
if (!(pKl->dwKL_Flags & KLF_UNLOAD)) if (!(pKl->dwKL_Flags & KL_UNLOAD))
return pKl; return pKl;
pKl = pKl->pklPrev; /* Confirmed on Win2k */ pKl = pKl->pklPrev; /* Confirmed on Win2k */
@ -556,7 +554,6 @@ UserHklToKbl(HKL hKl)
return NULL; return NULL;
} }
// Win: ReorderKeyboardLayouts
VOID FASTCALL VOID FASTCALL
IntReorderKeyboardLayouts( IntReorderKeyboardLayouts(
_Inout_ PWINSTATION_OBJECT pWinSta, _Inout_ PWINSTATION_OBJECT pWinSta,
@ -813,7 +810,6 @@ co_UserActivateKeyboardLayout(
return hOldKL; return hOldKL;
} }
/* Win: xxxActivateKeyboardLayout */
HKL APIENTRY HKL APIENTRY
co_IntActivateKeyboardLayout( co_IntActivateKeyboardLayout(
_Inout_ PWINSTATION_OBJECT pWinSta, _Inout_ PWINSTATION_OBJECT pWinSta,
@ -837,7 +833,6 @@ co_IntActivateKeyboardLayout(
return co_UserActivateKeyboardLayout(pKL, uFlags, pWnd); return co_UserActivateKeyboardLayout(pKL, uFlags, pWnd);
} }
// Win: xxxInternalUnloadKeyboardLayout
static BOOL APIENTRY static BOOL APIENTRY
co_IntUnloadKeyboardLayoutEx( co_IntUnloadKeyboardLayoutEx(
_Inout_ PWINSTATION_OBJECT pWinSta, _Inout_ PWINSTATION_OBJECT pWinSta,
@ -848,16 +843,16 @@ co_IntUnloadKeyboardLayoutEx(
USER_REFERENCE_ENTRY Ref1, Ref2; USER_REFERENCE_ENTRY Ref1, Ref2;
PTHREADINFO pti = gptiCurrent; PTHREADINFO pti = gptiCurrent;
if (pKL == gspklBaseLayout && !(dwFlags & 0x80000000)) if (pKL == gspklBaseLayout && !(dwFlags & UKL_NOACTIVATENEXT))
return FALSE; return FALSE;
UserRefObjectCo(pKL, &Ref1); /* Add reference */ UserRefObjectCo(pKL, &Ref1); /* Add reference */
/* Regard as unloaded */ /* Regard as unloaded */
UserMarkObjectDestroy(pKL); 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)); pNextKL = IntHKLtoPKL(pti, UlongToHandle(HKL_NEXT));
if (pNextKL) if (pNextKL)
@ -885,7 +880,6 @@ co_IntUnloadKeyboardLayoutEx(
return TRUE; return TRUE;
} }
// Win: xxxUnloadKeyboardLayout
static BOOL APIENTRY static BOOL APIENTRY
IntUnloadKeyboardLayout(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ HKL hKL) IntUnloadKeyboardLayout(_Inout_ PWINSTATION_OBJECT pWinSta, _In_ HKL hKL)
{ {
@ -957,7 +951,7 @@ co_IntLoadKeyboardLayoutEx(
{ {
/* Find last not unloaded layout */ /* Find last not unloaded layout */
PKL pLastKL = gspklBaseLayout->pklPrev; PKL pLastKL = gspklBaseLayout->pklPrev;
while (pLastKL != gspklBaseLayout && (pLastKL->dwKL_Flags & KLF_UNLOAD)) while (pLastKL != gspklBaseLayout && (pLastKL->dwKL_Flags & KL_UNLOAD))
pLastKL = pLastKL->pklPrev; pLastKL = pLastKL->pklPrev;
/* Add new layout to the list */ /* Add new layout to the list */
@ -978,7 +972,7 @@ co_IntLoadKeyboardLayoutEx(
} }
/* If this layout was prepared to unload, undo it */ /* If this layout was prepared to unload, undo it */
pNewKL->dwKL_Flags &= ~KLF_UNLOAD; pNewKL->dwKL_Flags &= ~KL_UNLOAD;
/* Reorder if necessary */ /* Reorder if necessary */
if (Flags & KLF_REORDER) if (Flags & KLF_REORDER)

View file

@ -807,7 +807,7 @@ IntGetNextKL(
{ {
pKL = (bNext ? pKL->pklNext : pKL->pklPrev); 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; return pKL;
} while (pKL != pFirstKL); } while (pKL != pFirstKL);