diff options
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
3 files changed, 24 insertions, 10 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h index 5470128a..147b0db8 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h @@ -7,7 +7,7 @@ #ifndef _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H #define _LUMINA_DESKTOP_LOCK_SCREEN_WIDGET_H -#include "global-includes.h" +#include "globals.h" namespace Ui{ class LLockScreen; 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 bd812744..cffde639 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp @@ -17,8 +17,10 @@ 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 + checkTimer = new QTimer(this); + checkTimer->setInterval(1500); //1.5 seconds + + lastTimeCode = 0; LOCKER = new LLockScreen(this); LOCKER->hide(); @@ -29,7 +31,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(checkTimer, SIGNAL(timeout()), this, SLOT(checkInputEvents()) ); connect(LOCKER, SIGNAL(ScreenUnlocked()), this, SLOT(SSFinished()) ); connect(LOCKER, SIGNAL(InputDetected()), this, SLOT(newInputEvent()) ); } @@ -59,7 +61,7 @@ void LScreenSaver::UpdateTimers(){ void LScreenSaver::start(){ reloadSettings(); //setup all the initial time frames starttimer->start(); - mouseCheckTimer->start(); + checkTimer->start(); } void LScreenSaver::reloadSettings(){ @@ -80,7 +82,6 @@ void LScreenSaver::newInputEvent(){ //Only running, not locked HideScreenSaver(); } - lastMousePos = QCursor::pos(); //update the internal point UpdateTimers(); } @@ -92,11 +93,23 @@ void LScreenSaver::LockScreenNow(){ // =========== // PRIVATE SLOTS // =========== -void LScreenSaver::checkMousePosition(){ +void LScreenSaver::checkInputEvents(){ + //Check mouse position first QPoint pos = QCursor::pos(); + bool change = false; if(pos != lastMousePos){ - newInputEvent(); //this will update the internal position automatically + lastMousePos = QCursor::pos(); //update the internal point + change = true; + } + //Check the last keyboard input timestamp + unsigned int timecode = LSession::instance()->XCB->WM_Get_User_Time( LSession::instance()->XCB->WM_Get_Active_Window() ); + //unsigned int timecode = 0; //Not done yet - read the _NET_WM_USER_TIME number on the active window + if(timecode > lastTimeCode){ + lastTimeCode = timecode; + change = true; } + //If there was an input event detected, update timers and such + if(change){ newInputEvent(); } } void LScreenSaver::ShowScreenSaver(){ 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 eec42481..71121e4e 100644 --- a/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h +++ b/src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h @@ -21,10 +21,11 @@ public: bool isLocked(); private: - QTimer *starttimer, *locktimer, *hidetimer, *mouseCheckTimer; + QTimer *starttimer, *locktimer, *hidetimer, *CheckTimer; QList<SSBaseWidget*> BASES; LLockScreen *LOCKER; QPoint lastMousePos; + unsigned int lastTimeCode; int cBright; bool SSRunning, SSLocked, updating; @@ -37,7 +38,7 @@ public slots: void LockScreenNow(); private slots: - void checkMousePosition(); + void checkInputEvents(); void ShowScreenSaver(); void ShowLockScreen(); void HideScreenSaver(); |