summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2018-08-02 14:42:29 +0200
committerSimon Rettberg2018-08-02 14:42:29 +0200
commit28a0562d0303d3bf27fa292bc170661f4d0cb8a4 (patch)
tree33fe509b5df0802c1973177c292113a8257b064d
parent[server] Improved disabling of toolbar buttons depending on context (diff)
downloadpvs2-28a0562d0303d3bf27fa292bc170661f4d0cb8a4.tar.gz
pvs2-28a0562d0303d3bf27fa292bc170661f4d0cb8a4.tar.xz
pvs2-28a0562d0303d3bf27fa292bc170661f4d0cb8a4.zip
[server] Don't restart VNC viewer if target stays the same
-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());