Skip to content

Commit 05f4dba

Browse files
authored
Merge ea9851f into a280fa9
2 parents a280fa9 + ea9851f commit 05f4dba

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ static SIZE g_TaskbarTextureSize;
6767
static TTaskbarTile g_TaskbarTileH, g_TaskbarTileV;
6868
static RECT g_TaskbarMargins;
6969
int g_CurrentCSMTaskbar=-1, g_CurrentWSMTaskbar=-1;
70+
// ExplorerPatcher taskbar
71+
static bool g_epTaskbar = false;
7072

7173
static void FindWindowsMenu( void );
7274
static void RecreateStartButton( size_t taskbarId );
@@ -1342,7 +1344,7 @@ static void UpdateStartButtonPosition(const TaskbarInfo* taskBar, const WINDOWPO
13421344

13431345
// Start button on Win11 is a bit shifted to the right
13441346
// We will shift our Aero button to cover original button
1345-
if (IsWin11() && (x == info.rcMonitor.left) && (GetStartButtonType() == START_BUTTON_AERO))
1347+
if (IsWin11() && (x == info.rcMonitor.left) && (GetStartButtonType() == START_BUTTON_AERO) && !g_epTaskbar)
13461348
x += ScaleForDpi(taskBar->taskBar, 6);
13471349
}
13481350

@@ -2772,6 +2774,17 @@ static void WINAPI SHFillRectClr2( HDC hdc, const RECT *pRect, COLORREF color )
27722774
g_SHFillRectClr(hdc,pRect,color);
27732775
}
27742776

2777+
static IatHookData* g_ExtTextOutWHook = nullptr;
2778+
2779+
// used by ExplorerPatcher's custom implementation of `SHFillRectClr`
2780+
static BOOL WINAPI ExtTextOutW2(HDC hdc, int X, int Y, UINT fuOptions, const RECT* lprc, LPCWSTR lpString, UINT cbCount, const INT* lpDx)
2781+
{
2782+
if (!g_CurrentTaskList || !g_TaskbarTexture || GetCurrentThreadId() != g_TaskbarThreadId)
2783+
return ExtTextOutW(hdc, X, Y, fuOptions, lprc, lpString, cbCount, lpDx);
2784+
2785+
return FALSE;
2786+
}
2787+
27752788
static HRESULT STDAPICALLTYPE DrawThemeBackground2( HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCRECT pRect, LPCRECT pClipRect )
27762789
{
27772790
if (g_CurrentTaskList && g_TaskbarTexture && iPartId==1 && iStateId==0 && GetCurrentThreadId()==g_TaskbarThreadId)
@@ -2956,6 +2969,12 @@ static void InitStartMenuDLL( void )
29562969
if (GetSettingBool(L"CustomTaskbar"))
29572970
{
29582971
auto module=GetModuleHandle(L"taskbar.dll");
2972+
if (!module)
2973+
{
2974+
module = GetModuleHandle(L"ep_taskbar.5.dll");
2975+
if (module)
2976+
g_epTaskbar = true;
2977+
}
29592978
if (!module)
29602979
module=GetModuleHandle(NULL);
29612980

@@ -2975,6 +2994,10 @@ static void InitStartMenuDLL( void )
29752994
g_StretchDIBitsHook=SetIatHook(module,"gdi32.dll","StretchDIBits",StretchDIBits2);
29762995
if (!g_StretchDIBitsHook)
29772996
g_StretchDIBitsHook=SetIatHook(module,"ext-ms-win-gdi-draw-l1-1-0.dll","StretchDIBits",StretchDIBits2);
2997+
2998+
// ExplorerPatcher compatibility
2999+
if (g_epTaskbar)
3000+
g_ExtTextOutWHook = SetIatHook(module, "gdi32.dll", "ExtTextOutW", ExtTextOutW2);
29783001
}
29793002

29803003
{
@@ -3204,6 +3227,7 @@ static void RecreateStartButton( size_t taskbarId )
32043227
{
32053228
RECT rc;
32063229
GetWindowRect(btn,&rc);
3230+
MapWindowPoints(NULL,taskBar.taskBar,(POINT*)&rc,2); // convert to taskbar coordinates
32073231
SetWindowPos(btn,HWND_TOP,rc.left,rc.top,0,0,SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOZORDER);
32083232
}
32093233
}
@@ -3230,6 +3254,8 @@ static void CleanStartMenuDLL( void )
32303254
g_SHFillRectClrHook=NULL;
32313255
ClearIatHook(g_StretchDIBitsHook);
32323256
g_StretchDIBitsHook=NULL;
3257+
ClearIatHook(g_ExtTextOutWHook);
3258+
g_ExtTextOutWHook = NULL;
32333259

32343260
ClearIatHook(g_DrawThemeBackgroundHook);
32353261
g_DrawThemeBackgroundHook=NULL;

0 commit comments

Comments
 (0)