summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/swaylock.h2
-rw-r--r--password.c10
-rw-r--r--seat.c4
3 files changed, 10 insertions, 6 deletions
diff --git a/include/swaylock.h b/include/swaylock.h
index cd4e73e..0d5f3ae 100644
--- a/include/swaylock.h
+++ b/include/swaylock.h
@@ -133,7 +133,7 @@ struct swaylock_image {
};
void swaylock_handle_key(struct swaylock_state *state,
- xkb_keysym_t keysym, uint32_t codepoint);
+ xkb_keysym_t keysym, uint32_t codepoint, bool repeat);
void render(struct swaylock_surface *surface);
void damage_state(struct swaylock_state *state);
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
diff --git a/seat.c b/seat.c
index d503bd4..1a7e5fd 100644
--- a/seat.c
+++ b/seat.c
@@ -72,7 +72,7 @@ static void keyboard_repeat(void *data) {
struct swaylock_state *state = seat->state;
seat->repeat_timer = loop_add_timer(
state->eventloop, seat->repeat_period_ms, keyboard_repeat, seat);
- swaylock_handle_key(state, seat->repeat_sym, seat->repeat_codepoint);
+ swaylock_handle_key(state, seat->repeat_sym, seat->repeat_codepoint, true);
}
static void keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
@@ -89,7 +89,7 @@ static void keyboard_key(void *data, struct wl_keyboard *wl_keyboard,
key + 8 : 0;
uint32_t codepoint = xkb_state_key_get_utf32(state->xkb.state, keycode);
if (key_state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- swaylock_handle_key(state, sym, codepoint);
+ swaylock_handle_key(state, sym, codepoint, false);
}
stop_repeat(seat);