diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index 80fb921b..b6f1a025 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -902,27 +902,35 @@ bool Session::initialize() return false; } + // Display launch warnings in Qt only after destroying SDL's window. + // This avoids conflicts between the windows on display subsystems + // such as KMSDRM that only support a single window. + for (const auto &text : m_LaunchWarnings) { + // Emit the warning to the UI + emit displayLaunchWarning(text); + + // Wait a little bit so the user can actually read what we just said. + // This wait is a little longer than the actual toast timeout (3 seconds) + // to allow it to transition off the screen before continuing. + uint32_t start = SDL_GetTicks(); + while (!SDL_TICKS_PASSED(SDL_GetTicks(), start + 3500)) { + SDL_Delay(5); + + if (!m_ThreadedExec) { + // Pump the UI loop while we wait if we're on the main thread + QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); + QCoreApplication::sendPostedEvents(); + } + } + } + return true; } void Session::emitLaunchWarning(QString text) { - // Emit the warning to the UI - emit displayLaunchWarning(text); - - // Wait a little bit so the user can actually read what we just said. - // This wait is a little longer than the actual toast timeout (3 seconds) - // to allow it to transition off the screen before continuing. - uint32_t start = SDL_GetTicks(); - while (!SDL_TICKS_PASSED(SDL_GetTicks(), start + 3500)) { - SDL_Delay(5); - - if (!m_ThreadedExec) { - // Pump the UI loop while we wait if we're on the main thread - QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); - QCoreApplication::sendPostedEvents(); - } - } + // Queue this launch warning to be displayed after validation + m_LaunchWarnings.append(text); } bool Session::validateLaunch(SDL_Window* testWindow) diff --git a/app/streaming/session.h b/app/streaming/session.h index 4547f1ba..95858437 100644 --- a/app/streaming/session.h +++ b/app/streaming/session.h @@ -260,6 +260,7 @@ private: SdlInputHandler* m_InputHandler; int m_MouseEmulationRefCount; int m_FlushingWindowEventsRef; + QList m_LaunchWarnings; bool m_AsyncConnectionSuccess; int m_PortTestResults;