From 79a81d64397c68dd218b43b75b6c46fbddf4cb18 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler Date: Thu, 29 Feb 2024 10:46:55 +0100 Subject: [PATCH] input-field: show autentication failReason without additional input This makes it so that 1. The renderer is triggered when the onPasswordCheckTimer callback is fired. Previously you had to give an additional input for the renderer to be triggered and the fail reason to show. 2. The updateDots function now sets dots.currentAmout to 0, when a failID is present. That leads to the draw function to return false and the failReason to be displayed until another input happens. --- src/core/hyprlock.cpp | 4 ++++ src/renderer/widgets/PasswordInputField.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 0c3b012a..07005b98 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -638,6 +638,10 @@ void CHyprlock::onPasswordCheckTimer() { Debug::log(LOG, "Authentication failed: {}", m_sPasswordState.result->failReason); m_sPasswordState.lastFailReason = m_sPasswordState.result->failReason; m_sPasswordState.passBuffer = ""; + + for (auto& o : m_vOutputs) { + o->sessionLockSurface->render(); + } } m_sPasswordState.result.reset(); diff --git a/src/renderer/widgets/PasswordInputField.cpp b/src/renderer/widgets/PasswordInputField.cpp index c6547f17..a5b66e0b 100644 --- a/src/renderer/widgets/PasswordInputField.cpp +++ b/src/renderer/widgets/PasswordInputField.cpp @@ -77,6 +77,11 @@ void CPasswordInputField::updateDots() { dots.lastFrame = std::chrono::system_clock::now(); } + if (PASSLEN == 0 && !placeholder.failID.empty()) { + dots.currentAmount = PASSLEN; + return; + } + const auto DELTA = std::clamp((int)std::chrono::duration_cast(std::chrono::system_clock::now() - dots.lastFrame).count(), 0, 20000); const float TOADD = DELTA / 1000000.0 * dots.speedPerSecond;