From 526ffdc304df08de700848745d95796f28c05e88 Mon Sep 17 00:00:00 2001 From: Yuxi Zhang Date: Sun, 4 Jul 1999 10:51:28 +0000 Subject: [PATCH] Make defwndproc erase the correct location. --- windows/defwnd.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/windows/defwnd.c b/windows/defwnd.c index 8ed6e19299b..738809d93c6 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -301,18 +301,28 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam, case WM_ERASEBKGND: case WM_ICONERASEBKGND: { + RECT16 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)); - FillWindow16( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf, - (HDC16)wParam, hbrush); + 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 ); } - else FillWindow16( GetParent16(wndPtr->hwndSelf), wndPtr->hwndSelf, - (HDC16)wParam, wndPtr->class->hbrBackground ); return 1; }