diff options
| author | Mattias Eriksson <snaggen@mayam.com> | 2018-04-20 14:46:30 +0200 |
|---|---|---|
| committer | Mattias Eriksson <snaggen@mayam.com> | 2018-04-24 15:40:30 +0200 |
| commit | 52e2575d19b641728cc4e33ca76442bd86620f74 (patch) | |
| tree | 1a6b06b066b23064251bf58fa95eb0e60597d0d6 /password.c | |
| parent | 780b15be32ae464235f61e55a95c694979b14f49 (diff) | |
Improved key handling in swaylock
Make escape clear buffer
Add indicator states for ctrl,shift,super et al
Add CapsLock indicator
Diffstat (limited to 'password.c')
| -rw-r--r-- | password.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -105,11 +105,39 @@ void swaylock_handle_key(struct swaylock_state *state, state->auth_state = AUTH_STATE_INVALID; render_frames(state); break; + case XKB_KEY_Delete: case XKB_KEY_BackSpace: if (backspace(&state->password)) { state->auth_state = AUTH_STATE_BACKSPACE; - render_frames(state); + } 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_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) { |
