Poll gamepad recovery even when SDL event queue is busy
Some checks are pending
Build / setup (push) Waiting to run
Build / build-appimage (push) Blocked by required conditions
Build / build-steamlink (push) Blocked by required conditions
Build / build-windows-macos (push) Blocked by required conditions

This commit is contained in:
Joey Yakimowich-Payne 2026-02-12 02:08:56 -07:00
commit bcb721bca3

View file

@ -2194,7 +2194,14 @@ void Session::exec()
// Hijack this thread to be the SDL main thread. We have to do this // Hijack this thread to be the SDL main thread. We have to do this
// because we want to suspend all Qt processing until the stream is over. // because we want to suspend all Qt processing until the stream is over.
SDL_Event event; SDL_Event event;
uint32_t nextGamepadPollTime = SDL_GetTicks();
for (;;) { for (;;) {
uint32_t now = SDL_GetTicks();
if (SDL_TICKS_PASSED(now, nextGamepadPollTime)) {
m_InputHandler->pollForMissingGamepads();
nextGamepadPollTime = now + 250;
}
#if SDL_VERSION_ATLEAST(2, 0, 18) && !defined(STEAM_LINK) #if SDL_VERSION_ATLEAST(2, 0, 18) && !defined(STEAM_LINK)
// SDL 2.0.18 has a proper wait event implementation that uses platform // SDL 2.0.18 has a proper wait event implementation that uses platform
// support to block on events rather than polling on Windows, macOS, X11, // support to block on events rather than polling on Windows, macOS, X11,
@ -2206,7 +2213,6 @@ void Session::exec()
// issues that could cause indefinite timeouts, delayed joystick detection, // issues that could cause indefinite timeouts, delayed joystick detection,
// and other problems. // and other problems.
if (!SDL_WaitEventTimeout(&event, 1000)) { if (!SDL_WaitEventTimeout(&event, 1000)) {
m_InputHandler->pollForMissingGamepads();
updateEffectiveAudioMuteState(); updateEffectiveAudioMuteState();
presence.runCallbacks(); presence.runCallbacks();
continue; continue;