Author: akhaldi
Date: Sat Nov 12 20:24:07 2016
New Revision: 73214

URL: http://svn.reactos.org/svn/reactos?rev=73214&view=rev
Log:
[TIMEDATE] Make the custom clock control aware of the theming. By Carlo 
Bramini. CORE-12079

Modified:
    trunk/reactos/dll/cpl/timedate/clock.c

Modified: trunk/reactos/dll/cpl/timedate/clock.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/clock.c?rev=73214&r1=73213&r2=73214&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/clock.c      [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/timedate/clock.c      [iso-8859-1] Sat Nov 12 
20:24:07 2016
@@ -182,20 +182,18 @@
                                               pClockData->cyClient);
                 if (hBmp)
                 {
-                    HBRUSH hWinBrush, hWinBrushOld;
+                    RECT rcParent;
+                    HWND hParentWnd = GetParent(hwnd);
                     INT oldMap, Radius;
                     POINT oldOrg;
 
                     hBmpOld = SelectObject(hdcMem, hBmp);
 
-                    hWinBrush = GetSysColorBrush(COLOR_BTNFACE);
-                    hWinBrushOld = SelectObject(hdcMem, hWinBrush);
-                    PatBlt(hdcMem,
-                           0,
-                           0,
-                           pClockData->cxClient,
-                           pClockData->cyClient,
-                           PATCOPY);
+                    SetRect(&rcParent, 0, 0, pClockData->cxClient, 
pClockData->cyClient);
+                    MapWindowPoints(hwnd, hParentWnd, (POINT*)&rcParent, 2);
+                    OffsetViewportOrgEx(hdcMem, -rcParent.left, -rcParent.top, 
&oldOrg);
+                    SendMessage(hParentWnd, WM_PRINT, (WPARAM)hdcMem, 
PRF_ERASEBKGND | PRF_CLIENT);
+                    SetViewportOrgEx(hdcMem, oldOrg.x, oldOrg.y, NULL);
 
                     oldMap = SetMapMode(hdcMem, MM_ISOTROPIC);
                     SetWindowExtEx(hdcMem, 3600, 2700, NULL);
@@ -221,7 +219,6 @@
                            0,
                            SRCCOPY);
 
-                    SelectObject(hdcMem, hWinBrushOld);
                     SelectObject(hdcMem, hBmpOld);
                     DeleteObject(hBmp);
                 }
@@ -231,6 +228,10 @@
 
             EndPaint(hwnd, &ps);
             break;
+
+        /* No need to erase background, handled during paint */
+        case WM_ERASEBKGND:
+            return 1;
 
         case WM_DESTROY:
             DeleteObject(pClockData->hGreyPen);


Reply via email to