aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-05-26 09:48:14 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-05-26 09:48:14 -0400
commitbcbef246d277c224d863e840a930895d009eaa55 (patch)
tree10e60af2771a32e372c07885bf1908e74e08e245
parentMerge pull request #671 from zandrmartin/fullscreen-focus (diff)
parentclear swaylock password buffer with esc (diff)
downloadsway-bcbef246d277c224d863e840a930895d009eaa55.tar.gz
sway-bcbef246d277c224d863e840a930895d009eaa55.tar.zst
sway-bcbef246d277c224d863e840a930895d009eaa55.zip
Merge pull request #672 from zandrmartin/add-ctrlu-to-swaylock
clear password buffer with ctrl-u in swaylock
-rw-r--r--swaylock/main.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/swaylock/main.c b/swaylock/main.c
index 777bca09..666e59d2 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -144,6 +144,41 @@ void notify_key(enum wl_keyboard_key_state state, xkb_keysym_t sym, uint32_t cod
144 } 144 }
145 break; 145 break;
146 } 146 }
147 case XKB_KEY_Control_L: // fallthrough
148 case XKB_KEY_Control_R: // fallthrough
149 case XKB_KEY_Shift_L: // fallthrough
150 case XKB_KEY_Shift_R: // fallthrough
151 case XKB_KEY_Caps_Lock: // fallthrough
152 case XKB_KEY_Shift_Lock: // fallthrough
153 case XKB_KEY_Meta_L: // fallthrough
154 case XKB_KEY_Meta_R: // fallthrough
155 case XKB_KEY_Alt_L: // fallthrough
156 case XKB_KEY_Alt_R: // fallthrough
157 case XKB_KEY_Super_L: // fallthrough
158 case XKB_KEY_Super_R: // fallthrough
159 case XKB_KEY_Hyper_L: // fallthrough
160 case XKB_KEY_Hyper_R: // fallthrough
161 {
162 // don't draw screen on modifier keys
163 break;
164 }
165 case XKB_KEY_Escape: // fallthrough
166 case XKB_KEY_u: // fallthrough
167 case XKB_KEY_U:
168 {
169 // clear password buffer on ctrl-u (or escape for i3lock compatibility)
170 if (sym == XKB_KEY_Escape || xkb_state_mod_name_is_active(registry->input->xkb.state,
171 XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0) {
172 render_data.auth_state = AUTH_STATE_BACKSPACE;
173 redraw_screen = 1;
174
175 password_size = 1024;
176 free(password);
177 password = malloc(password_size);
178 password[0] = '\0';
179 break;
180 }
181 }
147 default: 182 default:
148 { 183 {
149 render_data.auth_state = AUTH_STATE_INPUT; 184 render_data.auth_state = AUTH_STATE_INPUT;