win32u: Move default WM_ERASEBKGND implementation from user32.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2022-05-11 21:00:01 +02:00 committed by Alexandre Julliard
parent 135e3176b6
commit 63ce060e5b
4 changed files with 29 additions and 28 deletions

View File

@ -266,25 +266,6 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
DEFWND_Print(hwnd, (HDC)wParam, lParam);
return 0;
case WM_ERASEBKGND:
case WM_ICONERASEBKGND:
{
RECT rect;
HDC hdc = (HDC)wParam;
HBRUSH hbr = (HBRUSH)GetClassLongPtrW( hwnd, GCLP_HBRBACKGROUND );
if (!hbr) return 0;
if (GetClassLongW( hwnd, GCL_STYLE ) & CS_PARENTDC)
{
/* can't use GetClipBox with a parent DC or we fill the whole parent */
GetClientRect( hwnd, &rect );
DPtoLP( hdc, (LPPOINT)&rect, 2 );
}
else GetClipBox( hdc, &rect );
FillRect( hdc, &rect, hbr );
return 1;
}
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:

View File

@ -31,6 +31,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush )
{
HBRUSH prev_brush;
prev_brush = NtGdiSelectBrush( dc, hbrush );
NtGdiPatBlt( dc, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
if (prev_brush) NtGdiSelectBrush( dc, prev_brush );
}
/***********************************************************************
* AdjustWindowRectEx (win32u.so)
*/
@ -310,6 +319,25 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
result = send_message( get_parent( hwnd ), WM_MOUSEWHEEL, wparam, lparam );
break;
case WM_ERASEBKGND:
case WM_ICONERASEBKGND:
{
RECT rect;
HDC hdc = (HDC)wparam;
HBRUSH hbr = UlongToHandle( get_class_long( hwnd, GCLP_HBRBACKGROUND, FALSE ));
if (!hbr) break;
if (get_class_long( hwnd, GCL_STYLE, FALSE ) & CS_PARENTDC)
{
/* can't use GetClipBox with a parent DC or we fill the whole parent */
get_client_rect( hwnd, &rect );
NtGdiTransformPoints( hdc, (POINT *)&rect, (POINT *)&rect, 1, NtGdiDPtoLP );
}
else NtGdiGetAppClipBox( hdc, &rect );
fill_rect( hdc, &rect, hbr );
return 1;
}
case WM_GETDLGCODE:
break;

View File

@ -1799,15 +1799,6 @@ static void display_caret( HWND hwnd, const RECT *r )
NtUserReleaseDC( hwnd, dc );
}
static void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush )
{
HBRUSH prev_brush;
prev_brush = NtGdiSelectBrush( dc, hbrush );
NtGdiPatBlt( dc, rect->left, rect->top, rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
if (prev_brush) NtGdiSelectBrush( dc, prev_brush );
}
static unsigned int get_caret_registry_timeout(void)
{
char value_buffer[FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data[11 * sizeof(WCHAR)])];

View File

@ -353,6 +353,7 @@ extern void register_window_surface( struct window_surface *old,
/* defwnd.c */
extern LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
BOOL ansi ) DECLSPEC_HIDDEN;
extern void fill_rect( HDC dc, const RECT *rect, HBRUSH hbrush ) DECLSPEC_HIDDEN;
/* hook.c */
extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;