Commit 9dded144 authored by Patrik Stridvall's avatar Patrik Stridvall Committed by Alexandre Julliard

- Made FillRect behave like it does on Windows

- Cleaned up WM_{,ICON}ERASEBACKGROUND default handling - Added some comments on how Windows behaves
parent 65b1f9f0
......@@ -21,9 +21,6 @@
DEFAULT_DEBUG_CHANNEL(win)
/* Last COLOR id */
#define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION
/* bits in the dwKeyData */
#define KEYDATA_ALT 0x2000
#define KEYDATA_PREVSTATE 0x4000
......@@ -301,28 +298,21 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam,
case WM_ERASEBKGND:
case WM_ICONERASEBKGND:
{
RECT16 rect;
RECT rect;
if (!wndPtr->class->hbrBackground) return 0;
/* Since WM_ERASEBKGND may receive either a window dc or a */
/* client dc, the area to be erased has to be retrieved from */
/* the device context. */
GetClipBox16( (HDC16)wParam, &rect );
if (wndPtr->class->hbrBackground <= (HBRUSH16)(COLOR_MAX+1))
{
HBRUSH hbrush = CreateSolidBrush(
GetSysColor(((DWORD)wndPtr->class->hbrBackground)-1));
PaintRect16( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf,
(HDC16)wParam, hbrush, &rect);
DeleteObject( hbrush );
}
else
{
PaintRect16( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf,
(HDC16)wParam, wndPtr->class->hbrBackground, &rect );
}
GetClipBox( (HDC)wParam, &rect );
/* Always call the Win32 variant of FillRect even on Win16,
* since despite the fact that Win16, as well as Win32,
* supports special background brushes for a window class,
* the Win16 variant of FillRect does not.
*/
FillRect( (HDC) wParam, &rect, wndPtr->class->hbrBackground);
return 1;
}
......
......@@ -24,6 +24,9 @@ DECLARE_DEBUG_CHANNEL(nonclient)
(r).right = (wnd)->rectClient.right - (wnd)->rectWindow.left; \
(r).bottom = (wnd)->rectClient.bottom - (wnd)->rectWindow.top
/* Last COLOR id */
#define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION
/* Last CTLCOLOR id */
#define CTLCOLOR_MAX CTLCOLOR_STATIC
......@@ -568,7 +571,7 @@ static void RDW_UpdateRgns( WND* wndPtr, HRGN hRgn, UINT flags, BOOL firstRecurs
{
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = 0;
goto OUT;
goto end;
}
}
break;
......@@ -686,7 +689,7 @@ EMPTY:
RDW_UpdateRgns( wnd, hRgn, flags, FALSE );
}
OUT:
end:
/* Set/clear internal paint flag */
......@@ -1228,6 +1231,10 @@ INT WINAPI ExcludeUpdateRgn( HDC hdc, HWND hwnd )
/***********************************************************************
* FillRect16 (USER.81)
* NOTE
* The Win16 variant doesn't support special color brushes like
* the Win32 one, despite the fact that Win16, as well as Win32,
* supports special background brushes for a window class.
*/
INT16 WINAPI FillRect16( HDC16 hdc, const RECT16 *rect, HBRUSH16 hbrush )
{
......@@ -1252,6 +1259,10 @@ INT WINAPI FillRect( HDC hdc, const RECT *rect, HBRUSH hbrush )
{
HBRUSH prevBrush;
if (hbrush <= (HBRUSH) (COLOR_MAX + 1)) {
hbrush = GetSysColorBrush( (INT) hbrush - 1 );
}
if (!(prevBrush = SelectObject( hdc, hbrush ))) return 0;
PatBlt( hdc, rect->left, rect->top,
rect->right - rect->left, rect->bottom - rect->top, PATCOPY );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment