aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-05-26 09:48:14 -0400
committerDrew DeVault <sir@cmpwn.com>2016-05-26 09:48:14 -0400
commitbcbef246d277c224d863e840a930895d009eaa55 (patch)
tree10e60af2771a32e372c07885bf1908e74e08e245
parent508f481fbb0cc8d079da9038e1599eec2cbb874d (diff)
parent06e06f9af2132cda9c26a2464486393e0ea76e28 (diff)
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
}
break;
}
+ case XKB_KEY_Control_L: // fallthrough
+ case XKB_KEY_Control_R: // fallthrough
+ case XKB_KEY_Shift_L: // fallthrough
+ case XKB_KEY_Shift_R: // fallthrough
+ case XKB_KEY_Caps_Lock: // fallthrough
+ case XKB_KEY_Shift_Lock: // fallthrough
+ case XKB_KEY_Meta_L: // fallthrough
+ case XKB_KEY_Meta_R: // fallthrough
+ case XKB_KEY_Alt_L: // fallthrough
+ case XKB_KEY_Alt_R: // fallthrough
+ case XKB_KEY_Super_L: // fallthrough
+ case XKB_KEY_Super_R: // fallthrough
+ case XKB_KEY_Hyper_L: // fallthrough
+ case XKB_KEY_Hyper_R: // fallthrough
+ {
+ // don't draw screen on modifier keys
+ break;
+ }
+ case XKB_KEY_Escape: // fallthrough
+ case XKB_KEY_u: // fallthrough
+ case XKB_KEY_U:
+ {
+ // clear password buffer on ctrl-u (or escape for i3lock compatibility)
+ if (sym == XKB_KEY_Escape || xkb_state_mod_name_is_active(registry->input->xkb.state,
+ XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0) {
+ render_data.auth_state = AUTH_STATE_BACKSPACE;
+ redraw_screen = 1;
+
+ password_size = 1024;
+ free(password);
+ password = malloc(password_size);
+ password[0] = '\0';
+ break;
+ }
+ }
default:
{
render_data.auth_state = AUTH_STATE_INPUT;