From ac757cf7aba53870da09bcc280ad5e32d355587b Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Thu, 29 Feb 2024 14:34:27 +0000 Subject: [PATCH] input-field: show autentication failReason without additional input (#98) 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 0c3b012..07005b9 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 c6547f1..a5b66e0 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;