From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/window.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 203f44f0bb7..9d305a8d9be 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -392,7 +392,7 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent ) RECT window_rect = {0}, old_screen_rect = {0}, new_screen_rect = {0}; UINT context; WINDOWPOS winpos; - HWND full_handle; + HWND full_handle, new_toplevel, old_toplevel; HWND old_parent = 0; BOOL was_visible; WND *win; @@ -463,6 +463,14 @@ HWND WINAPI NtUserSetParent( HWND hwnd, HWND parent )
user_driver->pSetParent( full_handle, parent, old_parent );
+ new_toplevel = NtUserGetAncestor( parent, GA_ROOT ); + old_toplevel = NtUserGetAncestor( old_parent, GA_ROOT ); + if (new_toplevel != old_toplevel) + { + update_window_state( new_toplevel ); + update_window_state( old_toplevel ); + } + winpos.hwnd = hwnd; winpos.hwndInsertAfter = HWND_TOP; winpos.x = window_rect.left; @@ -5088,10 +5096,12 @@ LRESULT destroy_window( HWND hwnd ) struct window_surface *surface; HMENU menu = 0, sys_menu; WND *win; - HWND *children; + HWND toplevel, *children;
TRACE( "%p\n", hwnd );
+ toplevel = NtUserGetAncestor( hwnd, GA_ROOT ); + unregister_imm_window( hwnd );
/* free child windows */ @@ -5120,6 +5130,8 @@ LRESULT destroy_window( HWND hwnd )
send_message( hwnd, WM_NCDESTROY, 0, 0 );
+ if (toplevel && toplevel != hwnd) update_window_state( toplevel ); + /* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
/* free resources associated with the window */ @@ -5473,7 +5485,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, struct window_surface *surface; struct window_rects new_rects; CBT_CREATEWNDW cbtc; - HWND hwnd, owner = 0; + HWND hwnd, toplevel, owner = 0; CREATESTRUCTW cs; INT sw = SW_SHOW; RECT surface_rect; @@ -5767,6 +5779,10 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name,
TRACE( "created window %p\n", hwnd ); set_thread_dpi_awareness_context( context ); + + toplevel = NtUserGetAncestor( hwnd, GA_ROOT ); + if (toplevel && toplevel != hwnd) update_window_state( toplevel ); + return hwnd;
failed: