Author: gschneider Date: Sat May 8 17:33:40 2010 New Revision: 47125
URL: http://svn.reactos.org/svn/reactos?rev=47125&view=rev Log: [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.
Modified: trunk/reactos/base/shell/explorer/taskbar/traynotify.cpp
Modified: trunk/reactos/base/shell/explorer/taskbar/traynotify.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskbar... ============================================================================== --- trunk/reactos/base/shell/explorer/taskbar/traynotify.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/taskbar/traynotify.cpp [iso-8859-1] Sat May 8 17:33:40 2010 @@ -1282,14 +1282,17 @@ 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]; - - if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) + 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, &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;