From: Rémi Bernon <rbernon(a)codeweavers.com> --- dlls/win32u/window.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 673d375321e..174e48a67cc 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -411,7 +411,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; @@ -481,6 +481,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) + { + if (new_toplevel) update_window_state( new_toplevel ); + if (old_toplevel) update_window_state( old_toplevel ); + } + winpos.hwnd = hwnd; winpos.hwndInsertAfter = HWND_TOP; winpos.x = window_rect.left; @@ -4999,7 +5007,7 @@ LRESULT destroy_window( HWND hwnd ) struct window_surface *surface; HMENU menu = 0, sys_menu; WND *win; - HWND *children; + HWND *children, toplevel = NtUserGetAncestor( hwnd, GA_ROOT ); TRACE( "%p\n", hwnd ); @@ -5031,6 +5039,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 */ @@ -5412,7 +5422,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; @@ -5703,6 +5713,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: -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8410