From: "Jiajin Cui" Subject: [PATCH v5 1/2] user32/tests:Add test function Used to verify the child window Z order problem.【请注意,邮件由wine-devel-bounces@winehq.org代发】 Message-Id: <2020062218031283583215@uniontech.com> Date: Mon, 22 Jun 2020 18:03:13 +0800 I found that the z-order of window on WIN system will not change when HWND_TOPMOST and HWND_NOTOPMOST attributes are set for the same level window with WS_CHILD style, but it will change in wine, resulting in the problem of overlapping window, so I wrote a test function to explain this problem. 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 ffa93fdaa844a55bc757ddf9f6b0ab3d99430dc1 Mon Sep 17 00:00:00 2001 From: Jiajin Cui Date: Mon, 22 Jun 2020 17:47:17 +0800 Subject: [PATCH v5 1/2] user32/tests:Add test function Used to verify the child window Z order problem. I found that the z-order of window on WIN system will not change when HWND_TOPMOST and HWND_NOTOPMOST attributes are set for the same level window with WS_CHILD style, but it will change in wine, resulting in the problem of overlapping window, so I wrote a test function to explain this problem. Signed-off-by: Jiajin Cui --- dlls/user32/tests/win.c | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 700e60db17..1de1680cdd 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3013,6 +3013,71 @@ static void test_popup_zorder(HWND hwnd_D, HWND hwnd_E, DWORD style) DestroyWindow(hwnd_F); } +static void test_child_topmost_zorder(HWND hwnd_D) +{ + HWND hwnd_A, hwnd_B, hwnd_C; + + BOOL is_wine = !strcmp(winetest_platform, "wine"); + + hwnd_C = CreateWindowExA(0, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + check_z_order(hwnd_C, 0, 0, 0, FALSE); + + hwnd_B = CreateWindowExA(0, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + check_z_order(hwnd_C, hwnd_B, 0, 0, FALSE); + check_z_order(hwnd_B, 0, hwnd_C, 0, FALSE); + + hwnd_A = CreateWindowExA(WS_EX_TOPMOST, "MainWindowClass", NULL, + WS_CHILD, + 100, 100, 100, 100, + hwnd_D, 0, GetModuleHandleA(NULL), NULL); + 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); + + SetWindowPos(hwnd_A, HWND_TOP, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE); + 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_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); + DestroyWindow(hwnd_C); +} + static void test_vis_rgn( HWND hwnd ) { RECT win_rect, rgn_rect; @@ -11971,6 +12036,7 @@ START_TEST(win) test_children_zorder(hwndMain); test_popup_zorder(hwndMain2, hwndMain, WS_POPUP); test_popup_zorder(hwndMain2, hwndMain, 0); + test_child_topmost_zorder(hwndMain); test_GetLastActivePopup(); test_keyboard_input(hwndMain); test_mouse_input(hwndMain); -- 2.20.1