diff options
author | emersion <contact@emersion.fr> | 2018-05-25 19:34:36 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-05-27 13:39:38 +0100 |
commit | cc10c7af6528f6006e4fccbbdc2156b957cdd5c9 (patch) | |
tree | 5e1ebce0a9a71954679ade0676e3b7db01b018f2 /swaylock/password.c | |
parent | e4c54b04ce90d2d051ba7343ec5b9dce1bbb6755 (diff) |
swaylock: implement a proper render loop
Diffstat (limited to 'swaylock/password.c')
-rw-r--r-- | swaylock/password.c | 102 |
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; } } |