Clear password on ctrl+backpace and ctrl+delete

This commit is contained in:
prezmop 2023-12-09 09:30:42 +01:00 committed by Simon Ser
parent 7cecd395a2
commit f2298bdbf7

View File

@ -141,6 +141,11 @@ void swaylock_handle_key(struct swaylock_state *state,
break; break;
case XKB_KEY_Delete: case XKB_KEY_Delete:
case XKB_KEY_BackSpace: case XKB_KEY_BackSpace:
if (state->xkb.control) {
clear_password_buffer(&state->password);
state->input_state = INPUT_STATE_CLEAR;
cancel_password_clear(state);
} else {
if (backspace(&state->password)) { if (backspace(&state->password)) {
state->input_state = INPUT_STATE_BACKSPACE; state->input_state = INPUT_STATE_BACKSPACE;
schedule_password_clear(state); schedule_password_clear(state);
@ -149,6 +154,7 @@ void swaylock_handle_key(struct swaylock_state *state,
state->input_state = INPUT_STATE_CLEAR; state->input_state = INPUT_STATE_CLEAR;
cancel_password_clear(state); cancel_password_clear(state);
} }
}
schedule_input_idle(state); schedule_input_idle(state);
damage_state(state); damage_state(state);
break; break;