Don't start polling from the GUI for a CLI launch

We can end up missing early computerStateChanged signals.

Fixes #2039
This commit is contained in:
Cameron Gutman committed 2026-10-22 19:28:12 -05:00
1 parent dc92b6d2f3
commit 74020b537b
2 files changed
+10 -2

No files matched your search

+9 -1
View File
@@ -51,7 +51,7 @@ ApplicationWindow {
} }
// Display any modal dialogs for configuration warnings // Display any modal dialogs for configuration warnings
if (runConfigChecks) { if (isGuiLaunch) {
if (SystemProperties.isWow64) { if (SystemProperties.isWow64) {
wow64Dialog.open() wow64Dialog.open()
} }
@@ -171,6 +171,9 @@ ApplicationWindow {
} }
onVisibleChanged: { onVisibleChanged: {
// 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, // When we become invisible while streaming is going on,
// stop polling immediately. // stop polling immediately.
if (!visible) { if (!visible) {
@@ -191,12 +194,16 @@ ApplicationWindow {
pollingActive = true pollingActive = true
} }
} }
}
// Poll for gamepad input only when the window is in focus // Poll for gamepad input only when the window is in focus
SdlGamepadKeyNavigation.notifyWindowFocus(visible && active) SdlGamepadKeyNavigation.notifyWindowFocus(visible && active)
} }
onActiveChanged: { onActiveChanged: {
// 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) { if (active) {
// Stop the inactivity timer // Stop the inactivity timer
inactivityTimer.stop() inactivityTimer.stop()
@@ -212,6 +219,7 @@ ApplicationWindow {
// if focus does not return within a few minutes. // if focus does not return within a few minutes.
inactivityTimer.restart() inactivityTimer.restart()
} }
}
// Poll for gamepad input only when the window is in focus // Poll for gamepad input only when the window is in focus
SdlGamepadKeyNavigation.notifyWindowFocus(visible && active) SdlGamepadKeyNavigation.notifyWindowFocus(visible && active)
+1 -1
View File
@@ -1034,7 +1034,7 @@ int main(int argc, char *argv[])
if (hasGUI) { if (hasGUI) {
engine.rootContext()->setContextProperty("initialView", initialView); engine.rootContext()->setContextProperty("initialView", initialView);
engine.rootContext()->setContextProperty("runConfigChecks", commandLineParserResult == GlobalCommandLineParser::NormalStartRequested); engine.rootContext()->setContextProperty("isGuiLaunch", commandLineParserResult == GlobalCommandLineParser::NormalStartRequested);
// Load the main.qml file // Load the main.qml file
engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml"))); engine.load(QUrl(QStringLiteral("qrc:/gui/main.qml")));