diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-04-24 16:30:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-24 16:30:54 +0200 |
commit | 5024f0888581cde0a9bc6b86222c14a97890b479 (patch) | |
tree | 35941cb448213c81a4956360af05c53537809ff5 /swaylock/password.c | |
parent | Merge pull request #1851 from RyanDwyer/container-descendants-crash (diff) | |
parent | Improved key handling in swaylock (diff) | |
download | sway-5024f0888581cde0a9bc6b86222c14a97890b479.tar.gz sway-5024f0888581cde0a9bc6b86222c14a97890b479.tar.zst sway-5024f0888581cde0a9bc6b86222c14a97890b479.zip |
Merge pull request #1848 from snaggen/improved_key_handling
Improved key handling in swaylock
Diffstat (limited to 'swaylock/password.c')
-rw-r--r-- | swaylock/password.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/swaylock/password.c b/swaylock/password.c index c8df3de8..1ad5cd81 100644 --- a/swaylock/password.c +++ b/swaylock/password.c | |||
@@ -105,11 +105,39 @@ void swaylock_handle_key(struct swaylock_state *state, | |||
105 | state->auth_state = AUTH_STATE_INVALID; | 105 | state->auth_state = AUTH_STATE_INVALID; |
106 | render_frames(state); | 106 | render_frames(state); |
107 | break; | 107 | break; |
108 | case XKB_KEY_Delete: | ||
108 | case XKB_KEY_BackSpace: | 109 | case XKB_KEY_BackSpace: |
109 | if (backspace(&state->password)) { | 110 | if (backspace(&state->password)) { |
110 | state->auth_state = AUTH_STATE_BACKSPACE; | 111 | state->auth_state = AUTH_STATE_BACKSPACE; |
111 | render_frames(state); | 112 | } else { |
113 | state->auth_state = AUTH_STATE_CLEAR; | ||
112 | } | 114 | } |
115 | render_frames(state); | ||
116 | break; | ||
117 | case XKB_KEY_Escape: | ||
118 | clear_password_buffer(&state->password); | ||
119 | state->auth_state = AUTH_STATE_CLEAR; | ||
120 | render_frames(state); | ||
121 | break; | ||
122 | case XKB_KEY_Caps_Lock: | ||
123 | /* The state is getting active after this | ||
124 | * so we need to manually toggle it */ | ||
125 | state->xkb.caps_lock = !state->xkb.caps_lock; | ||
126 | state->auth_state = AUTH_STATE_INPUT_NOP; | ||
127 | render_frames(state); | ||
128 | break; | ||
129 | case XKB_KEY_Shift_L: | ||
130 | case XKB_KEY_Shift_R: | ||
131 | case XKB_KEY_Control_L: | ||
132 | case XKB_KEY_Control_R: | ||
133 | case XKB_KEY_Meta_L: | ||
134 | case XKB_KEY_Meta_R: | ||
135 | case XKB_KEY_Alt_L: | ||
136 | case XKB_KEY_Alt_R: | ||
137 | case XKB_KEY_Super_L: | ||
138 | case XKB_KEY_Super_R: | ||
139 | state->auth_state = AUTH_STATE_INPUT_NOP; | ||
140 | render_frames(state); | ||
113 | break; | 141 | break; |
114 | default: | 142 | default: |
115 | if (codepoint) { | 143 | if (codepoint) { |