aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop/src-screensaver
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2020-05-04 09:59:13 -0400
committerKen Moore <moorekou@gmail.com>2020-05-04 10:00:26 -0400
commitf747ac87e16ae16343bcc6c40327eca92cffca07 (patch)
tree9ab2dd1b66f091780960f645f9f786ea496bd406 /src-qt5/core/lumina-desktop/src-screensaver
parentMerge pull request #725 from JohnBlood/patch-1 (diff)
downloadlumina-f747ac87e16ae16343bcc6c40327eca92cffca07.tar.gz
lumina-f747ac87e16ae16343bcc6c40327eca92cffca07.tar.bz2
lumina-f747ac87e16ae16343bcc6c40327eca92cffca07.zip
Get the screensaver system up and running.
The lockscreen prompt is disabled at the moment while testing some input detection mechanisms (unlock button just always works without verifying password)
Diffstat (limited to 'src-qt5/core/lumina-desktop/src-screensaver')
-rw-r--r--src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp7
-rw-r--r--src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp13
-rw-r--r--src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp2
3 files changed, 16 insertions, 6 deletions
diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp
index 2cfd0f4a..4253a115 100644
--- a/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp
+++ b/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp
@@ -45,6 +45,7 @@ void LLockScreen::aboutToHide(){
ui->line_password->clear();
ui->line_password->clearFocus();
if(refreshtime->isActive()){ refreshtime->stop(); }
+ ui->line_password->releaseKeyboard();
}
void LLockScreen::aboutToShow(){
@@ -59,6 +60,7 @@ void LLockScreen::aboutToShow(){
UpdateLockInfo();
ui->line_password->clear();
ui->line_password->setFocus();
+ ui->line_password->grabKeyboard();
}
// =================
@@ -85,9 +87,10 @@ void LLockScreen::TryUnlock(){
QTextStream in(TF);
in << pass.toUtf8()+"\0"; //make sure it is null-terminated
TF->close();
- //qDebug() << "Trying to unlock session:" << TF->fileName() << LUtils::readFile(TF->fileName());
- //qDebug() << "UserName:" << getlogin();
+ if(DEBUG){ qDebug() << "Trying to unlock session:" << getlogin(); }
LUtils::runCommand(ok, "lumina-checkpass",QStringList() << "-f" << TF->fileName() );
+ if(DEBUG){ qDebug() << " - Success:" << ok; }
+ ok = true; //bypass for the moment
}
delete TF; //ensure the temporary file is removed **right now** for security purposes
if(ok){
diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp
index 8cf78fdf..41ee7c4a 100644
--- a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp
+++ b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp
@@ -27,7 +27,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo
LOCKER->hide();
SSRunning = SSLocked = updating = false;
this->setObjectName("LSCREENSAVERBASE");
- this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: grey; }");
+ this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: darkgrey; }");
this->setMouseTracking(true);
connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) );
connect(locktimer, SIGNAL(timeout()), this, SLOT(LockScreen()) );
@@ -51,7 +51,10 @@ void LScreenSaver::UpdateTimers(){
if(locktimer->isActive()){ locktimer->stop(); }
if(hidetimer->isActive()){ hidetimer->stop(); }
- if(!SSRunning && !SSLocked && (starttimer->interval() > 1000) ){ starttimer->start(); } //time to SS start
+ if(!SSRunning && !SSLocked && (starttimer->interval() > 1000) ){
+ //time to SS start
+ if(LSession::handle()->XCB->WindowIsFullscreen(LSession::handle()->XCB->WM_Get_Active_Window()) ){ starttimer->start(); } //do not start if current window is fullscreen (videos, movies, etc)
+ }
else if( SSRunning && !SSLocked && (locktimer->interval() > 1000 ) ){ locktimer->start(); } //time to lock
else if( !SSRunning && SSLocked ){ hidetimer->start(); } //time to hide lock screen
}
@@ -114,11 +117,12 @@ void LScreenSaver::checkInputEvents(){
change = true;
}
//If there was an input event detected (or a window is currently full-screen), update timers and such
- if(change || LSession::handle()->XCB->WindowIsFullscreen(active) ){ newInputEvent(); }
+ if(change){ newInputEvent(); }
}
void LScreenSaver::ShowScreenSaver(){
if(DEBUG){ qDebug() << "Showing Screen Saver:" << QDateTime::currentDateTime().toString(); }
+ checkInputEvents(); //update all the internal times to now
//QApplication::setOverrideCursor(QCursor::BlankCursor);
SSRunning = true;
updating = true;
@@ -155,6 +159,7 @@ void LScreenSaver::ShowScreenSaver(){
BASES[i]->show();
BASES[i]->startPainting();
}
+ this->grabKeyboard();
updating = false;
UpdateTimers();
}
@@ -167,6 +172,7 @@ void LScreenSaver::ShowLockScreen(){
LOCKER->resize(LOCKER->sizeHint());
LOCKER->move(ctr - QPoint(LOCKER->width()/2, LOCKER->height()/2) );
LOCKER->show();
+ LOCKER->activateWindow();
//Start the timer for hiding the lock screen due to inactivity
UpdateTimers();
}
@@ -176,6 +182,7 @@ void LScreenSaver::HideScreenSaver(){
if(DEBUG){ qDebug() << "Hiding Screen Saver:" << QDateTime::currentDateTime().toString(); }
SSRunning = false;
//if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness
+ this->releaseKeyboard();
if(!SSLocked){
this->hide();
emit ClosingScreenSaver();
diff --git a/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp
index aa3214a2..840eb12a 100644
--- a/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp
+++ b/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp
@@ -10,7 +10,7 @@
//Relative directory to search along the XDG paths for screensavers
#define REL_DIR QString("/lumina-desktop/screensavers")
-#define DEBUG 0
+#define DEBUG 1
// ========
// PUBLIC
bgstack15