From 7fdffc46c2330195070fdf87bd43e4bab9fa3d59 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Tue, 22 Jul 2014 16:05:47 +0200 Subject: Fix oneclick-source-change-lock-bug --- src/server/mainwindow/mainwindow.cpp | 52 ++++++++++++------------------------ 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'src/server/mainwindow/mainwindow.cpp') diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 1425640..7c484bb 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -312,18 +312,16 @@ void MainWindow::savePosition(ConnectionFrame *cf) void MainWindow::tellClientCurrentSituation(Client* client) { // If clients are currently locked, tell this new client - if (ui->action_Lock->isChecked()) + if (ui->action_Lock->isChecked() || _mode == Mode::LockedUnicast) client->lockScreen(true); if (_mode == Mode::Broadcast){ client->setDesiredProjectionSource(_streamingSource); - Client* c = getClientFromId(_streamingSource); - if (c != NULL) { - client->startVncClient(c); + if (_streamingSource != 0) { + client->startVncClient(getClientFromId(_streamingSource)); } } - else if (_mode == Mode::LockedUnicast) - client->lockScreen(true); + } @@ -1054,37 +1052,16 @@ void MainWindow::onVncServerStateChange(Client* client) if (client->isActiveVncServer()) { -// if (_mode == Mode::Broadcast) -// { -// for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) -// { -// if ((*it)->client() != NULL) -// { -// // Unlock all online clients -// (*it)->client()->lockScreen(false); - -// // Start VNCclients on all online clients but source -// if ((*it)->client() != client) -// (*it)->client()->startVncClient(client); -// } -// } -// } -// else - { - // apply the desired projection sources - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + // apply the desired projection sources + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + if ( (*it)->client() != NULL) // Ignore offline clients { - // Ignore offline clients - if ( (*it)->client() != NULL) - { - qDebug() << "ID" <<(*it)->client()->id() << "ds" << (*it)->client()->desiredProjectionSource() <<"ps"<< (*it)->client()->projectionSource(); - if ( (*it)->client()->desiredProjectionSource() == client->id() ) - (*it)->client()->startVncClient(client); - - (*it)->client()->lockScreen((*it)->client()->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast); - } + if ( (*it)->client()->desiredProjectionSource() == client->id() ) + (*it)->client()->startVncClient(client); + (*it)->client()->lockScreen((*it)->client()->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast); } - } + // Dont forget to unlock the vnc server + client->lockScreen(false); } else { @@ -1101,6 +1078,11 @@ void MainWindow::onVncServerStateChange(Client* client) } } } + // If this was the current source remember that there is no source anymore + if (client == getClientFromId(_streamingSource)) + _streamingSource = NO_SOURCE; + // Dont forget to unlock the vnc server (if necesarry) + client->lockScreen(client->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast); } } -- cgit v1.2.3-55-g7522