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.
This commit is contained in:
Maximilian Seidler 2024-02-29 14:34:27 +00:00 committed by GitHub
parent 4aeea1d580
commit ac757cf7ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -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();

View File

@ -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::microseconds>(std::chrono::system_clock::now() - dots.lastFrame).count(), 0, 20000);
const float TOADD = DELTA / 1000000.0 * dots.speedPerSecond;