Poll gamepad recovery even when SDL event queue is busy
This commit is contained in:
parent
b03a4341e3
commit
bcb721bca3
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue