clear_pam_wrong_timeout = NULL;
}
+static void clear_input(void) {
+ input_position = 0;
+ clear_password_memory();
+ password[input_position] = '\0';
+
+ /* Hide the unlock indicator after a bit if the password buffer is
+ * empty. */
+ start_clear_indicator_timeout();
+ unlock_state = STATE_BACKSPACE_ACTIVE;
+ redraw_screen();
+ unlock_state = STATE_KEY_PRESSED;
+}
+
static void input_done(void) {
if (clear_pam_wrong_timeout) {
ev_timer_stop(main_loop, clear_pam_wrong_timeout);
fprintf(stderr, "Authentication failure\n");
pam_state = STATE_PAM_WRONG;
+ clear_input();
redraw_screen();
/* Clear this state after 2 seconds (unless the user enters another
xkb_keysym_t ksym;
char buffer[128];
int n;
+ bool ctrl;
ksym = xkb_state_key_get_one_sym(xkb_state, event->detail);
+ ctrl = xkb_state_mod_name_is_active(xkb_state, "Control", XKB_STATE_MODS_DEPRESSED);
xkb_state_update_key(xkb_state, event->detail, XKB_KEY_DOWN);
/* The buffer will be null-terminated, so n >= 2 for 1 actual character. */
unlock_state = STATE_KEY_PRESSED;
redraw_screen();
input_done();
- case XKB_KEY_Escape:
- input_position = 0;
- clear_password_memory();
- password[input_position] = '\0';
+ return;
- /* Hide the unlock indicator after a bit if the password buffer is
- * empty. */
- start_clear_indicator_timeout();
- unlock_state = STATE_BACKSPACE_ACTIVE;
- redraw_screen();
- unlock_state = STATE_KEY_PRESSED;
+ case XKB_KEY_u:
+ if (ctrl)
+ clear_input();
+ return;
+
+ case XKB_KEY_Escape:
+ clear_input();
return;
case XKB_KEY_BackSpace: