summaryrefslogtreecommitdiff
path: root/password.c
diff options
context:
space:
mode:
Diffstat (limited to 'password.c')
-rw-r--r--password.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/password.c b/password.c
index a3e7674..aa3d101 100644
--- a/password.c
+++ b/password.c
@@ -93,6 +93,12 @@ static void submit_password(struct swaylock_state *state) {
damage_state(state);
}
+static void update_highlight(struct swaylock_state *state) {
+ // Advance a random amount between 1/4 and 3/4 of a full turn
+ state->highlight_start =
+ (state->highlight_start + (rand() % 1024) + 512) % 2048;
+}
+
void swaylock_handle_key(struct swaylock_state *state,
xkb_keysym_t keysym, uint32_t codepoint) {
// Ignore input events if validating
@@ -109,6 +115,7 @@ void swaylock_handle_key(struct swaylock_state *state,
case XKB_KEY_BackSpace:
if (backspace(&state->password)) {
state->auth_state = AUTH_STATE_BACKSPACE;
+ update_highlight(state);
} else {
state->auth_state = AUTH_STATE_CLEAR;
}
@@ -160,6 +167,7 @@ void swaylock_handle_key(struct swaylock_state *state,
if (codepoint) {
append_ch(&state->password, codepoint);
state->auth_state = AUTH_STATE_INPUT;
+ update_highlight(state);
damage_state(state);
schedule_indicator_clear(state);
schedule_password_clear(state);