From: Giovanni Mascellani gmascellani@codeweavers.com
--- dlls/user32/tests/win.c | 6 ++---- dlls/win32u/window.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 7a012564499..38b5c4bc005 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -8892,10 +8892,8 @@ static LRESULT WINAPI message_window_topmost_proc(HWND hwnd, UINT msg, WPARAM wp * between sensibility and specificity, WM_KILLFOCUS is always * considered bad, while all the other messages are considered * bad only on the message-only widow. */ - todo_wine_if(msg == WM_KILLFOCUS) ok(msg != WM_KILLFOCUS, "Received message WM_KILLFOCUS for window %p (message-only window is %p)\n", hwnd, message_window_topmost_hwnd_msg); - todo_wine_if(hwnd == message_window_topmost_hwnd_msg) ok(hwnd != message_window_topmost_hwnd_msg, "Received message %u for message-only window %p\n", msg, hwnd); } @@ -8984,7 +8982,7 @@ static void test_message_window_topmost(void) ret = EndDeferWindowPos(hdwp); ok(ret, "Unexpected failure when calling EndDeferWindowPos()\n");
- todo_wine ok(GetLastError() == 0xdeadbeef, "Last error unexpectedly set to %#lx\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "Last error unexpectedly set to %#lx\n", GetLastError());
while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { @@ -8996,7 +8994,7 @@ static void test_message_window_topmost(void)
ret = GetWindowRect(hwnd_msg, &rect); ok(ret, "Unexpected failure when calling GetWindowRect()\n"); - todo_wine ok(rect.left == 220 && rect.top == 221 && rect.right == 220 + 222 && rect.bottom == 221 + 223, + ok(rect.left == 220 && rect.top == 221 && rect.right == 220 + 222 && rect.bottom == 221 + 223, "Unexpected rectangle %s\n", wine_dbgstr_rect(&rect));
message_window_topmost_received_killfocus = FALSE; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 4499e226a7b..7901dc1be6e 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3493,6 +3493,17 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) UINT orig_flags, context; BOOL ret = FALSE;
+ if (!(winpos->flags & SWP_NOZORDER) + && (winpos->hwndInsertAfter == HWND_TOPMOST || winpos->hwndInsertAfter == HWND_NOTOPMOST)) + { + HWND root; + + root = NtUserGetAncestor(winpos->hwnd, GA_ROOT); + root = NtUserGetAncestor(root, GA_PARENT); + if (root == get_hwnd_message_parent()) + return TRUE; + } + orig_flags = winpos->flags;
/* First, check z-order arguments. */