[EXPLORER] Add support for Windows 7 style system tray icon spacing (#5489)

When using large taskbar icon:
- Increase the padding around system tray icons.
- Push the clock text further to the right, increasing the left padding
  between the clock and notification icons.
  This matches Windows 7 shell behavior.
- Correct the spacing for the clock area, in the case when bPreferDate is
  enabled, only two lines are visible, and the day of the week is shorter
  than the date.

CORE-11698
This commit is contained in:
Carl J. Bialorucki 2023-08-04 05:20:19 -06:00 committed by GitHub
parent f65c03a28c
commit 5b40f6f353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 2 deletions

View file

@ -267,6 +267,10 @@ WORD CTrayClockWnd::GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
if (!LinesMeasured)
return 0;
/* Prevents the date from being cut off when the day of the week is shorter than the date. */
if (VisibleLines > 1 && g_TaskbarSettings.bPreferDate)
szMax.cx = LineSizes[CLOCKWND_FORMAT_DATE].cx;
for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
{
if (LineSizes[i].cx != 0)
@ -567,8 +571,11 @@ VOID CTrayClockWnd::PaintLine(IN HDC hDC, IN OUT RECT *rcClient, IN UINT LineNum
if (LineSizes[LineNumber].cx == 0)
return;
INT HShift = ((IsHorizontal && (VisibleLines <= 1 ||
g_TaskbarSettings.bCompactTrayIcons)) ? 0 : TRAY_CLOCK_WND_SPACING_X);
TextOut(hDC,
(rcClient->right - LineSizes[szLinesIndex].cx) / 2,
((rcClient->right - LineSizes[szLinesIndex].cx) / 2) + HShift,
rcClient->top + TRAY_CLOCK_WND_SPACING_Y,
szLines[szLinesIndex],
wcslen(szLines[szLinesIndex]));