From c2e9c13b25804ee697bc50c7dfa5d0b810bfc5bf Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 31 Jul 2018 15:06:41 +0200 Subject: [SERVER] Fix locking when locked unicast is current mode Streaming source wasn't locked properly before --- src/client/util/platform/blankscreen.cpp | 5 +++-- src/server/mainwindow/mainwindow.cpp | 14 +++++++++----- src/server/net/client.cpp | 3 ++- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/util/platform/blankscreen.cpp b/src/client/util/platform/blankscreen.cpp index bf34614..5f9b04b 100644 --- a/src/client/util/platform/blankscreen.cpp +++ b/src/client/util/platform/blankscreen.cpp @@ -56,8 +56,9 @@ bool BlankScreen::lock(const QString& message) this->raise(); // grabbing of keyboard and mouse - XGrabKeyboard(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy) , false, GrabModeAsync, GrabModeAsync, CurrentTime); - XGrabPointer(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy) , false, 0, GrabModeAsync, GrabModeAsync, None, 0, CurrentTime); +# + XGrabKeyboard(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, GrabModeAsync, GrabModeAsync, CurrentTime); + XGrabPointer(_sysdep->dpy, DefaultRootWindow(_sysdep->dpy), false, 0, GrabModeAsync, GrabModeAsync, None, 0, CurrentTime); QProcess ungrabP; diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 73fcbaf..62e15d2 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -599,16 +599,19 @@ void MainWindow::reset(bool lock) { _mode = Mode::None; + // Stop server (Clients get stopped on ACK) + if (getClientFromId(_streamingSource) != nullptr) { + getClientFromId(_streamingSource)->stopVncServer(); + } + // Unlock all clients - for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) + for (QList::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { if ((*it)->client() != nullptr) { (*it)->client()->lockScreen(lock); (*it)->client()->removeAttention(); } + } - // Stop server (Clients get stopped on ACK) - if (getClientFromId(_streamingSource) != nullptr) - getClientFromId(_streamingSource)->stopVncServer(); } /* @@ -1219,7 +1222,8 @@ void MainWindow::onVncServerStateChange(Client* client) } } // Dont forget to unlock the vnc server (if necesarry) - client->lockScreen(client->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast); + client->lockScreen((client->desiredProjectionSource() == NO_SOURCE && _mode == Mode::LockedUnicast) + || ui->action_Lock->isChecked()); // If this was the current source remember that there is no source anymore and reset mode if (client == getClientFromId(_streamingSource)) { diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index 9b2101f..3920ef7 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -22,7 +22,7 @@ Client::Client(QTcpSocket* socket) : _socket(socket) assert(socket != nullptr); _authed = 0; _projectionSource = 0; - _desiredSource = 0; + _desiredSource = NO_SOURCE; _isActiveVncClient = false; _vncPort = 0; _isTutor = false; @@ -305,6 +305,7 @@ void Client::stopVncClient() msg.setField(_ID, _VNCCLIENT); sendMessage(msg); } + _desiredSource = NO_SOURCE; } /***************************************************************************//** -- cgit v1.2.3-55-g7522