From 1c9cf62b9d6772b1aa5712cae91665cbd29642f1 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Fri, 25 Apr 2014 13:13:07 +0200 Subject: Now handling the _desiredProjectionSource correctly --- src/server/net/client.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index f3cbc0d..047bd05 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -215,16 +215,19 @@ void Client::handleMsg() _activeVncClient = (_fromClient.getFieldString("ENABLED").toInt() != 0); const int other = (int)_fromClient.getFieldString("CLIENTID").toInt(); - int last = (_currentProjectionSource != 0 ? _currentProjectionSource : _desiredProjectionSource); + const int last = _activeVncClient ? _currentProjectionSource : other; if (!_activeVncClient) { + if (other == _desiredProjectionSource) + _desiredProjectionSource = 0; _currentProjectionSource = 0; - _desiredProjectionSource = 0; qDebug() << "Client " << _name << " stopped its VNC client (watched " << last << ")"; } else { + if (other == _desiredProjectionSource) + _desiredProjectionSource = 0; _currentProjectionSource = other; qDebug() << "Client " << _name << " started its VNC client (watching " << other << ")"; } @@ -334,7 +337,10 @@ void Client::disconnect() { if (_timerDelete == 0) { + // Order of the follwing 3 is important emit disconnected(); + emit vncClientStateChange(this, _currentProjectionSource); + emit vncServerStateChange(this); _timerDelete = startTimer(500); qDebug("*** Client %s disconnected.", qPrintable(_ip)); _socket->blockSignals(true); -- cgit v1.2.3-55-g7522