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
+37 -29

No files matched your search

+36 -28
View File
@@ -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
+1 -1
View File
@@ -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")));