From: "Jiajin Cui" Subject: [PATCH v5 2/2] user32:Fix z order error when WS_CHILD window want to be topmost windows.【请注意,邮件由wine-devel-bounces@winehq.org代发】 Message-Id: <2020062218031463491716@uniontech.com> Date: Mon, 22 Jun 2020 18:03:14 +0800 Window with WS_CHILD does not need to change Z order when SetWindowPos param hwndInsertAfter is HWND_TOPMOST or HWND_NOTOPMOST. Solve the problems mentioned in the previous patch, and Remove todo_wine on test_child_topmost_zorder. v2: Add git log information v3: Move the path to fixup_flags function, only used to fix SetWindowPos function problem. v4: Divide a path into two pathes, better explain the prolem. and add notopmost verification v5: Add todo_wine to test patch[PATCH v5 1/2], and optimize fixup_flags[PATCH v5 2/2].  Signed-off-by: Jiajin Cui From 35386d20843cf183f8541f7f8ee892d8cbb4e720 Mon Sep 17 00:00:00 2001 From: Jiajin Cui Date: Mon, 22 Jun 2020 17:49:46 +0800 Subject: [PATCH v5 2/2] user32:Fix z order error when WS_CHILD window want to be topmost windows. Window with WS_CHILD does not need to change Z order when SetWindowPos param hwndInsertAfter is HWND_TOPMOST or HWND_NOTOPMOST. Solve the problems mentioned in the previous patch, and Remove todo_wine. Signed-off-by: Jiajin Cui --- dlls/user32/tests/win.c | 8 -------- dlls/user32/winpos.c | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 1de1680cdd..a24eb2bb9d 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3046,32 +3046,24 @@ static void test_child_topmost_zorder(HWND hwnd_D) check_z_order(hwnd_A, hwnd_C, 0, 0, is_wine ? FALSE:TRUE); SetWindowPos(hwnd_B, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); -todo_wine -{ check_z_order(hwnd_C, hwnd_B, hwnd_A, 0, FALSE); check_z_order(hwnd_B, 0, hwnd_C, 0, FALSE); check_z_order(hwnd_A, hwnd_C, 0, 0, is_wine ? FALSE:TRUE); -} SetWindowPos(hwnd_B, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); check_z_order(hwnd_C, 0, hwnd_A, 0, FALSE); -todo_wine check_z_order(hwnd_B, hwnd_A, 0, 0, FALSE); check_z_order(hwnd_A, hwnd_C, hwnd_B, 0, is_wine ? FALSE:TRUE); SetWindowPos(hwnd_C, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); check_z_order(hwnd_C, 0, hwnd_A, 0, FALSE); -todo_wine check_z_order(hwnd_B, hwnd_A, 0, 0, FALSE); check_z_order(hwnd_A, hwnd_C, hwnd_B, 0, is_wine ? FALSE:TRUE); SetWindowPos(hwnd_C, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); -todo_wine -{ check_z_order(hwnd_C, hwnd_B, 0, 0, FALSE); check_z_order(hwnd_B, hwnd_A, hwnd_C, 0, FALSE); check_z_order(hwnd_A, 0, hwnd_B, 0, is_wine ? FALSE:TRUE); -} DestroyWindow(hwnd_A); DestroyWindow(hwnd_B); diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index b92a20df18..da07b18282 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -1998,12 +1998,13 @@ static BOOL fixup_flags( WINDOWPOS *winpos, const RECT *old_window_rect, int par } else if (winpos->hwndInsertAfter == HWND_TOPMOST) { - if ((wndPtr->dwExStyle & WS_EX_TOPMOST) && GetWindow(winpos->hwnd, GW_HWNDFIRST) == winpos->hwnd) + if (((wndPtr->dwExStyle & WS_EX_TOPMOST) && GetWindow(winpos->hwnd, GW_HWNDFIRST) == winpos->hwnd) || + ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)) winpos->flags |= SWP_NOZORDER; } else if (winpos->hwndInsertAfter == HWND_NOTOPMOST) { - if (!(wndPtr->dwExStyle & WS_EX_TOPMOST)) + if (!(wndPtr->dwExStyle & WS_EX_TOPMOST) || ((wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)) winpos->flags |= SWP_NOZORDER; } else -- 2.20.1