From: Giovanni Mascellani gmascellani@codeweavers.com
--- dlls/user32/tests/win.c | 7 ++----- dlls/win32u/window.c | 10 ++++++---- 2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 79b493c3289..160d85f2190 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -8924,7 +8924,6 @@ static BOOL message_window_topmost_received_killfocus;
static LRESULT WINAPI message_window_topmost_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { - 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); if (msg == WM_KILLFOCUS) message_window_topmost_received_killfocus = TRUE; return DefWindowProcW(hwnd, msg, wparam, lparam); @@ -9005,7 +9004,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)) { @@ -9017,10 +9016,9 @@ 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));
- todo_wine ok(!message_window_topmost_received_killfocus, "Received WM_KILLFOCUS\n"); message_window_topmost_received_killfocus = FALSE;
@@ -9033,7 +9031,6 @@ static void test_message_window_topmost(void) DispatchMessageW(&msg); }
- todo_wine_if(!message_window_topmost_received_killfocus) ok(message_window_topmost_received_killfocus, "Did not receive WM_KILLFOCUS\n");
ret = GetWindowRect(hwnd_msg, &rect); diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 3482679b97a..272d8926be2 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -3751,10 +3751,12 @@ BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) if (winpos->hwndInsertAfter == (HWND)0xffff) winpos->hwndInsertAfter = HWND_TOPMOST; else if (winpos->hwndInsertAfter == (HWND)0xfffe) winpos->hwndInsertAfter = HWND_NOTOPMOST;
- if (!(winpos->hwndInsertAfter == HWND_TOP || - winpos->hwndInsertAfter == HWND_BOTTOM || - winpos->hwndInsertAfter == HWND_TOPMOST || - winpos->hwndInsertAfter == HWND_NOTOPMOST)) + if (winpos->hwndInsertAfter == HWND_TOPMOST || winpos->hwndInsertAfter == HWND_NOTOPMOST) + { + HWND parent = NtUserGetAncestor( NtUserGetAncestor( winpos->hwnd, GA_ROOT ), GA_PARENT ); + if (parent == get_hwnd_message_parent()) return TRUE; + } + else if (winpos->hwndInsertAfter != HWND_TOP && winpos->hwndInsertAfter != HWND_BOTTOM) { HWND parent = NtUserGetAncestor( winpos->hwnd, GA_PARENT ); HWND insertafter_parent = NtUserGetAncestor( winpos->hwndInsertAfter, GA_PARENT );