aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified/src-screensaver
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2020-04-24 17:53:28 -0400
committerKen Moore <moorekou@gmail.com>2020-04-24 17:55:02 -0400
commitbf545b933bcb59a695702ecfcc7b1fa5f07fa557 (patch)
tree1030e63496788315e279b3c50f59ded8e370afb8 /src-qt5/core/lumina-desktop-unified/src-screensaver
parentDisable xscreensaver from auto-start. (diff)
downloadlumina-bf545b933bcb59a695702ecfcc7b1fa5f07fa557.tar.gz
lumina-bf545b933bcb59a695702ecfcc7b1fa5f07fa557.tar.bz2
lumina-bf545b933bcb59a695702ecfcc7b1fa5f07fa557.zip
Initial merge of the screensaver into the main lumina-desktop builds
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified/src-screensaver')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LLockScreen.h2
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.cpp27
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-screensaver/LScreenSaver.h5
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();
bgstack15