diff options
Diffstat (limited to 'src-qt5/core')
-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(); |