[PATCH 0/2] MR8585: win32u: Allow PRF_CHILDREN to paint even though child windows have an invisible parent.
From: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/user32/tests/msg.c | 48 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index ab41011c03c..772b4d0797e 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -21151,10 +21151,11 @@ static const struct message wm_print_prf_children[] = static void test_defwinproc_wm_print(void) { + HDC hwnd_hdc, hdc; HWND hwnd, child; COLORREF color; + HBITMAP bitmap; LRESULT lr; - HDC hdc; hwnd = CreateWindowA("SimpleWindowClass", "test_defwinproc_wm_print", WS_POPUP, 0, 0, 100, 100, 0, 0, 0, NULL); @@ -21163,7 +21164,10 @@ static void test_defwinproc_wm_print(void) 50, 50, 50, 50, hwnd, 0, 0, NULL); ok(!!child, "CreateWindowA failed, error %lu.\n", GetLastError()); - hdc = GetDC(hwnd); + hwnd_hdc = GetDC(hwnd); + hdc = CreateCompatibleDC(hwnd_hdc); + bitmap = CreateCompatibleBitmap(hwnd_hdc, 100, 100); + SelectObject(hdc, bitmap); /* Check the return code when no flags are specified */ lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, 0); @@ -21190,14 +21194,16 @@ static void test_defwinproc_wm_print(void) ok(lr == 1, "Got unexpected lr %Id.\n", lr); /* PRF_CHILDREN needs to be used with PRF_CLIENT */ + PatBlt(hdc, 0, 0, 100, 100, BLACKNESS); lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, PRF_CHILDREN); ok(lr == 1, "Got unexpected lr %Id.\n", lr); color = GetPixel(hdc, 50, 50); - ok(color == RGB(0xff, 0xff, 0xff), "Got unexpected color %#lx.\n", color); + ok(color == RGB(0, 0, 0), "Got unexpected color %#lx.\n", color); ok_sequence(WmEmptySeq, "DefWindowProc WM_PRINT PRF_CHILDREN", FALSE); flush_sequence(); /* PRF_CHILDREN | PRF_CLIENT */ + PatBlt(hdc, 0, 0, 100, 100, BLACKNESS); lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, PRF_CHILDREN | PRF_CLIENT); ok(lr == 1, "Got unexpected lr %Id.\n", lr); color = GetPixel(hdc, 50, 50); @@ -21205,7 +21211,41 @@ static void test_defwinproc_wm_print(void) ok_sequence(wm_print_prf_children, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT", FALSE); flush_sequence(); - ReleaseDC(hwnd, hdc); + /* PRF_CHILDREN | PRF_CLIENT with an invisible parent. Expect children to still draw to the HDC */ + ShowWindow(hwnd, SW_HIDE); + flush_events(); + flush_sequence(); + ok(!IsWindowVisible(hwnd), "Expected hwnd invisible.\n"); + ok(!IsWindowVisible(child), "Expected child invisible.\n"); + + PatBlt(hdc, 0, 0, 100, 100, BLACKNESS); + lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, PRF_CHILDREN | PRF_CLIENT); + ok(lr == 1, "Got unexpected lr %Id.\n", lr); + color = GetPixel(hdc, 50, 50); + todo_wine + ok(color == RGB(0xff, 0, 0), "Got unexpected color %#lx.\n", color); + ok_sequence(wm_print_prf_children, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT with an invisible parent", TRUE); + flush_sequence(); + + /* PRF_CHILDREN | PRF_CLIENT with an invisible child window */ + ShowWindow(hwnd, SW_NORMAL); + ShowWindow(child, SW_HIDE); + flush_events(); + flush_sequence(); + ok(IsWindowVisible(hwnd), "Expected hwnd invisible.\n"); + ok(!IsWindowVisible(child), "Expected child invisible.\n"); + + PatBlt(hdc, 0, 0, 100, 100, BLACKNESS); + lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, PRF_CHILDREN | PRF_CLIENT); + ok(lr == 1, "Got unexpected lr %Id.\n", lr); + color = GetPixel(hdc, 50, 50); + ok(color == RGB(0, 0, 0), "Got unexpected color %#lx.\n", color); + ok_sequence(WmEmptySeq, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT with an invisible child", FALSE); + flush_sequence(); + + DeleteObject(bitmap); + DeleteDC(hdc); + ReleaseDC(hwnd, hwnd_hdc); DestroyWindow(hwnd); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8585
From: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/user32/tests/msg.c | 3 +-- dlls/win32u/defwnd.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 772b4d0797e..80d900baa1c 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -21222,9 +21222,8 @@ static void test_defwinproc_wm_print(void) lr = DefWindowProcA(hwnd, WM_PRINT, (WPARAM)hdc, PRF_CHILDREN | PRF_CLIENT); ok(lr == 1, "Got unexpected lr %Id.\n", lr); color = GetPixel(hdc, 50, 50); - todo_wine ok(color == RGB(0xff, 0, 0), "Got unexpected color %#lx.\n", color); - ok_sequence(wm_print_prf_children, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT with an invisible parent", TRUE); + ok_sequence(wm_print_prf_children, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT with an invisible parent", FALSE); flush_sequence(); /* PRF_CHILDREN | PRF_CLIENT with an invisible child window */ diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index d8bd8e8637b..3cc64e405b2 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2850,7 +2850,7 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, { for (child = list; *child; child++) { - if (!is_window_visible( *child )) + if (!(get_window_long( *child, GWL_STYLE ) & WS_VISIBLE)) continue; dpi = NtUserGetDpiForWindow( *child ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8585
participants (2)
-
Zhiyi Zhang -
Zhiyi Zhang (@zhiyi)