mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 20:18:22 +00:00
[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:
parent
f65c03a28c
commit
5b40f6f353
4 changed files with 27 additions and 2 deletions
|
@ -211,6 +211,7 @@ struct TaskbarSettings
|
||||||
BOOL bPreferDate;
|
BOOL bPreferDate;
|
||||||
BOOL bHideInactiveIcons;
|
BOOL bHideInactiveIcons;
|
||||||
BOOL bSmallIcons;
|
BOOL bSmallIcons;
|
||||||
|
BOOL bCompactTrayIcons;
|
||||||
TW_STRUCKRECTS2 sr;
|
TW_STRUCKRECTS2 sr;
|
||||||
|
|
||||||
BOOL Load();
|
BOOL Load();
|
||||||
|
|
|
@ -32,6 +32,7 @@ BOOL TaskbarSettings::Save()
|
||||||
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSizeMove", REG_DWORD, &bAllowSizeMove, sizeof(bAllowSizeMove));
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSizeMove", REG_DWORD, &bAllowSizeMove, sizeof(bAllowSizeMove));
|
||||||
sr.cbSize = sizeof(sr);
|
sr.cbSize = sizeof(sr);
|
||||||
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", REG_DWORD, &bSmallIcons, sizeof(bSmallIcons));
|
SHSetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", REG_DWORD, &bSmallIcons, sizeof(bSmallIcons));
|
||||||
|
SHSetValueW(hkExplorer, L"Advanced", L"CompactTrayIcons", REG_DWORD, &bCompactTrayIcons, sizeof(bCompactTrayIcons));
|
||||||
SHSetValueW(hkExplorer, L"StuckRects2", L"Settings", REG_BINARY, &sr, sizeof(sr));
|
SHSetValueW(hkExplorer, L"StuckRects2", L"Settings", REG_BINARY, &sr, sizeof(sr));
|
||||||
|
|
||||||
/* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
|
/* TODO: AutoHide writes something to HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0 figure out what and why */
|
||||||
|
@ -61,6 +62,9 @@ BOOL TaskbarSettings::Load()
|
||||||
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", NULL, &dwValue, &cbSize);
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"TaskbarSmallIcons", NULL, &dwValue, &cbSize);
|
||||||
bSmallIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : TRUE;
|
bSmallIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : TRUE;
|
||||||
|
|
||||||
|
dwRet = SHGetValueW(hkExplorer, L"Advanced", L"CompactTrayIcons", NULL, &dwValue, &cbSize);
|
||||||
|
bCompactTrayIcons = (dwRet == ERROR_SUCCESS) ? (dwValue != 0) : bSmallIcons;
|
||||||
|
|
||||||
cbSize = sizeof(sr);
|
cbSize = sizeof(sr);
|
||||||
dwRet = SHGetValueW(hkExplorer, L"StuckRects2", L"Settings", NULL, &sr, &cbSize);
|
dwRet = SHGetValueW(hkExplorer, L"StuckRects2", L"Settings", NULL, &sr, &cbSize);
|
||||||
|
|
||||||
|
|
|
@ -1252,6 +1252,11 @@ void CNotifyToolbar::Initialize(HWND hWndParent, CBalloonQueue * queue)
|
||||||
tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING | TBMF_PAD;
|
tbm.dwMask = TBMF_BARPAD | TBMF_BUTTONSPACING | TBMF_PAD;
|
||||||
tbm.cxPad = 1;
|
tbm.cxPad = 1;
|
||||||
tbm.cyPad = 1;
|
tbm.cyPad = 1;
|
||||||
|
if (!g_TaskbarSettings.bCompactTrayIcons)
|
||||||
|
{
|
||||||
|
tbm.cxPad = GetSystemMetrics(SM_CXSMICON) / 2;
|
||||||
|
tbm.cyPad = GetSystemMetrics(SM_CYSMICON) / 2;
|
||||||
|
}
|
||||||
tbm.cxBarPad = 1;
|
tbm.cxBarPad = 1;
|
||||||
tbm.cyBarPad = 1;
|
tbm.cyBarPad = 1;
|
||||||
tbm.cxButtonSpacing = 1;
|
tbm.cxButtonSpacing = 1;
|
||||||
|
@ -1397,11 +1402,19 @@ void CSysPagerWnd::GetSize(IN BOOL IsHorizontal, IN PSIZE size)
|
||||||
INT columns = 0;
|
INT columns = 0;
|
||||||
INT cyButton = GetSystemMetrics(SM_CYSMICON) + 2;
|
INT cyButton = GetSystemMetrics(SM_CYSMICON) + 2;
|
||||||
INT cxButton = GetSystemMetrics(SM_CXSMICON) + 2;
|
INT cxButton = GetSystemMetrics(SM_CXSMICON) + 2;
|
||||||
|
if (!g_TaskbarSettings.bCompactTrayIcons)
|
||||||
|
{
|
||||||
|
cyButton = MulDiv(GetSystemMetrics(SM_CYSMICON), 3, 2);
|
||||||
|
cxButton = MulDiv(GetSystemMetrics(SM_CXSMICON), 3, 2);
|
||||||
|
}
|
||||||
int VisibleButtonCount = Toolbar.GetVisibleButtonCount();
|
int VisibleButtonCount = Toolbar.GetVisibleButtonCount();
|
||||||
|
|
||||||
if (IsHorizontal)
|
if (IsHorizontal)
|
||||||
{
|
{
|
||||||
rows = max(size->cy / cyButton, 1);
|
if (!g_TaskbarSettings.bCompactTrayIcons)
|
||||||
|
rows = max(size->cy / MulDiv(cyButton, 3, 2), 1);
|
||||||
|
else
|
||||||
|
rows = max(size->cy / cyButton, 1);
|
||||||
columns = (VisibleButtonCount + rows - 1) / rows;
|
columns = (VisibleButtonCount + rows - 1) / rows;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -267,6 +267,10 @@ WORD CTrayClockWnd::GetMinimumSize(IN BOOL Horizontal, IN OUT PSIZE pSize)
|
||||||
if (!LinesMeasured)
|
if (!LinesMeasured)
|
||||||
return 0;
|
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++)
|
for (i = 0; i < CLOCKWND_FORMAT_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (LineSizes[i].cx != 0)
|
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)
|
if (LineSizes[LineNumber].cx == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
INT HShift = ((IsHorizontal && (VisibleLines <= 1 ||
|
||||||
|
g_TaskbarSettings.bCompactTrayIcons)) ? 0 : TRAY_CLOCK_WND_SPACING_X);
|
||||||
|
|
||||||
TextOut(hDC,
|
TextOut(hDC,
|
||||||
(rcClient->right - LineSizes[szLinesIndex].cx) / 2,
|
((rcClient->right - LineSizes[szLinesIndex].cx) / 2) + HShift,
|
||||||
rcClient->top + TRAY_CLOCK_WND_SPACING_Y,
|
rcClient->top + TRAY_CLOCK_WND_SPACING_Y,
|
||||||
szLines[szLinesIndex],
|
szLines[szLinesIndex],
|
||||||
wcslen(szLines[szLinesIndex]));
|
wcslen(szLines[szLinesIndex]));
|
||||||
|
|
Loading…
Reference in a new issue