mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTUSER] Implement NtUserCreateInputContext (#4230)
- Modify NtUserCreateInputContext prototype. - Add UserCreateInputContext helper function. - Implement NtUserCreateInputContext function by using UserCreateInputContext. - Call UserCreateInputContext(0) in InitThreadCallback function to create the default input context. CORE-11700
This commit is contained in:
parent
ba3affe5f7
commit
d5deacd903
5 changed files with 63 additions and 5 deletions
|
@ -597,7 +597,7 @@ HIMC WINAPI ImmCreateContext(void)
|
|||
if (pClientImc == NULL)
|
||||
return NULL;
|
||||
|
||||
hIMC = NtUserCreateInputContext(pClientImc);
|
||||
hIMC = NtUserCreateInputContext((ULONG_PTR)pClientImc);
|
||||
if (hIMC == NULL)
|
||||
{
|
||||
Imm32HeapFree(pClientImc);
|
||||
|
|
|
@ -1937,7 +1937,7 @@ NtUserCreateDesktop(
|
|||
|
||||
HIMC
|
||||
NTAPI
|
||||
NtUserCreateInputContext(PCLIENTIMC pClientImc);
|
||||
NtUserCreateInputContext(ULONG_PTR dwClientImcData);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
|
|
|
@ -651,6 +651,12 @@ InitThreadCallback(PETHREAD Thread)
|
|||
}
|
||||
ptiCurrent->pClientInfo->dwTIFlags = ptiCurrent->TIF_flags;
|
||||
|
||||
/* Create the default input context */
|
||||
if (IS_IMM_MODE())
|
||||
{
|
||||
UserCreateInputContext(0);
|
||||
}
|
||||
|
||||
/* Last things to do only if we are not a SYSTEM or CSRSS thread */
|
||||
if (!(ptiCurrent->TIF_flags & (TIF_SYSTEMTHREAD | TIF_CSRSSTHREAD)))
|
||||
{
|
||||
|
|
|
@ -461,12 +461,63 @@ NtUserYieldTask(VOID)
|
|||
return 0;
|
||||
}
|
||||
|
||||
PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData)
|
||||
{
|
||||
PIMC pIMC;
|
||||
PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
|
||||
PDESKTOP pdesk = pti->rpdesk;
|
||||
|
||||
if (!IS_IMM_MODE() || (pti->TIF_flags & TIF_DISABLEIME)) // Disabled?
|
||||
return NULL;
|
||||
|
||||
if (!pdesk) // No desktop?
|
||||
return NULL;
|
||||
|
||||
// pti->spDefaultImc should be already set if non-first time.
|
||||
if (dwClientImcData && !pti->spDefaultImc)
|
||||
return NULL;
|
||||
|
||||
// Create an input context user object.
|
||||
pIMC = UserCreateObject(gHandleTable, pdesk, pti, NULL, TYPE_INPUTCONTEXT, sizeof(IMC));
|
||||
if (!pIMC)
|
||||
return NULL;
|
||||
|
||||
if (dwClientImcData) // Non-first time.
|
||||
{
|
||||
// Insert pIMC to the second position (non-default) of the list.
|
||||
pIMC->pImcNext = pti->spDefaultImc->pImcNext;
|
||||
pti->spDefaultImc->pImcNext = pIMC;
|
||||
}
|
||||
else // First time. It's the default IMC.
|
||||
{
|
||||
// Add the first one (default) to the list.
|
||||
pti->spDefaultImc = pIMC;
|
||||
pIMC->pImcNext = NULL;
|
||||
}
|
||||
|
||||
pIMC->dwClientImcData = dwClientImcData; // Set it.
|
||||
return pIMC;
|
||||
}
|
||||
|
||||
HIMC
|
||||
APIENTRY
|
||||
NtUserCreateInputContext(PCLIENTIMC pClientImc)
|
||||
NtUserCreateInputContext(ULONG_PTR dwClientImcData)
|
||||
{
|
||||
STUB;
|
||||
return NULL;
|
||||
PIMC pIMC;
|
||||
HIMC ret = NULL;
|
||||
|
||||
UserEnterExclusive();
|
||||
|
||||
if (!IS_IMM_MODE() || !dwClientImcData)
|
||||
goto Quit;
|
||||
|
||||
pIMC = UserCreateInputContext(dwClientImcData);
|
||||
if (pIMC)
|
||||
ret = UserHMGetHandle(pIMC);
|
||||
|
||||
Quit:
|
||||
UserLeave();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD
|
||||
|
|
|
@ -165,6 +165,7 @@ BOOL FASTCALL GetLayeredStatus(PWND pWnd);
|
|||
|
||||
/************** INPUT CONTEXT **************/
|
||||
|
||||
PIMC FASTCALL UserCreateInputContext(ULONG_PTR dwClientImcData);
|
||||
VOID UserFreeInputContext(PVOID Object);
|
||||
BOOLEAN UserDestroyInputContext(PVOID Object);
|
||||
PVOID AllocInputContextObject(PDESKTOP pDesk, PTHREADINFO pti, SIZE_T Size, PVOID* HandleOwner);
|
||||
|
|
Loading…
Reference in a new issue