Skip to content

Commit 4b9b7d5

Browse files
committed
[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 reactos#2320 for more details. svn path=/trunk/; revision=47125
1 parent f820fe7 commit 4b9b7d5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

reactos/base/shell/explorer/taskbar/traynotify.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,14 +1282,17 @@ HWND ClockWindow::Create(HWND hwndParent)
12821282
ClientRect clnt(hwndParent);
12831283

12841284
WindowCanvas canvas(hwndParent);
1285-
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
1285+
FontSelection font(canvas, GetStockFont(ANSI_VAR_FONT));
12861286

12871287
RECT rect = {0, 0, 0, 0};
1288-
TCHAR buffer[8];
1288+
TCHAR buffer[16];
1289+
// Arbitrary high time so that the created clock window is big enough
1290+
SYSTEMTIME st = { 1601, 1, 0, 1, 23, 59, 59, 999 };
12891291

1290-
if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
1292+
if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &st, NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
12911293
_tcscpy(buffer, TEXT("00:00"));
12921294

1295+
// Calculate the rectangle needed to draw the time (without actually drawing it)
12931296
DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT);
12941297
int clockwindowWidth = rect.right-rect.left + 4;
12951298

0 commit comments

Comments
 (0)