From: Zhiyi Zhang zzhang@codeweavers.com
--- dlls/user32/tests/msg.c | 3 +-- dlls/win32u/dc.c | 13 +++++++++++++ dlls/win32u/defwnd.c | 32 ++++++++++++++++++++++++++++++-- dlls/win32u/ntgdi_private.h | 1 + 4 files changed, 45 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 9b4c1e88148..ab41011c03c 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -21201,9 +21201,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", TRUE); + ok_sequence(wm_print_prf_children, "DefWindowProc WM_PRINT with PRF_CHILDREN | PRF_CLIENT", FALSE); flush_sequence();
ReleaseDC(hwnd, hdc); diff --git a/dlls/win32u/dc.c b/dlls/win32u/dc.c index 16092141163..94946d9ad23 100644 --- a/dlls/win32u/dc.c +++ b/dlls/win32u/dc.c @@ -1095,6 +1095,19 @@ BOOL WINAPI NtGdiSetBrushOrg( HDC hdc, INT x, INT y, POINT *oldorg ) }
+BOOL offset_viewport_org( HDC hdc, INT x, INT y, POINT *point ) +{ + DC *dc; + + if (!(dc = get_dc_ptr( hdc ))) return FALSE; + if (point) *point = dc->attr->vport_org; + dc->attr->vport_org.x += x; + dc->attr->vport_org.y += y; + release_dc_ptr( dc ); + return NtGdiComputeXformCoefficients( hdc ); +} + + BOOL set_viewport_org( HDC hdc, INT x, INT y, POINT *point ) { DC *dc; diff --git a/dlls/win32u/defwnd.c b/dlls/win32u/defwnd.c index 27bc76e1886..d8bd8e8637b 100644 --- a/dlls/win32u/defwnd.c +++ b/dlls/win32u/defwnd.c @@ -2831,11 +2831,39 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, if ((lparam & PRF_CHECKVISIBLE) && !is_window_visible ( hwnd )) break; result = 1;
- if (lparam & (PRF_CHILDREN | PRF_OWNED | PRF_NONCLIENT)) + if (lparam & (PRF_OWNED | PRF_NONCLIENT)) WARN( "WM_PRINT message with unsupported lparam %lx\n", lparam );
if (lparam & PRF_ERASEBKGND) send_message( hwnd, WM_ERASEBKGND, wparam, 0 ); - if (lparam & PRF_CLIENT) send_message(hwnd, WM_PRINTCLIENT, wparam, lparam ); + if (lparam & PRF_CLIENT) + { + send_message( hwnd, WM_PRINTCLIENT, wparam, lparam ); + + if (lparam & PRF_CHILDREN) + { + HWND *list, *child; + POINT org; + RECT rect; + UINT dpi; + + if ((list = list_window_children( hwnd ))) + { + for (child = list; *child; child++) + { + if (!is_window_visible( *child )) + continue; + + dpi = NtUserGetDpiForWindow( *child ); + NtUserGetClientRect( *child, &rect, dpi ); + NtUserMapWindowPoints( *child, hwnd, (POINT *)&rect, 2, dpi ); + offset_viewport_org( (HDC)wparam, rect.left, rect.top, &org ); + send_message( *child, WM_PRINT, wparam, PRF_NONCLIENT | PRF_CLIENT | PRF_ERASEBKGND | PRF_CHILDREN ); + set_viewport_org( (HDC)wparam, org.x, org.y, NULL ); + } + free( list ); + } + } + } break;
case WM_APPCOMMAND: diff --git a/dlls/win32u/ntgdi_private.h b/dlls/win32u/ntgdi_private.h index 78b3ad89796..ba61a7369b5 100644 --- a/dlls/win32u/ntgdi_private.h +++ b/dlls/win32u/ntgdi_private.h @@ -185,6 +185,7 @@ extern struct dce *get_dc_dce( HDC hdc ); extern void set_dc_dce( HDC hdc, struct dce *dce ); extern WORD set_dce_flags( HDC hdc, WORD flags ); extern DWORD set_stretch_blt_mode( HDC hdc, DWORD mode ); +extern BOOL offset_viewport_org( HDC hdc, INT x, INT y, POINT *point ); extern BOOL set_viewport_org( HDC hdc, INT x, INT y, POINT *point ); extern void DC_InitDC( DC * dc ); extern void DC_UpdateXforms( DC * dc );