mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-15 21:22:40 +00:00
Only use SDL_WaitEventTimeout() on SDL 2.0.18+
This commit is contained in:
@@ -1443,11 +1443,16 @@ void Session::execInternal()
|
|||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
Sint32 lastResizeW = -1, lastResizeH = -1;
|
Sint32 lastResizeW = -1, lastResizeH = -1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 16) && !defined(STEAM_LINK)
|
#if SDL_VERSION_ATLEAST(2, 0, 18) && !defined(STEAM_LINK)
|
||||||
// SDL 2.0.16 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, and
|
// support to block on events rather than polling on Windows, macOS, X11,
|
||||||
// X11. It will fall back to 1 ms polling if a joystick is connected, so
|
// and Wayland. It will fall back to 1 ms polling if a joystick is
|
||||||
// we don't use it for STEAM_LINK to ensure we only poll every 10 ms.
|
// connected, so we don't use it for STEAM_LINK to ensure we only poll
|
||||||
|
// every 10 ms.
|
||||||
|
//
|
||||||
|
// NB: This behavior was introduced in SDL 2.0.16, but had a few critical
|
||||||
|
// issues that could cause indefinite timeouts, delayed joystick detection,
|
||||||
|
// and other problems.
|
||||||
if (!SDL_WaitEventTimeout(&event, 1000)) {
|
if (!SDL_WaitEventTimeout(&event, 1000)) {
|
||||||
presence.runCallbacks();
|
presence.runCallbacks();
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user