riched20: Add support for WM_PRINTCLIENT.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-24 09:08:33 +00:00 committed by Alexandre Julliard
parent f0e350d685
commit a41b81115f
1 changed files with 27 additions and 16 deletions

View File

@ -1178,51 +1178,62 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
break; break;
case WM_PAINT: case WM_PAINT:
case WM_PRINTCLIENT:
{ {
HDC hdc; HDC hdc;
RECT rc, client; RECT rc, client, update;
PAINTSTRUCT ps; PAINTSTRUCT ps;
HBRUSH brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) ); HBRUSH brush = CreateSolidBrush( ITextHost_TxGetSysColor( &host->ITextHost_iface, COLOR_WINDOW ) );
ITextHostImpl_TxGetClientRect( &host->ITextHost_iface, &client ); ITextHostImpl_TxGetClientRect( &host->ITextHost_iface, &client );
hdc = BeginPaint( hwnd, &ps ); if (msg == WM_PAINT)
{
hdc = BeginPaint( hwnd, &ps );
update = ps.rcPaint;
}
else
{
hdc = (HDC)wparam;
update = client;
}
brush = SelectObject( hdc, brush ); brush = SelectObject( hdc, brush );
/* Erase area outside of the formatting rectangle */ /* Erase area outside of the formatting rectangle */
if (ps.rcPaint.top < client.top) if (update.top < client.top)
{ {
rc = ps.rcPaint; rc = update;
rc.bottom = client.top; rc.bottom = client.top;
PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
ps.rcPaint.top = client.top; update.top = client.top;
} }
if (ps.rcPaint.bottom > client.bottom) if (update.bottom > client.bottom)
{ {
rc = ps.rcPaint; rc = update;
rc.top = client.bottom; rc.top = client.bottom;
PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
ps.rcPaint.bottom = client.bottom; update.bottom = client.bottom;
} }
if (ps.rcPaint.left < client.left) if (update.left < client.left)
{ {
rc = ps.rcPaint; rc = update;
rc.right = client.left; rc.right = client.left;
PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
ps.rcPaint.left = client.left; update.left = client.left;
} }
if (ps.rcPaint.right > client.right) if (update.right > client.right)
{ {
rc = ps.rcPaint; rc = update;
rc.left = client.right; rc.left = client.right;
PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); PatBlt( hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
ps.rcPaint.right = client.right; update.right = client.right;
} }
ITextServices_TxDraw( host->text_srv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL, ITextServices_TxDraw( host->text_srv, DVASPECT_CONTENT, 0, NULL, NULL, hdc, NULL, NULL, NULL,
&ps.rcPaint, NULL, 0, TXTVIEW_ACTIVE ); &update, NULL, 0, TXTVIEW_ACTIVE );
DeleteObject( SelectObject( hdc, brush ) ); DeleteObject( SelectObject( hdc, brush ) );
EndPaint( hwnd, &ps ); if (msg == WM_PAINT) EndPaint( hwnd, &ps );
return 0; return 0;
} }
case EM_REPLACESEL: case EM_REPLACESEL: