1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-12-01 02:27:18 +01:00

Delay sws creation until taskbar is initialized

This commit is contained in:
Valentin Radu 2021-12-28 19:52:52 +02:00
parent de581b6097
commit 601f76ad49

View File

@ -93,6 +93,7 @@ HANDLE hWin11AltTabInitialized = NULL;
BYTE* lpShouldDisplayCCButton = NULL; BYTE* lpShouldDisplayCCButton = NULL;
HMONITOR hMonitorList[30]; HMONITOR hMonitorList[30];
DWORD dwMonitorCount = 0; DWORD dwMonitorCount = 0;
HANDLE hCanStartSws = NULL;
int Code = 0; int Code = 0;
HRESULT InjectStartFromExplorer(); HRESULT InjectStartFromExplorer();
void InvokeClockFlyout(); void InvokeClockFlyout();
@ -1388,6 +1389,7 @@ DWORD FixTaskbarAutohide(DWORD unused)
SHAppBarMessage(ABM_SETSTATE, &abd); SHAppBarMessage(ABM_SETSTATE, &abd);
} }
} }
SetEvent(hCanStartSws);
} }
#endif #endif
#pragma endregion #pragma endregion
@ -3581,6 +3583,7 @@ DWORD SignalShellReady(DWORD wait)
printf(">>> Signal shell ready.\n"); printf(">>> Signal shell ready.\n");
SetEvent(hEvent); SetEvent(hEvent);
} }
SetEvent(hCanStartSws);
printf("Ended \"Signal shell ready\" thread.\n"); printf("Ended \"Signal shell ready\" thread.\n");
return 0; return 0;
@ -3787,11 +3790,12 @@ void sws_ReadSettings(sws_WindowSwitcher* sws)
DWORD WindowSwitcher(DWORD unused) DWORD WindowSwitcher(DWORD unused)
{ {
WaitForSingleObject(hCanStartSws, INFINITE);
if (!bOldTaskbar) if (!bOldTaskbar)
{ {
WaitForSingleObject(hWin11AltTabInitialized, INFINITE); WaitForSingleObject(hWin11AltTabInitialized, INFINITE);
Sleep(1000);
} }
Sleep(1000);
while (TRUE) while (TRUE)
{ {
@ -6323,8 +6327,7 @@ DWORD Inject(BOOL bIsExplorer)
} }
#ifdef _WIN64 #ifdef _WIN64
if (bIsExplorer) hCanStartSws = CreateEventW(NULL, FALSE, FALSE, NULL);
{
hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL); hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);
CreateThread( CreateThread(
0, 0,
@ -6334,7 +6337,6 @@ DWORD Inject(BOOL bIsExplorer)
0, 0,
0 0
); );
}
#ifdef USE_PRIVATE_INTERFACES #ifdef USE_PRIVATE_INTERFACES