From 9c1b3e72ad664d145fd5802da5a7432b788d0814 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 10 Feb 2017 15:41:10 +0100 Subject: [client] Periodically bring vnc and lock window to top --- src/client/util/platform/blankscreen.h | 3 +++ src/client/util/platform/blankscreen_X11.cpp | 12 ++++++++++++ src/client/vnc/vncwindow.cpp | 14 +++++++++++++- src/client/vnc/vncwindow.h | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/client/util/platform/blankscreen.h b/src/client/util/platform/blankscreen.h index 24c4969..8d8c9de 100644 --- a/src/client/util/platform/blankscreen.h +++ b/src/client/util/platform/blankscreen.h @@ -21,6 +21,9 @@ private: bool _locked; QString _message; BlankScreen_Sysdep* _sysdep; + +private slots: + void timer_moveToTop(); }; #endif diff --git a/src/client/util/platform/blankscreen_X11.cpp b/src/client/util/platform/blankscreen_X11.cpp index 1f36f89..ee644ca 100644 --- a/src/client/util/platform/blankscreen_X11.cpp +++ b/src/client/util/platform/blankscreen_X11.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,9 @@ BlankScreen::BlankScreen() : QDialog(NULL) setStyleSheet("background-color:#000"); _locked = false; + QTimer *upper = new QTimer(this); + connect(upper, SIGNAL(timeout()), this, SLOT(timer_moveToTop())); + upper->start(1111); } BlankScreen::~BlankScreen() @@ -86,3 +90,11 @@ bool BlankScreen::unlock() _locked = false; return true; } + +void BlankScreen::timer_moveToTop() +{ + if (this->isHidden()) + return; + activateWindow(); + raise(); +} diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp index b7690b8..0854f01 100644 --- a/src/client/vnc/vncwindow.cpp +++ b/src/client/vnc/vncwindow.cpp @@ -19,10 +19,14 @@ #include "vncthread.h" #include "../clientapp/clientapp.h" +#include + VncWindow::VncWindow(QWidget *parent) : QWidget(parent), _vncWorker(NULL), _viewOnly(true), _clientId(0), _redrawTimer(0), _tcpTimeoutTimer(0) { - // + QTimer *upper = new QTimer(this); + connect(upper, SIGNAL(timeout()), this, SLOT(timer_moveToTop())); + upper->start(1111); } VncWindow::~VncWindow() @@ -193,6 +197,14 @@ void VncWindow::onProjectionStopped() this->close(); } +void VncWindow::timer_moveToTop() +{ + if (this->isHidden()) + return; + activateWindow(); + raise(); +} + //////////////////////////////////////////////////////////////////////////////// // Protected /** diff --git a/src/client/vnc/vncwindow.h b/src/client/vnc/vncwindow.h index 2cb9ad0..29f2e98 100644 --- a/src/client/vnc/vncwindow.h +++ b/src/client/vnc/vncwindow.h @@ -31,6 +31,7 @@ protected slots: void onUpdateImage(const int x, const int y, const int w, const int h); void onProjectionStarted(); void onProjectionStopped(); + void timer_moveToTop(); void open(const QString& host, int port, const QString& passwd, bool ro, bool fullscreen, const QString& caption, const int clientId, const QByteArray& rawThumb); // bool close(); -- cgit v1.2.3-55-g7522