From f46e61f09451e5c86c41e78a17158cf10393cd04 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 20 Mar 2017 18:51:29 +0100 Subject: [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 --- src/server/mainwindow/mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } } -- cgit v1.2.3-55-g7522