summaryrefslogtreecommitdiffstats
path: root/src/loginform.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/loginform.cpp')
-rw-r--r--src/loginform.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/loginform.cpp b/src/loginform.cpp
index d4f8abd..8badf4e 100644
--- a/src/loginform.cpp
+++ b/src/loginform.cpp
@@ -92,14 +92,20 @@ void LoginForm::initialize()
});
// timer to reset the form to its original state
- resetFormTimer.setInterval(Settings::resetForm() != 0 ?
- Settings::resetForm() * 1000 : 30000); // default to 30s
- connect(&resetFormTimer, &QTimer::timeout, this, [this]() {
- long idleTime = static_cast<long>(getIdleTime(QX11Info::display()));
- if (idleTime > Settings::resetForm() * 1000l)
- resetForm();
- });
- resetFormTimer.start();
+ if (Settings::resetForm() != 0) {
+ resetFormTimer.setInterval(Settings::resetForm());
+ connect(&resetFormTimer, &QTimer::timeout, this, [this]() {
+ int idleTime = static_cast<int>(getIdleTime(QX11Info::display()));
+ int remaining = Settings::resetForm() * 1000 - idleTime;
+ if (remaining <= 0) {
+ resetForm();
+ remaining = Settings::resetForm() * 1000;
+ }
+ resetFormTimer.start(remaining + 100);
+
+ });
+ resetFormTimer.start();
+ }
if (!Global::testMode()) {
ui->hostnameLabel->setText(Global::greeter()->hostname());