From 28a0562d0303d3bf27fa292bc170661f4d0cb8a4 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 2 Aug 2018 14:42:29 +0200 Subject: [server] Don't restart VNC viewer if target stays the same --- src/server/mainwindow/mainwindow.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index a7648b9..9a28a55 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -1169,15 +1169,17 @@ void MainWindow::onVncServerStateChange(Client* client) if (client->isActiveVncServer()) { // apply the desired projection sources - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) - if ( (*it)->client() != nullptr) { // Ignore offline clients - if ( (*it)->client()->desiredProjectionSource() == client->id() ) - (*it)->client()->startVncClient(client); - else - (*it)->client()->stopVncClient(); - - (*it)->client()->lockScreen((*it)->client()->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast); + for (ConnectionFrame *frame : _clientFrames) { + if (frame->client() == nullptr) // Ignore offline clients + continue; + if (frame->client()->desiredProjectionSource() == client->id()) { + frame->client()->startVncClient(client); + client->lockScreen(false); + } + if (frame->client()->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast) { + frame->client()->lockScreen(true); } + } // Dont forget to unlock the vnc server client->lockScreen(false); } else { -- cgit v1.2.3-55-g7522