summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/server/mainwindow/mainwindow.cpp18
-rw-r--r--src/server/net/client.cpp2
2 files changed, 12 insertions, 8 deletions
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<ConnectionFrame*>::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 {
diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp
index 3920ef7..ad101a1 100644
--- a/src/server/net/client.cpp
+++ b/src/server/net/client.cpp
@@ -284,6 +284,8 @@ void Client::stopVncServer()
/******************************************************************************/
void Client::startVncClient(const Client * const to)
{
+ if (_projectionSource == to->_id)
+ return; // Already watching given target, do nothing
NetworkMessage msg;
msg.setField(_ID, _VNCCLIENT);
msg.setField("HOST", to->_socket->peerAddress().toString());