- Made FillRect behave like it does on Windows

- Cleaned up WM_{,ICON}ERASEBACKGROUND default handling
- Added some comments on how Windows behaves
oldstable
Patrik Stridvall 2000-01-05 03:05:23 +00:00 committed by Alexandre Julliard
parent 65b1f9f0f0
commit 9dded144f4
2 changed files with 21 additions and 20 deletions

View File

@ -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 );
GetClipBox( (HDC)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 );
}
/* 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;
}

View File

@ -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 );