[NTUSER] Half-implement NtUserSetImeOwnerWindow (#4332)

- Add some code to NtUserSetImeOwnerWindow function.
- Add IntGetTopLevelWindow helper function.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-02-03 13:39:15 +09:00 committed by GitHub
parent 8bd980e483
commit 0519ae0ac5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,6 +12,21 @@ DBG_DEFAULT_CHANNEL(UserMisc);
#define INVALID_THREAD_ID ((ULONG)-1)
#define IS_WND_IMELIKE(pwnd) \
(((pwnd)->pcls->style & CS_IME) || \
((pwnd)->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME]))
PWND FASTCALL IntGetTopLevelWindow(PWND pwnd)
{
if (!pwnd)
return NULL;
while (pwnd->style & WS_CHILD)
pwnd = pwnd->spwndParent;
return pwnd;
}
DWORD
APIENTRY
NtUserSetThreadLayoutHandles(HKL hNewKL, HKL hOldKL)
@ -472,8 +487,61 @@ Quit:
BOOL APIENTRY
NtUserSetImeOwnerWindow(HWND hImeWnd, HWND hwndFocus)
{
STUB
return 0;
BOOL ret = FALSE;
PWND pImeWnd, pwndFocus, pwndTopLevel, pwnd, pwndActive;
PTHREADINFO ptiIme;
UserEnterExclusive();
pImeWnd = ValidateHwndNoErr(hImeWnd);
if (!IS_IMM_MODE() || !pImeWnd || pImeWnd->fnid != FNID_IME)
goto Quit;
pwndFocus = ValidateHwndNoErr(hwndFocus);
if (pwndFocus)
{
if (IS_WND_IMELIKE(pwndFocus))
goto Quit;
pwndTopLevel = IntGetTopLevelWindow(pwndFocus);
for (pwnd = pwndTopLevel; pwnd; pwnd = pwnd->spwndOwner)
{
if (pwnd->pcls->atomClassName == gpsi->atomSysClass[ICLS_IME])
{
pwndTopLevel = NULL;
break;
}
}
pImeWnd->spwndOwner = pwndTopLevel;
// TODO:
}
else
{
ptiIme = pImeWnd->head.pti;
pwndActive = ptiIme->MessageQueue->spwndActive;
if (!pwndActive || pwndActive != pImeWnd->spwndOwner)
{
if (pwndActive && ptiIme == pwndActive->head.pti && !IS_WND_IMELIKE(pwndActive))
{
pImeWnd->spwndOwner = pwndActive;
}
else
{
// TODO:
}
// TODO:
}
}
ret = TRUE;
Quit:
UserLeave();
return ret;
}
PVOID