-- v2: win32u: Implement EVENT_OBJECT_DESTROY.
From: Esme Povirk esme@codeweavers.com
--- dlls/user32/tests/msg.c | 26 +++++++++++++------------- dlls/win32u/window.c | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 398bb0a69ed..f7990270418 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -725,7 +725,7 @@ static const struct message WmDestroyOverlappedSeq[] = { { WM_KILLFOCUS, sent|optional|wparam, 0 }, { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -1644,7 +1644,7 @@ static const struct message WmDestroyChildSeq[] = { { WM_IME_SETCONTEXT, sent|wparam|parent|optional, 1 }, { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, { WM_SETFOCUS, sent|parent }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_DESTROY, sent|optional }, /* some other (IME?) window */ { WM_NCDESTROY, sent|optional }, /* some other (IME?) window */ @@ -1664,7 +1664,7 @@ static const struct message WmDestroyInvisibleChildSeq[] = { { 0x0090, sent|optional }, { WM_PARENTNOTIFY, sent|parent|wparam, WM_DESTROY }, { WM_SHOWWINDOW, sent|wparam, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -3017,7 +3017,7 @@ static const struct message WmDestroyMDIframeSeq[] = { { WM_ACTIVATE, sent|wparam|optional, 0 }, /* Win9x */ { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Win9x */ { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam|msg_todo, OBJID_CARET, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -3066,7 +3066,7 @@ static const struct message WmDestroyMDIclientSeq[] = { { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE }, { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_HIDEWINDOW|SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -3268,7 +3268,7 @@ static const struct message WmDestroyMDIchildInvisibleSeq[] = { */ { 0x0090, sent|optional }, { WM_PARENTNOTIFY, sent /*|wparam, WM_DESTROY*/ }, /* in MDI client */ - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -12806,7 +12806,7 @@ static const struct message destroy_window_with_children[] = { { WM_DESTROY, sent|wparam|lparam, 0, WND_POPUP_ID }, /* popup */ { WM_CAPTURECHANGED, sent|wparam|lparam, 0, WND_POPUP_ID }, /* popup */ { WM_NCDESTROY, sent|wparam|lparam, 0, WND_POPUP_ID }, /* popup */ - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, /* parent */ + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, /* parent */ { WM_DESTROY, sent|wparam|lparam, 0, WND_PARENT_ID }, /* parent */ { WM_DESTROY, sent|wparam|lparam, 0, WND_CHILD_ID + 2 }, /* child2 */ { WM_DESTROY, sent|wparam|lparam, 0, WND_CHILD_ID + 1 }, /* child1 */ @@ -14493,7 +14493,7 @@ static const struct message WmQuitDialogSeq[] = { { EVENT_SYSTEM_DIALOGEND, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, { HCBT_DESTROYWND, hook }, { 0x0090, sent|optional }, /* Vista */ - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_DESTROY, sent }, { WM_NCDESTROY, sent }, { 0 } @@ -17245,7 +17245,7 @@ static const struct message wm_popup_menu_1[] = { EVENT_SYSTEM_MENUPOPUPEND, winevent_hook|wparam|lparam|msg_todo, OBJID_CLIENT, 0 }, { HCBT_DESTROYWND, hook|optional }, /* Win9x doesn't create a window */ { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, { WM_MENUSELECT, sent|wparam|lparam, MAKEWPARAM(0,0xffff), 0 }, { WM_EXITMENULOOP, sent|wparam|lparam, 0, 0 }, @@ -17295,12 +17295,12 @@ static const struct message wm_popup_menu_2[] = { EVENT_SYSTEM_MENUPOPUPEND, winevent_hook|wparam|lparam|msg_todo, OBJID_CLIENT, 0 }, { HCBT_DESTROYWND, hook }, { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, { EVENT_SYSTEM_MENUPOPUPEND, winevent_hook|wparam|lparam|msg_todo, OBJID_CLIENT, 0 }, { HCBT_DESTROYWND, hook|optional }, /* Win9x doesn't send it */ { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, { WM_MENUSELECT, sent|wparam|lparam, MAKEWPARAM(0,0xffff), 0 }, { WM_EXITMENULOOP, sent|wparam|lparam, 0, 0 }, @@ -17350,12 +17350,12 @@ static const struct message wm_popup_menu_3[] = { EVENT_SYSTEM_MENUPOPUPEND, winevent_hook|wparam|lparam|msg_todo, OBJID_CLIENT, 0 }, { HCBT_DESTROYWND, hook }, { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, { EVENT_SYSTEM_MENUPOPUPEND, winevent_hook|wparam|lparam|msg_todo, OBJID_CLIENT, 0 }, { HCBT_DESTROYWND, hook|optional }, /* Win9x doesn't send it */ { EVENT_OBJECT_HIDE, winevent_hook|wparam|lparam, 0, 0 }, - { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam|msg_todo, 0, 0 }, + { EVENT_OBJECT_DESTROY, winevent_hook|wparam|lparam, 0, 0 }, { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, { WM_MENUSELECT, sent|wparam|lparam, MAKEWPARAM(0,0xffff), 0 }, { WM_EXITMENULOOP, sent|wparam|lparam, 0, 0 }, diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index caa3b3aa323..3a70cca2e55 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -4658,7 +4658,7 @@ HICON WINAPI NtUserInternalGetWindowIcon( HWND hwnd, UINT type ) /*********************************************************************** * send_destroy_message */ -static void send_destroy_message( HWND hwnd ) +static void send_destroy_message( HWND hwnd, BOOL recursive ) { GUITHREADINFO info;
@@ -4671,6 +4671,9 @@ static void send_destroy_message( HWND hwnd )
if (hwnd == NtUserGetClipboardOwner()) release_clipboard_owner( hwnd );
+ if (!recursive) + NtUserNotifyWinEvent( EVENT_OBJECT_DESTROY, hwnd, OBJID_WINDOW, 0 ); + send_message( hwnd, WM_DESTROY, 0, 0);
/* @@ -4686,7 +4689,7 @@ static void send_destroy_message( HWND hwnd )
for (i = 0; children[i]; i++) { - if (is_window( children[i] )) send_destroy_message( children[i] ); + if (is_window( children[i] )) send_destroy_message( children[i], TRUE ); } free( children ); } @@ -4796,7 +4799,7 @@ LRESULT destroy_window( HWND hwnd ) /*********************************************************************** * NtUserDestroyWindow (win32u.@) */ -BOOL WINAPI NtUserDestroyWindow( HWND hwnd ) +static BOOL user_destroy_window( HWND hwnd, BOOL recursive ) { BOOL is_child;
@@ -4856,7 +4859,7 @@ BOOL WINAPI NtUserDestroyWindow( HWND hwnd ) if (get_window_relative( children[i], GW_OWNER ) != hwnd) continue; if (is_current_thread_window( children[i] )) { - NtUserDestroyWindow( children[i] ); + user_destroy_window( children[i], TRUE ); got_one = TRUE; continue; } @@ -4867,13 +4870,18 @@ BOOL WINAPI NtUserDestroyWindow( HWND hwnd ) } }
- send_destroy_message( hwnd ); + send_destroy_message( hwnd, recursive ); if (!is_window( hwnd )) return TRUE;
destroy_window( hwnd ); return TRUE; }
+BOOL WINAPI NtUserDestroyWindow( HWND hwnd ) +{ + return user_destroy_window( hwnd, FALSE ); +} + /***************************************************************************** * destroy_thread_windows *
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=146383
Your paranoid android.
=== debian11 (32 bit de report) ===
user32: msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got hook 0x0005 instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got winevent_hook 0x0003 instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x030f instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x001c instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x0086 instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got msg 0x0006 instead msg.c:6935: Test failed: SetFocus(hwnd) on a button: 3: the winevent_hook 0x8005 was expected, but got hook 0x0009 instead
Wouldn't it be more intuitive the parameter 'recursive' rename as 'notify' and invert its meaning?
On Tue Jun 18 20:44:22 2024 +0000, Dmitry Timoshkov wrote:
Wouldn't it be more intuitive the parameter 'recursive' rename as 'notify' and invert its meaning?
Ambiguous with WM_NOTIFY. Maybe winevent?
On Tue Jun 18 20:44:22 2024 +0000, Esme Povirk wrote:
Ambiguous with WM_NOTIFY. Maybe winevent?
Sure, this variant also sounds reasonable.