From 31ebd85fe09701146b7275de1ec8c8e9ce3c15c6 Mon Sep 17 00:00:00 2001 From: Manuel Stoeckl Date: Tue, 2 May 2023 21:00:41 -0400 Subject: Separate input and auth state This commit establishes separate state machines for auth state (whether the password submitted is being verified or is wrong) and input state (typing indicators and clear message -- things relevant to the state of the password being typed in, before it is submitted.) This makes it possible to display the auth state while updating the input state (for example, show that the previously submitted password is 'verifying' or 'wrong' while typing another.) The two state machines interact only when submitting a password. There is some interference with the rendering code -- a 'cleared' message from the input state machine supersedes verifying/wrong messages from the auth state machine; although since the 'clear' state has a shorter timeout than the auth 'invalid' state, this is unlikely to hide the 'wrong' message. --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index ca89be7..fe018b5 100644 --- a/main.c +++ b/main.c @@ -1072,7 +1072,7 @@ static void comm_in(int fd, short mask, void *data) { state.run_display = false; } else { state.auth_state = AUTH_STATE_INVALID; - schedule_indicator_clear(&state); + schedule_auth_idle(&state); ++state.failed_attempts; damage_state(&state); } -- cgit v1.2.3