[PATCH 2/3] Implement handler for WM_ERASEBKGND

Nikolay Sivov bunglehead at gmail.com
Mon Oct 12 19:16:31 CDT 2009


---
 dlls/comctl32/monthcal.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index dc61d01..8440e15 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -1015,8 +1015,7 @@ static void MONTHCAL_PaintCalendar(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTS
 
 static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT *ps)
 {
-  RECT *title=&infoPtr->title;
-  HBRUSH hbr;
+  RECT *title = &infoPtr->title;
   COLORREF old_text_clr, old_bk_clr;
   HFONT old_font;
   RECT r_temp;
@@ -1025,11 +1024,6 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT
   old_bk_clr   = GetBkColor(hdc);
   old_font     = GetCurrentObject(hdc, OBJ_FONT);
 
-  /* fill background */
-  hbr = CreateSolidBrush (infoPtr->bk);
-  FillRect(hdc, &ps->rcPaint, hbr);
-  DeleteObject(hbr);
-
   /* draw title, redraw all its elements */
   if(IntersectRect(&r_temp, &(ps->rcPaint), title))
     MONTHCAL_PaintTitle(infoPtr, hdc, ps);
@@ -1048,7 +1042,6 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT
   SetTextColor(hdc, old_text_clr);
 }
 
-
 static LRESULT
 MONTHCAL_GetMinReqRect(const MONTHCAL_INFO *infoPtr, LPRECT lpRect)
 {
@@ -2114,6 +2107,22 @@ MONTHCAL_Paint(MONTHCAL_INFO *infoPtr, HDC hdc_paint)
 }
 
 static LRESULT
+MONTHCAL_EraseBkgnd(const MONTHCAL_INFO *infoPtr, HDC hdc)
+{
+  HBRUSH hbr;
+  RECT rc;
+
+  if (!GetClipBox(hdc, &rc)) return FALSE;
+
+  /* fill background */
+  hbr = CreateSolidBrush (infoPtr->bk);
+  FillRect(hdc, &rc, hbr);
+  DeleteObject(hbr);
+
+  return TRUE;
+}
+
+static LRESULT
 MONTHCAL_SetFocus(const MONTHCAL_INFO *infoPtr)
 {
   TRACE("\n");
@@ -2529,6 +2538,9 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
   case WM_PAINT:
     return MONTHCAL_Paint(infoPtr, (HDC)wParam);
 
+  case WM_ERASEBKGND:
+    return MONTHCAL_EraseBkgnd(infoPtr, (HDC)wParam);
+
   case WM_SETFOCUS:
     return MONTHCAL_SetFocus(infoPtr);
 
-- 
1.5.6.5


--=-daDBySn0nliJ2qALVxrd--




More information about the wine-patches mailing list