summaryrefslogtreecommitdiff
path: root/password.c
diff options
context:
space:
mode:
authorMartin Trojer <martin.trojer@gmail.com>2026-10-29 06:58:01 +0000
committerSimon Ser <contact@emersion.fr>2026-10-29 08:11:12 +0100
commit6ad9ebf3e14deac54a298c10df3e8701061fe495 (patch)
tree1d39dfef4d0f3c2407778572a465ec6a6c8757ba /password.c
parent711bbd9de97ff3df672690042000df9f753ab8bd (diff)
seat: don't repeat password submission
Thread a bool repeat flag from the key-repeat timer into swaylock_handle_key (real presses pass false) and skip submit_password on repeats, so holding Return/KP_Enter or Ctrl-D/J/M no longer sends repeated attempts to PAM. Repeats of other keys are unchanged, and the submit keys stay defined in one place (password.c).
Diffstat (limited to 'password.c')
-rw-r--r--password.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/password.c b/password.c
index 59f28c7..00eeaa5 100644
--- a/password.c
+++ b/password.c
@@ -135,12 +135,14 @@ static void update_highlight(struct swaylock_state *state) {
}
void swaylock_handle_key(struct swaylock_state *state,
- xkb_keysym_t keysym, uint32_t codepoint) {
+ xkb_keysym_t keysym, uint32_t codepoint, bool repeat) {
switch (keysym) {
case XKB_KEY_KP_Enter: /* fallthrough */
case XKB_KEY_Return:
- submit_password(state);
+ if (!repeat) {
+ submit_password(state);
+ }
break;
case XKB_KEY_Delete:
case XKB_KEY_BackSpace:
@@ -188,7 +190,9 @@ void swaylock_handle_key(struct swaylock_state *state,
case XKB_KEY_d:
case XKB_KEY_j:
if (state->xkb.control) {
- submit_password(state);
+ if (!repeat) {
+ submit_password(state);
+ }
break;
}
// fallthrough