From 4b9b7d580f842c505fe71b616089dcfb182b2caf Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 8 May 2010 15:33:40 +0000 Subject: [PATCH] [EXPLORER] - Use proper buffer size, font type and an arbitrary high system time to create the size of the systray clock window - Fixes clock clipping See issue #2320 for more details. svn path=/trunk/; revision=47125 --- reactos/base/shell/explorer/taskbar/traynotify.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reactos/base/shell/explorer/taskbar/traynotify.cpp b/reactos/base/shell/explorer/taskbar/traynotify.cpp index 5bb76af043e..ea0e85a4204 100644 --- a/reactos/base/shell/explorer/taskbar/traynotify.cpp +++ b/reactos/base/shell/explorer/taskbar/traynotify.cpp @@ -1282,14 +1282,17 @@ HWND ClockWindow::Create(HWND hwndParent) ClientRect clnt(hwndParent); WindowCanvas canvas(hwndParent); - FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT)); + FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT)); RECT rect = {0, 0, 0, 0}; - TCHAR buffer[8]; + TCHAR buffer[16]; + // Arbitrary high time so that the created clock window is big enough + SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 }; - if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) + if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) _tcscpy(buffer, TEXT("00:00")); + // Calculate the rectangle needed to draw the time (without actually drawing it) DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); int clockwindowWidth = rect.right-rect.left + 4;