Browse Source

Taskbar10: Fixed #1009

pull/1080/head
Valentin Radu 4 years ago
parent
commit
a4c70364f5
  1. 10
      ExplorerPatcher/TaskbarCenter.c
  2. 2
      ExplorerPatcher/dllmain.c

10
ExplorerPatcher/TaskbarCenter.c

@ -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)

2
ExplorerPatcher/dllmain.c

@ -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();

Loading…
Cancel
Save