1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-02-20 20:41:26 +01:00

Taskbar10: Fixed #1009

This commit is contained in:
Valentin Radu 2022-03-07 00:35:53 +02:00
parent 9216ed4ad8
commit a4c70364f5
2 changed files with 11 additions and 5 deletions

View File

@ -31,7 +31,7 @@ inline BOOL TaskbarCenter_ShouldLeftAlignWhenSpaceConstrained(DWORD dwSetting)
return (dwSetting & 0b100);
}
HRESULT TaskbarCenter_Center(HWND hWnd, RECT rc, BOOL bIsTaskbarHorizontal)
HRESULT TaskbarCenter_Center(HWND hWnd, HWND hWndTaskbar, RECT rc, BOOL bIsTaskbarHorizontal)
{
HRESULT hr = S_OK;
VARIANT vtChild[10];
@ -99,12 +99,18 @@ HRESULT TaskbarCenter_Center(HWND hWnd, RECT rc, BOOL bIsTaskbarHorizontal)
}
else
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top))));
if (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top))));
}
}
}
else
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, bIsTaskbarHorizontal ? w : h);
if (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))
{
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, bIsTaskbarHorizontal ? w : h);
}
}
}
}
@ -162,7 +168,7 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfoW(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mi);
DWORD dwLength = 0;
TaskbarCenter_Center(hWnd, mi.rcMonitor, bIsTaskbarHorizontal);
TaskbarCenter_Center(hWnd, hWndTaskbar, mi.rcMonitor, bIsTaskbarHorizontal);
if (dwLength = GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME))
{
if (dwLength == -1)

View File

@ -189,7 +189,7 @@ DWORD S_Icon_Dark_Widgets = 0;
#include "ImmersiveFlyouts.h"
#include "updates.h"
DWORD dwUpdatePolicy = UPDATE_POLICY_DEFAULT;
wchar_t* EP_TASKBAR_LENGTH_PROP_NAME = _T("ExplorerPatcher_") _T(EP_CLSID) _T("_Length");
wchar_t* EP_TASKBAR_LENGTH_PROP_NAME = L"EPTBLEN";
HRESULT WINAPI _DllRegisterServer();
HRESULT WINAPI _DllUnregisterServer();