https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0fee1fc80c07b0ea42d6f…
commit 0fee1fc80c07b0ea42d6fc28077c5081fde727d8
Author: Thamatip Chitpong <tangaming123456(a)outlook.com>
AuthorDate: Wed Feb 15 03:57:41 2023 +0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Tue Feb 14 21:57:41 2023 +0100
[NTUSER] IntWinListOwnedPopups: Exclude default IME window from the list (#5069)
And in IntShowOwnedPopups: Remove the window owner check hack as it's no longer
needed.
Based on my observation, the owner of the default IME window can change and it depends
on
the window that is being focused.
CORE-18659
CORE-18768
---
win32ss/user/ntuser/window.c | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index d1b650bf4c2..cfccf36ec4a 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -314,6 +314,15 @@ IntWinListChildren(PWND Window)
return List;
}
+static BOOL
+IntWndIsDefaultIme(_In_ PWND Window)
+{
+ PTHREADINFO pti = Window->head.pti;
+
+ return (IS_IMM_MODE() && !(pti->TIF_flags & TIF_INCLEANUP) &&
+ Window == pti->spwndDefaultIme);
+}
+
HWND* FASTCALL
IntWinListOwnedPopups(PWND Window)
{
@@ -327,7 +336,7 @@ IntWinListOwnedPopups(PWND Window)
for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
{
- if (Child->spwndOwner == Window)
+ if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
++NumOwned;
}
@@ -342,7 +351,7 @@ IntWinListOwnedPopups(PWND Window)
Index = 0;
for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
{
- if (Child->spwndOwner == Window)
+ if (Child->spwndOwner == Window && !IntWndIsDefaultIme(Child))
List[Index++] = Child->head.h;
}
List[Index] = NULL;
@@ -2807,7 +2816,6 @@ VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
HWND* List;
HWND* phWnd;
PWND pWnd;
- PTHREADINFO pti = Window->head.pti;
USER_REFERENCE_ENTRY Ref;
List = IntWinListOwnedPopups(Window);
@@ -2822,12 +2830,6 @@ VOID FASTCALL IntDestroyOwnedWindows(PWND Window)
ASSERT(pWnd->spwndOwner == Window);
ASSERT(pWnd != Window);
- if (IS_IMM_MODE() && !(pti->TIF_flags & TIF_INCLEANUP) &&
- pWnd == pti->spwndDefaultIme)
- {
- continue;
- }
-
WndSetOwner(pWnd, NULL);
if (IntWndBelongsToThread(pWnd, PsGetCurrentThreadWin32Thread()))
{
@@ -4679,8 +4681,7 @@ IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow )
{
if (!(pWnd = ValidateHwndNoErr( win_array[count] )))
continue;
- if (pWnd->spwndOwner != OwnerWnd)
- continue;
+ ASSERT(pWnd->spwndOwner == OwnerWnd);
if (fShow)
{