mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[NTUSER] Half-implement NtUserSetImeOwnerWindow (#4332)
- Add some code to NtUserSetImeOwnerWindow function. - Add IntGetTopLevelWindow helper function. CORE-11700
This commit is contained in:
parent
8bd980e483
commit
0519ae0ac5
1 changed files with 70 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue