summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2017-03-20 18:51:29 +0100
committerSimon Rettberg2017-03-20 18:51:29 +0100
commitf46e61f09451e5c86c41e78a17158cf10393cd04 (patch)
treea9953c1717f51e6344092d896d9e67e2c7ebc105
parent[server] Prevent screen standby while clients are connected (diff)
downloadpvs2-f46e61f09451e5c86c41e78a17158cf10393cd04.tar.gz
pvs2-f46e61f09451e5c86c41e78a17158cf10393cd04.tar.xz
pvs2-f46e61f09451e5c86c41e78a17158cf10393cd04.zip
[server] Only block screen saver from running when first client connects
The screen saver lock is recursive, so if we call it for every client that connects, but only unlock once when the last client disconnects, the screen saver will be blocked forever. Fixes #3083
-rw-r--r--src/server/mainwindow/mainwindow.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp
index a984173..2eab581 100644
--- a/src/server/mainwindow/mainwindow.cpp
+++ b/src/server/mainwindow/mainwindow.cpp
@@ -210,12 +210,16 @@ void MainWindow::clientCountChanged()
_examModeLabel->setFixedHeight(e ? 400 : 0);
if (_lastClientCount != clientCount) {
+ // Client count actually changed
if (clientCount == 0) {
+ // Last client must have disconnected, enable screen saver again
ScreenSaver::allowSaverAndStandby(true);
- } else {
+ } else if (_lastClientCount == 0) {
+ // We didn't have a client before, but now we do, disable screen saver
ScreenSaver::forceUnlockAndScreenOn();
ScreenSaver::allowSaverAndStandby(false);
}
+ // Remember client count
_lastClientCount = clientCount;
}
}