1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2025-02-22 13:20:21 +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); 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; HRESULT hr = S_OK;
VARIANT vtChild[10]; VARIANT vtChild[10];
@ -98,17 +98,23 @@ HRESULT TaskbarCenter_Center(HWND hWnd, RECT rc, BOOL bIsTaskbarHorizontal)
hr == E_FAIL; hr == E_FAIL;
} }
else else
{
if (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))
{ {
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top)))); SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, (bIsTaskbarHorizontal ? (d - (x - rc.left)) : (d - (y - rc.top))));
} }
} }
}
else else
{
if (!((GetKeyState(VK_LBUTTON) < 0) && (GetForegroundWindow() == hWndTaskbar)))
{ {
SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, bIsTaskbarHorizontal ? w : h); SetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME, bIsTaskbarHorizontal ? w : h);
} }
} }
} }
} }
}
pChild->lpVtbl->Release(pChild); pChild->lpVtbl->Release(pChild);
} }
pDisp->lpVtbl->Release(pDisp); pDisp->lpVtbl->Release(pDisp);
@ -162,7 +168,7 @@ BOOL TaskbarCenter_GetClientRectHook(HWND hWnd, LPRECT lpRect)
mi.cbSize = sizeof(MONITORINFO); mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfoW(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mi); GetMonitorInfoW(MonitorFromWindow(hWnd, MONITOR_DEFAULTTOPRIMARY), &mi);
DWORD dwLength = 0; 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 = GetPropW(hWnd, EP_TASKBAR_LENGTH_PROP_NAME))
{ {
if (dwLength == -1) if (dwLength == -1)

View File

@ -189,7 +189,7 @@ DWORD S_Icon_Dark_Widgets = 0;
#include "ImmersiveFlyouts.h" #include "ImmersiveFlyouts.h"
#include "updates.h" #include "updates.h"
DWORD dwUpdatePolicy = UPDATE_POLICY_DEFAULT; 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 _DllRegisterServer();
HRESULT WINAPI _DllUnregisterServer(); HRESULT WINAPI _DllUnregisterServer();