diff options
author | Ken Moore <ken@ixsystems.com> | 2018-01-24 15:30:30 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-01-24 15:30:30 -0500 |
commit | 21e61d5ed001a3859edd30c43e34304f53b6235f (patch) | |
tree | 4c714b0aa876011567702c4eb0c92d88cd14be96 /src-qt5 | |
parent | Another large checkpoint on the OSInterface framework for Lumina 2. (diff) | |
download | lumina-21e61d5ed001a3859edd30c43e34304f53b6235f.tar.gz lumina-21e61d5ed001a3859edd30c43e34304f53b6235f.tar.bz2 lumina-21e61d5ed001a3859edd30c43e34304f53b6235f.zip |
Add a quick 10-second failover timer to LScreensaver:
This will do a quick probe of the mouse position to ensure it has/not moved just in case we missed the events.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp | 12 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp index a0edde9f..bd812744 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp @@ -17,6 +17,8 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo locktimer->setSingleShot(true); hidetimer = new QTimer(this); hidetimer->setSingleShot(true); + mouseCheckTimer = new QTimer(this); + mouseCheckTimer->setInterval(10000); //10 seconds - fallback timer for mouse movement detection LOCKER = new LLockScreen(this); LOCKER->hide(); @@ -27,6 +29,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); connect(locktimer, SIGNAL(timeout()), this, SLOT(LockScreen()) ); connect(hidetimer, SIGNAL(timeout()), this, SLOT(HideLockScreen()) ); + connect(mouseCheckTimer, SIGNAL(timeout()), this, SLOT(checkMousePosition()) ); connect(LOCKER, SIGNAL(ScreenUnlocked()), this, SLOT(SSFinished()) ); connect(LOCKER, SIGNAL(InputDetected()), this, SLOT(newInputEvent()) ); } @@ -56,6 +59,7 @@ void LScreenSaver::UpdateTimers(){ void LScreenSaver::start(){ reloadSettings(); //setup all the initial time frames starttimer->start(); + mouseCheckTimer->start(); } void LScreenSaver::reloadSettings(){ @@ -76,6 +80,7 @@ void LScreenSaver::newInputEvent(){ //Only running, not locked HideScreenSaver(); } + lastMousePos = QCursor::pos(); //update the internal point UpdateTimers(); } @@ -87,6 +92,13 @@ void LScreenSaver::LockScreenNow(){ // =========== // PRIVATE SLOTS // =========== +void LScreenSaver::checkMousePosition(){ + QPoint pos = QCursor::pos(); + if(pos != lastMousePos){ + newInputEvent(); //this will update the internal position automatically + } +} + void LScreenSaver::ShowScreenSaver(){ if(DEBUG){ qDebug() << "Showing Screen Saver:" << QDateTime::currentDateTime().toString(); } //QApplication::setOverrideCursor(QCursor::BlankCursor); diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h index 2276fb6d..eec42481 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h @@ -21,9 +21,10 @@ public: bool isLocked(); private: - QTimer *starttimer, *locktimer, *hidetimer; + QTimer *starttimer, *locktimer, *hidetimer, *mouseCheckTimer; QList<SSBaseWidget*> BASES; LLockScreen *LOCKER; + QPoint lastMousePos; int cBright; bool SSRunning, SSLocked, updating; @@ -36,6 +37,7 @@ public slots: void LockScreenNow(); private slots: + void checkMousePosition(); void ShowScreenSaver(); void ShowLockScreen(); void HideScreenSaver(); |