Skip to content

Commit

Permalink
Merge branch 'valinet:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deep-soft authored Aug 23, 2023
2 parents 361a743 + 5bda71f commit dd1b681
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 16 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Tested on OS build 22621.1992. Installer requires Internet connectivity.

* Windows 10 Start menu: Fixed a bug that prevented the menu from working on OS builds 22621.1413 and newer (46c5041). Please read these important notes regarding the fix [here](https://github.com/valinet/ExplorerPatcher/discussions/1679).

##### 2

* Windows 10 Start menu: Fixed a bug that prevented centering on Windows 10 (275a91f).

##### 3

* Windows 10 taskbar: Correct centering of taskbar items when search box is enabled in Windows 10 (2e43c67).

## 22621.1555.55

Tested on OS build 22621.1555. Installer requires Internet connectivity.
Expand Down
61 changes: 49 additions & 12 deletions ExplorerPatcher/TaskbarCenter.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern HWND PeopleButton_LastHWND;
extern DWORD dwWeatherToLeft;
extern DWORD dwOldTaskbarAl;
extern DWORD dwMMOldTaskbarAl;
extern DWORD dwSearchboxTaskbarMode;
extern wchar_t* EP_TASKBAR_LENGTH_PROP_NAME;
#define EP_TASKBAR_LENGTH_TOO_SMALL 20
BOOL bTaskbarCenterHasPatchedSHWindowsPolicy = FALSE;
Expand Down Expand Up @@ -144,9 +145,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
{
GetClientRect(hWndStart, &rcStart);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
RECT rcTrayButton;
GetClientRect(hTrayButton, &rcTrayButton);
if (bIsTaskbarHorizontal)
Expand All @@ -157,6 +160,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
{
rcStart.bottom += (rcTrayButton.bottom - rcTrayButton.top);
}
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
RECT rc;
Expand All @@ -180,13 +187,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClientRect(hWndStart, &rcTrayButton);
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
GetClientRect(hTrayButton, &rcTrayButton);
MoveWindow(hTrayButton, ((mi.rcMonitor.right - mi.rcMonitor.left) - (rcStart.right - rcStart.left)) / 2 + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
dwDim += (rcTrayButton.right - rcTrayButton.left);
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
else
Expand All @@ -196,13 +209,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClientRect(hWndStart, &rcTrayButton);
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
GetClientRect(hTrayButton, &rcTrayButton);
MoveWindow(hTrayButton, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2 + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
InvalidateRect(hTrayButton, NULL, TRUE);
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
Expand Down Expand Up @@ -310,13 +329,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClientRect(hWndStart, &rcTrayButton);
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
GetClientRect(hTrayButton, &rcTrayButton);
MoveWindow(hTrayButton, (rc.left - mi.rcMonitor.left) + lpRect->left - (rcStart.right - rcStart.left) + dwDim, rcStart.top, rcTrayButton.right, rcTrayButton.bottom, TRUE);
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
dwDim += (rcTrayButton.right - rcTrayButton.left);
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
else
Expand All @@ -326,13 +351,19 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClientRect(hWndStart, &rcTrayButton);
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
GetClientRect(hTrayButton, &rcTrayButton);
MoveWindow(hTrayButton, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top) + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
InvalidateRect(hTrayButton, NULL, TRUE);
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
Expand Down Expand Up @@ -442,9 +473,11 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
GetClientRect(hWndStart, &rcTrayButton);
DWORD dwDim = bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
HWND hTrayButton = NULL;
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
wchar_t* pCn = L"TrayButton";
if (!IsWindows11() && dwSearchboxTaskbarMode == 2) pCn = L"TrayDummySearchControl";
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, pCn, NULL))
{
if (!IsWindowVisible(hTrayButton)) continue;
if (pCn == L"TrayButton" && !IsWindowVisible(hTrayButton)) continue;
GetClientRect(hTrayButton, &rcTrayButton);
if (bIsTaskbarHorizontal)
{
Expand All @@ -456,6 +489,10 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
}
if (!bIsPrimaryTaskbar || !bIsTaskbarHorizontal) InvalidateRect(hTrayButton, NULL, TRUE);
dwDim += bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
if (pCn == L"TrayDummySearchControl") {
pCn = L"TrayButton";
hTrayButton = NULL;
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -11041,7 +11041,8 @@ void StartMenu_LoadSettings(BOOL bRestartIfChanged)
if (hKey)
{
dwSize = sizeof(DWORD);
dwVal = 0;
if (IsWindows11()) dwVal = 0;
else dwVal = 1;
RegQueryValueExW(
hKey,
TEXT("Start_ShowClassicMode"),
Expand Down
6 changes: 3 additions & 3 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define VER_MAJOR 22621
#define VER_MINOR 1992
#define VER_BUILD_HI 56
#define VER_BUILD_LO 1
#define VER_BUILD_LO 3
#define VER_FLAGS VS_FF_PRERELEASE


Expand All @@ -12,5 +12,5 @@
#define VER_STR(arg) #arg

// The String form of the version numbers
#define VER_FILE_STRING VALUE "FileVersion", "22621.1992.56.1"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.1992.56.1"
#define VER_FILE_STRING VALUE "FileVersion", "22621.1992.56.3"
#define VER_PRODUCT_STRING VALUE "ProductVersion", "22621.1992.56.3"

0 comments on commit dd1b681

Please sign in to comment.