From aca585d81e72a2c3d01dd4e0b53ee87e6a87e0b9 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Sat, 12 Nov 2016 20:24:07 +0000 Subject: [PATCH] [TIMEDATE] Make the custom clock control aware of the theming. By Carlo Bramini. CORE-12079 svn path=/trunk/; revision=73214 --- reactos/dll/cpl/timedate/clock.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/reactos/dll/cpl/timedate/clock.c b/reactos/dll/cpl/timedate/clock.c index d4359505012..ebf9e8df2d2 100644 --- a/reactos/dll/cpl/timedate/clock.c +++ b/reactos/dll/cpl/timedate/clock.c @@ -182,20 +182,18 @@ ClockWndProc(HWND hwnd, 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 @@ ClockWndProc(HWND hwnd, 0, SRCCOPY); - SelectObject(hdcMem, hWinBrushOld); SelectObject(hdcMem, hBmpOld); DeleteObject(hBmp); } @@ -232,6 +229,10 @@ ClockWndProc(HWND hwnd, EndPaint(hwnd, &ps); break; + /* No need to erase background, handled during paint */ + case WM_ERASEBKGND: + return 1; + case WM_DESTROY: DeleteObject(pClockData->hGreyPen); DeleteObject(pClockData->hGreyBrush);