1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-30 18:24:36 +01:00

Fixed #564 (the glom level settings for the Windows 10 taskbar are now stored separately, as setting the glom level to any other value than 0 breaks the window previews in the Windows 11 taskbar)

This commit is contained in:
Valentin Radu 2021-12-23 21:02:39 +02:00
parent 14d2d24d67
commit debf37a841
2 changed files with 64 additions and 8 deletions

View File

@ -78,6 +78,10 @@ BOOL bDoNotRedirectSystemToSettingsApp = FALSE;
BOOL bDoNotRedirectProgramsAndFeaturesToSettingsApp = FALSE; BOOL bDoNotRedirectProgramsAndFeaturesToSettingsApp = FALSE;
BOOL bDoNotRedirectDateAndTimeToSettingsApp = FALSE; BOOL bDoNotRedirectDateAndTimeToSettingsApp = FALSE;
BOOL bDoNotRedirectNotificationIconsToSettingsApp = FALSE; BOOL bDoNotRedirectNotificationIconsToSettingsApp = FALSE;
#define TASKBARGLOMLEVEL_DEFAULT 2
#define MMTASKBARGLOMLEVEL_DEFAULT 2
DWORD dwTaskbarGlomLevel = TASKBARGLOMLEVEL_DEFAULT;
DWORD dwMMTaskbarGlomLevel = MMTASKBARGLOMLEVEL_DEFAULT;
HMODULE hModule = NULL; HMODULE hModule = NULL;
HANDLE hDelayedInjectionThread = NULL; HANDLE hDelayedInjectionThread = NULL;
HANDLE hIsWinXShown = NULL; HANDLE hIsWinXShown = NULL;
@ -91,6 +95,7 @@ DWORD dwMonitorCount = 0;
int Code = 0; int Code = 0;
HRESULT InjectStartFromExplorer(); HRESULT InjectStartFromExplorer();
void InvokeClockFlyout(); void InvokeClockFlyout();
void WINAPI Explorer_RefreshUI(int unused);
#define ORB_STYLE_WINDOWS10 0 #define ORB_STYLE_WINDOWS10 0
#define ORB_STYLE_WINDOWS11 1 #define ORB_STYLE_WINDOWS11 1
@ -3828,8 +3833,12 @@ DWORD WindowSwitcher(DWORD unused)
#pragma region "Load Settings from registry" #pragma region "Load Settings from registry"
void WINAPI LoadSettings(BOOL bIsExplorer) void WINAPI LoadSettings(LPARAM lParam)
{ {
BOOL bIsExplorer = LOWORD(lParam);
BOOL bIsRefreshAllowed = HIWORD(lParam);
BOOL bShouldRefreshUI = FALSE;
HKEY hKey = NULL; HKEY hKey = NULL;
DWORD dwSize = 0, dwTemp = 0; DWORD dwSize = 0, dwTemp = 0;
@ -4280,6 +4289,36 @@ void WINAPI LoadSettings(BOOL bIsExplorer)
&bDoNotRedirectNotificationIconsToSettingsApp, &bDoNotRedirectNotificationIconsToSettingsApp,
&dwSize &dwSize
); );
dwTemp = TASKBARGLOMLEVEL_DEFAULT;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("TaskbarGlomLevel"),
0,
NULL,
&dwTemp,
&dwSize
);
if (dwTemp != dwTaskbarGlomLevel)
{
bShouldRefreshUI = TRUE;
}
dwTaskbarGlomLevel = dwTemp;
dwTemp = MMTASKBARGLOMLEVEL_DEFAULT;
dwSize = sizeof(DWORD);
RegQueryValueExW(
hKey,
TEXT("MMTaskbarGlomLevel"),
0,
NULL,
&dwTemp,
&dwSize
);
if (dwTemp != dwMMTaskbarGlomLevel)
{
bShouldRefreshUI = TRUE;
}
dwMMTaskbarGlomLevel = dwTemp;
RegCloseKey(hKey); RegCloseKey(hKey);
} }
@ -4470,6 +4509,11 @@ void WINAPI LoadSettings(BOOL bIsExplorer)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
} }
if (bIsRefreshAllowed && bShouldRefreshUI)
{
Explorer_RefreshUI(0);
}
} }
void Explorer_RefreshClockHelper(HWND hClockButton) void Explorer_RefreshClockHelper(HWND hClockButton)
@ -5617,6 +5661,16 @@ LSTATUS explorer_RegGetValueW(
*(DWORD*)pvData = 1; *(DWORD*)pvData = 1;
} }
} }
else if (!lstrcmpW(lpValue, L"TaskbarGlomLevel") || !lstrcmpW(lpValue, L"MMTaskbarGlomLevel"))
{
lRes = RegGetValueW(HKEY_CURRENT_USER, _T(REGPATH), lpValue, dwFlags, pdwType, pvData, pcbData);
if (lRes != ERROR_SUCCESS)
{
*(DWORD*)pvData = (lpValue[0] == L'T' ? TASKBARGLOMLEVEL_DEFAULT : MMTASKBARGLOMLEVEL_DEFAULT);
*(DWORD*)pcbData = sizeof(DWORD32);
lRes = ERROR_SUCCESS;
}
}
/*else if (!lstrcmpW(lpValue, L"PeopleBand")) /*else if (!lstrcmpW(lpValue, L"PeopleBand"))
{ {
lRes = RegGetValueW(hkey, lpSubKey, L"TaskbarMn", dwFlags, pdwType, pvData, pcbData); lRes = RegGetValueW(hkey, lpSubKey, L"TaskbarMn", dwFlags, pdwType, pvData, pcbData);
@ -6023,7 +6077,7 @@ DWORD Inject(BOOL bIsExplorer)
int rv; int rv;
LoadSettings(bIsExplorer); LoadSettings(MAKELPARAM(bIsExplorer, FALSE));
#ifdef _WIN64 #ifdef _WIN64
if (bIsExplorer) if (bIsExplorer)
@ -6059,7 +6113,7 @@ DWORD Inject(BOOL bIsExplorer)
if (cs < numSettings) if (cs < numSettings)
{ {
settings[cs].callback = LoadSettings; settings[cs].callback = LoadSettings;
settings[cs].data = bIsExplorer; settings[cs].data = MAKELPARAM(bIsExplorer, TRUE);
settings[cs].hEvent = NULL; settings[cs].hEvent = NULL;
settings[cs].hKey = NULL; settings[cs].hKey = NULL;
wcscpy_s(settings[cs].name, MAX_PATH, TEXT(REGPATH)); wcscpy_s(settings[cs].name, MAX_PATH, TEXT(REGPATH));
@ -6070,7 +6124,7 @@ DWORD Inject(BOOL bIsExplorer)
if (cs < numSettings) if (cs < numSettings)
{ {
settings[cs].callback = LoadSettings; settings[cs].callback = LoadSettings;
settings[cs].data = bIsExplorer; settings[cs].data = MAKELPARAM(bIsExplorer, FALSE);
settings[cs].hEvent = NULL; settings[cs].hEvent = NULL;
settings[cs].hKey = NULL; settings[cs].hKey = NULL;
wcscpy_s(settings[cs].name, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage"); wcscpy_s(settings[cs].name, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartPage");
@ -6169,7 +6223,7 @@ DWORD Inject(BOOL bIsExplorer)
if (cs < numSettings) if (cs < numSettings)
{ {
settings[cs].callback = LoadSettings; settings[cs].callback = LoadSettings;
settings[cs].data = bIsExplorer; settings[cs].data = MAKELPARAM(bIsExplorer, FALSE);
settings[cs].hEvent = NULL; settings[cs].hEvent = NULL;
settings[cs].hKey = NULL; settings[cs].hKey = NULL;
wcscpy_s(settings[cs].name, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"); wcscpy_s(settings[cs].name, MAX_PATH, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer");
@ -6608,6 +6662,8 @@ DWORD Inject(BOOL bIsExplorer)
0, 0,
0 0
); );
RegDeleteKeyValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"TaskbarGlomLevel");
RegDeleteKeyValueW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced", L"MMTaskbarGlomLevel");
} }

View File

@ -22,16 +22,16 @@
;;x 0 Windows 10 (default) ;;x 0 Windows 10 (default)
;;x 1 Windows 11 ;;x 1 Windows 11
;;"OrbStyle"=dword:00000000 ;;"OrbStyle"=dword:00000000
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 3 Combine taskbar icons on primary taskbar ;c 3 Combine taskbar icons on primary taskbar
;x 0 Always combine ;x 0 Always combine
;x 1 Combine when taskbar is full ;x 1 Combine when taskbar is full
;x 2 Never combine ;x 2 Never combine (default)
"TaskbarGlomLevel"=dword:00000002 "TaskbarGlomLevel"=dword:00000002
;c 3 Combine taskbar icons on secondary taskbar(s) ;c 3 Combine taskbar icons on secondary taskbar(s)
;x 0 Always combine ;x 0 Always combine
;x 1 Combine when taskbar is full ;x 1 Combine when taskbar is full
;x 2 Never combine ;x 2 Never combine (default)
"MMTaskbarGlomLevel"=dword:00000002 "MMTaskbarGlomLevel"=dword:00000002
[HKEY_CURRENT_USER\Software\ExplorerPatcher] [HKEY_CURRENT_USER\Software\ExplorerPatcher]
;c 4 Primary taskbar location on screen * ;c 4 Primary taskbar location on screen *