Skip to content

Commit

Permalink
Delay sws creation until taskbar is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
valinet committed Dec 28, 2021
1 parent de581b6 commit 601f76a
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ HANDLE hWin11AltTabInitialized = NULL;
BYTE* lpShouldDisplayCCButton = NULL;
HMONITOR hMonitorList[30];
DWORD dwMonitorCount = 0;
HANDLE hCanStartSws = NULL;
int Code = 0;
HRESULT InjectStartFromExplorer();
void InvokeClockFlyout();
Expand Down Expand Up @@ -1388,6 +1389,7 @@ DWORD FixTaskbarAutohide(DWORD unused)
SHAppBarMessage(ABM_SETSTATE, &abd);
}
}
SetEvent(hCanStartSws);
}
#endif
#pragma endregion
Expand Down Expand Up @@ -3581,6 +3583,7 @@ DWORD SignalShellReady(DWORD wait)
printf(">>> Signal shell ready.\n");
SetEvent(hEvent);
}
SetEvent(hCanStartSws);

printf("Ended \"Signal shell ready\" thread.\n");
return 0;
Expand Down Expand Up @@ -3787,11 +3790,12 @@ void sws_ReadSettings(sws_WindowSwitcher* sws)

DWORD WindowSwitcher(DWORD unused)
{
WaitForSingleObject(hCanStartSws, INFINITE);
if (!bOldTaskbar)
{
WaitForSingleObject(hWin11AltTabInitialized, INFINITE);
Sleep(1000);
}
Sleep(1000);

while (TRUE)
{
Expand Down Expand Up @@ -6323,18 +6327,16 @@ DWORD Inject(BOOL bIsExplorer)
}

#ifdef _WIN64
if (bIsExplorer)
{
hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);
CreateThread(
0,
0,
WindowSwitcher,
0,
0,
0
);
}
hCanStartSws = CreateEventW(NULL, FALSE, FALSE, NULL);
hWin11AltTabInitialized = CreateEventW(NULL, FALSE, FALSE, NULL);
CreateThread(
0,
0,
WindowSwitcher,
0,
0,
0
);


#ifdef USE_PRIVATE_INTERFACES
Expand Down

0 comments on commit 601f76a

Please sign in to comment.