mirror of
https://github.com/valinet/ExplorerPatcher.git
synced 2024-11-15 03:27:35 +01:00
Taskbar10: Centered with Start button works correctly when taskbar is vertical
This commit is contained in:
parent
80106bbd7d
commit
bbe6a7b2bd
@ -158,8 +158,15 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
|||||||
if (!IsWindowVisible(hTrayButton)) continue;
|
if (!IsWindowVisible(hTrayButton)) continue;
|
||||||
RECT rcTrayButton;
|
RECT rcTrayButton;
|
||||||
GetClientRect(hTrayButton, &rcTrayButton);
|
GetClientRect(hTrayButton, &rcTrayButton);
|
||||||
|
if (bIsTaskbarHorizontal)
|
||||||
|
{
|
||||||
rcStart.right += (rcTrayButton.right - rcTrayButton.left);
|
rcStart.right += (rcTrayButton.right - rcTrayButton.left);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rcStart.bottom += (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RECT rc;
|
RECT rc;
|
||||||
GetWindowRect(hWnd, &rc);
|
GetWindowRect(hWnd, &rc);
|
||||||
@ -196,15 +203,15 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
|||||||
SetWindowPos(hWndStart, NULL, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
|
SetWindowPos(hWndStart, NULL, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2, 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
|
||||||
RECT rcTrayButton;
|
RECT rcTrayButton;
|
||||||
GetClientRect(hWndStart, &rcTrayButton);
|
GetClientRect(hWndStart, &rcTrayButton);
|
||||||
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
|
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
HWND hTrayButton = NULL;
|
HWND hTrayButton = NULL;
|
||||||
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
||||||
{
|
{
|
||||||
if (!IsWindowVisible(hTrayButton)) continue;
|
if (!IsWindowVisible(hTrayButton)) continue;
|
||||||
GetClientRect(hTrayButton, &rcTrayButton);
|
GetClientRect(hTrayButton, &rcTrayButton);
|
||||||
MoveWindow(hTrayButton, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2 + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
MoveWindow(hTrayButton, rcStart.left, ((mi.rcMonitor.bottom - mi.rcMonitor.top) - (rcStart.bottom - rcStart.top)) / 2 + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
|
InvalidateRect(hTrayButton, NULL, TRUE);
|
||||||
dwDim += (rcTrayButton.right - rcTrayButton.left);
|
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
||||||
@ -271,15 +278,15 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
|||||||
SetWindowPos(hWndStart, NULL, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
|
SetWindowPos(hWndStart, NULL, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top), 0, 0, SWP_NOSIZE | SWP_FRAMECHANGED | SWP_ASYNCWINDOWPOS);
|
||||||
RECT rcTrayButton;
|
RECT rcTrayButton;
|
||||||
GetClientRect(hWndStart, &rcTrayButton);
|
GetClientRect(hWndStart, &rcTrayButton);
|
||||||
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
|
DWORD dwDim = (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
HWND hTrayButton = NULL;
|
HWND hTrayButton = NULL;
|
||||||
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
||||||
{
|
{
|
||||||
if (!IsWindowVisible(hTrayButton)) continue;
|
if (!IsWindowVisible(hTrayButton)) continue;
|
||||||
GetClientRect(hTrayButton, &rcTrayButton);
|
GetClientRect(hTrayButton, &rcTrayButton);
|
||||||
MoveWindow(hTrayButton, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top) + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
MoveWindow(hTrayButton, rcStart.left, (rc.top - mi.rcMonitor.top) + lpRect->top - (rcStart.bottom - rcStart.top) + dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
|
InvalidateRect(hTrayButton, NULL, TRUE);
|
||||||
dwDim += (rcTrayButton.right - rcTrayButton.left);
|
dwDim += (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
||||||
@ -303,7 +310,7 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
|||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
if (!bIsPrimaryTaskbar) InvalidateRect(hWndStart, NULL, TRUE);
|
||||||
RECT rcTrayButton;
|
RECT rcTrayButton;
|
||||||
GetClientRect(hWndStart, &rcTrayButton);
|
GetClientRect(hWndStart, &rcTrayButton);
|
||||||
DWORD dwDim = (rcTrayButton.right - rcTrayButton.left);
|
DWORD dwDim = bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
HWND hTrayButton = NULL;
|
HWND hTrayButton = NULL;
|
||||||
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
while (hTrayButton = FindWindowExW(hWndTaskbar, hTrayButton, L"TrayButton", NULL))
|
||||||
{
|
{
|
||||||
@ -317,8 +324,8 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
|
|||||||
{
|
{
|
||||||
MoveWindow(hTrayButton, 0, dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
MoveWindow(hTrayButton, 0, dwDim, rcTrayButton.right, rcTrayButton.bottom, TRUE);
|
||||||
}
|
}
|
||||||
if (!bIsPrimaryTaskbar) InvalidateRect(hTrayButton, NULL, TRUE);
|
if (!bIsPrimaryTaskbar || !bIsTaskbarHorizontal) InvalidateRect(hTrayButton, NULL, TRUE);
|
||||||
dwDim += (rcTrayButton.right - rcTrayButton.left);
|
dwDim += bIsTaskbarHorizontal ? (rcTrayButton.right - rcTrayButton.left) : (rcTrayButton.bottom - rcTrayButton.top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user