diff options
author | ache <ache@ache.one> | 2022-11-06 22:57:49 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2022-11-06 22:57:49 +0100 |
commit | a5653831fc650efbeb8333f2c8312d43b66b6470 (patch) | |
tree | 9d778f9d3b45053b8a235caaf1565a471fb75e54 | |
parent | Increase spinner speed (diff) |
-rw-r--r-- | src/main.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -111,6 +111,7 @@ static void handle_xsl_key_input(saver_state_t *state, const char c) // (See comment above for why this is separate) static bool handle_key_event(saver_state_t *state, XKeyEvent *event) { + static int forceEmptyPass = 0; if (!state->input_allowed) return false; KeySym key; @@ -126,7 +127,14 @@ static bool handle_key_event(saver_state_t *state, XKeyEvent *event) password_buf[length - 1] = '\0'; } } else if (XK_Return == key) { - accept_password(state); + char *password_buf = state->password_buffer; + size_t pw_len = strlen(password_buf); + + if( pw_len > 0 || forceEmptyPass) { + accept_password(state); + } else { + forceEmptyPass = 4; + } } else if (strlen(keybuf) > 0) { if (length + 1 < kMaxPasswordLength) { password_buf[length] = keybuf[0]; @@ -136,6 +144,8 @@ static bool handle_key_event(saver_state_t *state, XKeyEvent *event) handled = false; } + forceEmptyPass >>= 1; + return handled; } |