mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[NTUSER][USER32] KLF_SETFORPROCESS for ActivateKeyboardLayout (#5126)
Supporting KLF_SETFORPROCESS flag in ActivateKeyboardLayout function. Implement KLF_SETFORPROCESS for co_UserActivateKeyboardLayout. Use KLF_SETFORPROCESS flag in WM_INPUTLANGCHANGEREQUEST handling. Add co_IntSetKeyboardLayoutForProcess helper function.
This commit is contained in:
parent
ab92e40317
commit
b9ef348ab0
2 changed files with 49 additions and 9 deletions
|
@ -630,7 +630,6 @@ co_UserActivateKbl(PTHREADINFO pti, PKL pKl, UINT Flags)
|
||||||
return pklPrev;
|
return pklPrev;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Win: xxxImmActivateLayout
|
|
||||||
VOID APIENTRY
|
VOID APIENTRY
|
||||||
IntImmActivateLayout(
|
IntImmActivateLayout(
|
||||||
_Inout_ PTHREADINFO pti,
|
_Inout_ PTHREADINFO pti,
|
||||||
|
@ -656,7 +655,40 @@ IntImmActivateLayout(
|
||||||
pti->pClientInfo->hKL = pKL->hkl;
|
pti->pClientInfo->hKL = pKL->hkl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Win: xxxInternalActivateKeyboardLayout */
|
static VOID co_IntSetKeyboardLayoutForProcess(PPROCESSINFO ppi, PKL pKL)
|
||||||
|
{
|
||||||
|
PTHREADINFO ptiNode, ptiNext;
|
||||||
|
PCLIENTINFO pClientInfo;
|
||||||
|
BOOL bImmMode = IS_IMM_MODE();
|
||||||
|
|
||||||
|
for (ptiNode = ppi->ptiList; ptiNode; ptiNode = ptiNext)
|
||||||
|
{
|
||||||
|
IntReferenceThreadInfo(ptiNode);
|
||||||
|
ptiNext = ptiNode->ptiSibling;
|
||||||
|
|
||||||
|
/* Skip this thread if its keyboard layout is already the correct one, or if it's dying */
|
||||||
|
if (ptiNode->KeyboardLayout == pKL || (ptiNode->TIF_flags & TIF_INCLEANUP))
|
||||||
|
{
|
||||||
|
IntDereferenceThreadInfo(ptiNode);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bImmMode)
|
||||||
|
{
|
||||||
|
IntImmActivateLayout(ptiNode, pKL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserAssignmentLock((PVOID*)&ptiNode->KeyboardLayout, pKL);
|
||||||
|
pClientInfo = ptiNode->pClientInfo;
|
||||||
|
pClientInfo->CodePage = pKL->CodePage;
|
||||||
|
pClientInfo->hKL = pKL->hkl;
|
||||||
|
}
|
||||||
|
|
||||||
|
IntDereferenceThreadInfo(ptiNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HKL APIENTRY
|
HKL APIENTRY
|
||||||
co_UserActivateKeyboardLayout(
|
co_UserActivateKeyboardLayout(
|
||||||
_Inout_ PKL pKL,
|
_Inout_ PKL pKL,
|
||||||
|
@ -669,7 +701,11 @@ co_UserActivateKeyboardLayout(
|
||||||
PWND pTargetWnd, pImeWnd;
|
PWND pTargetWnd, pImeWnd;
|
||||||
HWND hTargetWnd, hImeWnd;
|
HWND hTargetWnd, hImeWnd;
|
||||||
USER_REFERENCE_ENTRY Ref1, Ref2;
|
USER_REFERENCE_ENTRY Ref1, Ref2;
|
||||||
PCLIENTINFO ClientInfo = pti->pClientInfo;
|
PCLIENTINFO ClientInfo;
|
||||||
|
BOOL bSetForProcess = !!(uFlags & KLF_SETFORPROCESS);
|
||||||
|
|
||||||
|
IntReferenceThreadInfo(pti);
|
||||||
|
ClientInfo = pti->pClientInfo;
|
||||||
|
|
||||||
if (pti->KeyboardLayout)
|
if (pti->KeyboardLayout)
|
||||||
{
|
{
|
||||||
|
@ -683,8 +719,11 @@ co_UserActivateKeyboardLayout(
|
||||||
FIXME("KLF_RESET\n");
|
FIXME("KLF_RESET\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(uFlags & KLF_SETFORPROCESS) && pKL == pti->KeyboardLayout)
|
if (!bSetForProcess && pKL == pti->KeyboardLayout)
|
||||||
|
{
|
||||||
|
IntDereferenceThreadInfo(pti);
|
||||||
return hOldKL;
|
return hOldKL;
|
||||||
|
}
|
||||||
|
|
||||||
pKL->wchDiacritic = 0;
|
pKL->wchDiacritic = 0;
|
||||||
|
|
||||||
|
@ -697,9 +736,9 @@ co_UserActivateKeyboardLayout(
|
||||||
ClientInfo->CodePage = pKL->CodePage;
|
ClientInfo->CodePage = pKL->CodePage;
|
||||||
ClientInfo->hKL = pKL->hkl;
|
ClientInfo->hKL = pKL->hkl;
|
||||||
}
|
}
|
||||||
else if (uFlags & KLF_SETFORPROCESS)
|
else if (bSetForProcess)
|
||||||
{
|
{
|
||||||
FIXME("KLF_SETFORPROCESS\n");
|
co_IntSetKeyboardLayoutForProcess(pti->ppi, pKL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -748,9 +787,8 @@ co_UserActivateKeyboardLayout(
|
||||||
if (pImeWnd)
|
if (pImeWnd)
|
||||||
{
|
{
|
||||||
UserRefObjectCo(pImeWnd, &Ref2);
|
UserRefObjectCo(pImeWnd, &Ref2);
|
||||||
BOOL bProcess = !!(pti->TIF_flags & KLF_SETFORPROCESS);
|
|
||||||
hImeWnd = UserHMGetHandle(pImeWnd);
|
hImeWnd = UserHMGetHandle(pImeWnd);
|
||||||
co_IntSendMessage(hImeWnd, WM_IME_SYSTEM, IMS_SENDNOTIFICATION, bProcess);
|
co_IntSendMessage(hImeWnd, WM_IME_SYSTEM, IMS_SENDNOTIFICATION, bSetForProcess);
|
||||||
UserDerefObjectCo(pImeWnd);
|
UserDerefObjectCo(pImeWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,6 +796,8 @@ co_UserActivateKeyboardLayout(
|
||||||
|
|
||||||
if (pOldKL)
|
if (pOldKL)
|
||||||
UserDerefObjectCo(pOldKL);
|
UserDerefObjectCo(pOldKL);
|
||||||
|
|
||||||
|
IntDereferenceThreadInfo(pti);
|
||||||
return hOldKL;
|
return hOldKL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -561,7 +561,7 @@ User32DefWindowProc(HWND hWnd,
|
||||||
else if(wParam & INPUTLANGCHANGE_FORWARD) NewHkl = (HKL) HKL_NEXT;
|
else if(wParam & INPUTLANGCHANGE_FORWARD) NewHkl = (HKL) HKL_NEXT;
|
||||||
else NewHkl = (HKL) lParam;
|
else NewHkl = (HKL) lParam;
|
||||||
|
|
||||||
NtUserActivateKeyboardLayout(NewHkl, 0);
|
NtUserActivateKeyboardLayout(NewHkl, KLF_SETFORPROCESS);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue