aboutsummaryrefslogtreecommitdiff
path: root/swaylock/password.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaylock/password.c')
-rw-r--r--swaylock/password.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/swaylock/password.c b/swaylock/password.c
index 1ad5cd81..6d493309 100644
--- a/swaylock/password.c
+++ b/swaylock/password.c
@@ -93,58 +93,58 @@ static void append_ch(struct swaylock_password *pw, uint32_t codepoint) {
void swaylock_handle_key(struct swaylock_state *state,
xkb_keysym_t keysym, uint32_t codepoint) {
switch (keysym) {
- case XKB_KEY_KP_Enter: /* fallthrough */
- case XKB_KEY_Return:
- state->auth_state = AUTH_STATE_VALIDATING;
- render_frames(state);
- wl_display_roundtrip(state->display);
- if (attempt_password(&state->password)) {
- state->run_display = false;
- break;
- }
- state->auth_state = AUTH_STATE_INVALID;
- render_frames(state);
+ case XKB_KEY_KP_Enter: /* fallthrough */
+ case XKB_KEY_Return:
+ state->auth_state = AUTH_STATE_VALIDATING;
+ damage_state(state);
+ wl_display_roundtrip(state->display);
+ if (attempt_password(&state->password)) {
+ state->run_display = false;
break;
- case XKB_KEY_Delete:
- case XKB_KEY_BackSpace:
- if (backspace(&state->password)) {
- state->auth_state = AUTH_STATE_BACKSPACE;
- } else {
- state->auth_state = AUTH_STATE_CLEAR;
- }
- render_frames(state);
- break;
- case XKB_KEY_Escape:
- clear_password_buffer(&state->password);
+ }
+ state->auth_state = AUTH_STATE_INVALID;
+ damage_state(state);
+ break;
+ case XKB_KEY_Delete:
+ case XKB_KEY_BackSpace:
+ if (backspace(&state->password)) {
+ state->auth_state = AUTH_STATE_BACKSPACE;
+ } else {
state->auth_state = AUTH_STATE_CLEAR;
- render_frames(state);
- break;
- case XKB_KEY_Caps_Lock:
- /* The state is getting active after this
- * so we need to manually toggle it */
- state->xkb.caps_lock = !state->xkb.caps_lock;
- state->auth_state = AUTH_STATE_INPUT_NOP;
- render_frames(state);
- break;
- case XKB_KEY_Shift_L:
- case XKB_KEY_Shift_R:
- case XKB_KEY_Control_L:
- case XKB_KEY_Control_R:
- case XKB_KEY_Meta_L:
- case XKB_KEY_Meta_R:
- case XKB_KEY_Alt_L:
- case XKB_KEY_Alt_R:
- case XKB_KEY_Super_L:
- case XKB_KEY_Super_R:
- state->auth_state = AUTH_STATE_INPUT_NOP;
- render_frames(state);
- break;
- default:
- if (codepoint) {
- append_ch(&state->password, codepoint);
- state->auth_state = AUTH_STATE_INPUT;
- render_frames(state);
- }
- break;
+ }
+ damage_state(state);
+ break;
+ case XKB_KEY_Escape:
+ clear_password_buffer(&state->password);
+ state->auth_state = AUTH_STATE_CLEAR;
+ damage_state(state);
+ break;
+ case XKB_KEY_Caps_Lock:
+ /* The state is getting active after this
+ * so we need to manually toggle it */
+ state->xkb.caps_lock = !state->xkb.caps_lock;
+ state->auth_state = AUTH_STATE_INPUT_NOP;
+ damage_state(state);
+ break;
+ case XKB_KEY_Shift_L:
+ case XKB_KEY_Shift_R:
+ case XKB_KEY_Control_L:
+ case XKB_KEY_Control_R:
+ case XKB_KEY_Meta_L:
+ case XKB_KEY_Meta_R:
+ case XKB_KEY_Alt_L:
+ case XKB_KEY_Alt_R:
+ case XKB_KEY_Super_L:
+ case XKB_KEY_Super_R:
+ state->auth_state = AUTH_STATE_INPUT_NOP;
+ damage_state(state);
+ break;
+ default:
+ if (codepoint) {
+ append_ch(&state->password, codepoint);
+ state->auth_state = AUTH_STATE_INPUT;
+ damage_state(state);
+ }
+ break;
}
}