[EXPLORER] Large taskbar icon support (#5465)

- Use HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarSmallIcons
  registry key to store the icon size setting for the taskbar.
- If the registry value is missing, small icons will be used by default.
- If the registry value is set to 1, it will also use small icons.
- Only if the value exists and is set to 0 it will use large icons. This allows us
  to use the same registry value as Windows 7 explorer, while also keeping
  the taskbar icons small in most cases, especially running the shell
  on unmodified Windows Server 2003.

CORE-11698
This commit is contained in:
Carl J. Bialorucki
2023-07-22 09:24:28 -06:00
committed by GitHub
parent 6d37456542
commit 0e8cf6ffd5
3 changed files with 15 additions and 5 deletions

View File

@@ -494,7 +494,7 @@ public:
#define GET_ICON(type) \
SendMessageTimeout(hwnd, WM_GETICON, (type), 0, SMTO_NOTIMEOUTIFNOTHUNG, 100, (PDWORD_PTR)&hIcon)
LRESULT bAlive = GET_ICON(ICON_SMALL2);
LRESULT bAlive = GET_ICON(g_TaskbarSettings.bSmallIcons ? ICON_SMALL2 : ICON_BIG);
if (hIcon)
return hIcon;
@@ -507,7 +507,7 @@ public:
if (bAlive)
{
GET_ICON(ICON_BIG);
GET_ICON(g_TaskbarSettings.bSmallIcons ? ICON_BIG : ICON_SMALL2);
if (hIcon)
return hIcon;
}
@@ -1262,9 +1262,12 @@ public:
/* Update the size of the image list if needed */
int cx, cy;
ImageList_GetIconSize(m_ImageList, &cx, &cy);
if (cx != GetSystemMetrics(SM_CXSMICON) || cy != GetSystemMetrics(SM_CYSMICON))
if (cx != GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CXSMICON : SM_CXICON) ||
cy != GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CYSMICON : SM_CYICON))
{
ImageList_SetIconSize(m_ImageList, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
ImageList_SetIconSize(m_ImageList,
GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CXSMICON : SM_CXICON),
GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CYSMICON : SM_CYICON));
/* SetIconSize removes all icons so we have to reinsert them */
PTASK_ITEM TaskItem = m_TaskItems;
@@ -1430,7 +1433,9 @@ public:
SetWindowTheme(m_TaskBar.m_hWnd, L"TaskBand", NULL);
m_ImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 0, 1000);
m_ImageList = ImageList_Create(GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CXSMICON : SM_CXICON),
GetSystemMetrics(g_TaskbarSettings.bSmallIcons ? SM_CYSMICON : SM_CYICON),
ILC_COLOR32 | ILC_MASK, 0, 1000);
m_TaskBar.SetImageList(m_ImageList);
/* Set proper spacing between buttons */