From c75b781d3fb4104540fc007b173b0dae75eaf5be Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 17 May 2022 17:13:07 -0500 Subject: [PATCH] Use SDL_WINDOWEVENT_DISPLAY_CHANGED on SDL 2.0.18+ --- app/streaming/session.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index c0cd24b7..ee331e59 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -1605,9 +1605,17 @@ void Session::execInternal() // Check that the window display hasn't changed. If it has, we want // to recreate the decoder to allow it to adapt to the new display. // This will allow Pacer to pull the new display refresh rate. +#if SDL_VERSION_ATLEAST(2, 0, 18) + // On SDL 2.0.18+, there's an event for this specific situation + if (event.window.event != SDL_WINDOWEVENT_DISPLAY_CHANGED) { + break; + } +#else + // Prior to SDL 2.0.18, we must check the display index for each window event if (SDL_GetWindowDisplayIndex(m_Window) == currentDisplayIndex) { break; } +#endif } #ifdef Q_OS_WIN32 // We can get a resize event after being minimized. Recreating the renderer at that time can cause