diff --git a/app/gui/main.qml b/app/gui/main.qml index 84e7d9de..b57c1256 100644 --- a/app/gui/main.qml +++ b/app/gui/main.qml @@ -51,7 +51,7 @@ ApplicationWindow { } // Display any modal dialogs for configuration warnings - if (runConfigChecks) { + if (isGuiLaunch) { if (SystemProperties.isWow64) { wow64Dialog.open() } @@ -171,24 +171,28 @@ ApplicationWindow { } onVisibleChanged: { - // When we become invisible while streaming is going on, - // stop polling immediately. - if (!visible) { - inactivityTimer.stop() + // Polling is only managed from the window for a normal GUI launch; + // CLI commands (stream/quit/pair) manage it via the ComputerSeeker. + if (isGuiLaunch) { + // When we become invisible while streaming is going on, + // stop polling immediately. + if (!visible) { + inactivityTimer.stop() - if (pollingActive) { - ComputerManager.stopPollingAsync() - pollingActive = false + if (pollingActive) { + ComputerManager.stopPollingAsync() + pollingActive = false + } } - } - else if (active) { - // When we become visible and active again, start polling - inactivityTimer.stop() + else if (active) { + // When we become visible and active again, start polling + inactivityTimer.stop() - // Restart polling if it was stopped - if (!pollingActive) { - ComputerManager.startPolling() - pollingActive = true + // Restart polling if it was stopped + if (!pollingActive) { + ComputerManager.startPolling() + pollingActive = true + } } } @@ -197,20 +201,24 @@ ApplicationWindow { } onActiveChanged: { - if (active) { - // Stop the inactivity timer - inactivityTimer.stop() + // Polling is only managed from the window for a normal GUI launch; + // CLI commands (stream/quit/pair) manage it via the ComputerSeeker. + if (isGuiLaunch) { + if (active) { + // Stop the inactivity timer + inactivityTimer.stop() - // Restart polling if it was stopped - if (!pollingActive) { - ComputerManager.startPolling() - pollingActive = true + // Restart polling if it was stopped + if (!pollingActive) { + ComputerManager.startPolling() + pollingActive = true + } + } + else { + // Start the inactivity timer to stop polling + // if focus does not return within a few minutes. + inactivityTimer.restart() } - } - else { - // Start the inactivity timer to stop polling - // if focus does not return within a few minutes. - inactivityTimer.restart() } // Poll for gamepad input only when the window is in focus diff --git a/app/main.cpp b/app/main.cpp index 2b701d71..7ec0cca9 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1034,7 +1034,7 @@ int main(int argc, char *argv[]) if (hasGUI) { engine.rootContext()->setContextProperty("initialView", initialView); - engine.rootContext()->setContextProperty("runConfigChecks", commandLineParserResult == GlobalCommandLineParser::NormalStartRequested); + engine.rootContext()->setContextProperty("isGuiLaunch", commandLineParserResult == GlobalCommandLineParser::NormalStartRequested); // Load the main.qml file engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml")));