diff options
Diffstat (limited to 'swaylock/password.c')
-rw-r--r-- | swaylock/password.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/swaylock/password.c b/swaylock/password.c index 1ad5cd81..6d493309 100644 --- a/swaylock/password.c +++ b/swaylock/password.c | |||
@@ -93,58 +93,58 @@ static void append_ch(struct swaylock_password *pw, uint32_t codepoint) { | |||
93 | void swaylock_handle_key(struct swaylock_state *state, | 93 | void swaylock_handle_key(struct swaylock_state *state, |
94 | xkb_keysym_t keysym, uint32_t codepoint) { | 94 | xkb_keysym_t keysym, uint32_t codepoint) { |
95 | switch (keysym) { | 95 | switch (keysym) { |
96 | case XKB_KEY_KP_Enter: /* fallthrough */ | 96 | case XKB_KEY_KP_Enter: /* fallthrough */ |
97 | case XKB_KEY_Return: | 97 | case XKB_KEY_Return: |
98 | state->auth_state = AUTH_STATE_VALIDATING; | 98 | state->auth_state = AUTH_STATE_VALIDATING; |
99 | render_frames(state); | 99 | damage_state(state); |
100 | wl_display_roundtrip(state->display); | 100 | wl_display_roundtrip(state->display); |
101 | if (attempt_password(&state->password)) { | 101 | if (attempt_password(&state->password)) { |
102 | state->run_display = false; | 102 | state->run_display = false; |
103 | break; | ||
104 | } | ||
105 | state->auth_state = AUTH_STATE_INVALID; | ||
106 | render_frames(state); | ||
107 | break; | 103 | break; |
108 | case XKB_KEY_Delete: | 104 | } |
109 | case XKB_KEY_BackSpace: | 105 | state->auth_state = AUTH_STATE_INVALID; |
110 | if (backspace(&state->password)) { | 106 | damage_state(state); |
111 | state->auth_state = AUTH_STATE_BACKSPACE; | 107 | break; |
112 | } else { | 108 | case XKB_KEY_Delete: |
113 | state->auth_state = AUTH_STATE_CLEAR; | 109 | case XKB_KEY_BackSpace: |
114 | } | 110 | if (backspace(&state->password)) { |
115 | render_frames(state); | 111 | state->auth_state = AUTH_STATE_BACKSPACE; |
116 | break; | 112 | } else { |
117 | case XKB_KEY_Escape: | ||
118 | clear_password_buffer(&state->password); | ||
119 | state->auth_state = AUTH_STATE_CLEAR; | 113 | state->auth_state = AUTH_STATE_CLEAR; |
120 | render_frames(state); | 114 | } |
121 | break; | 115 | damage_state(state); |
122 | case XKB_KEY_Caps_Lock: | 116 | break; |
123 | /* The state is getting active after this | 117 | case XKB_KEY_Escape: |
124 | * so we need to manually toggle it */ | 118 | clear_password_buffer(&state->password); |
125 | state->xkb.caps_lock = !state->xkb.caps_lock; | 119 | state->auth_state = AUTH_STATE_CLEAR; |
126 | state->auth_state = AUTH_STATE_INPUT_NOP; | 120 | damage_state(state); |
127 | render_frames(state); | 121 | break; |
128 | break; | 122 | case XKB_KEY_Caps_Lock: |
129 | case XKB_KEY_Shift_L: | 123 | /* The state is getting active after this |
130 | case XKB_KEY_Shift_R: | 124 | * so we need to manually toggle it */ |
131 | case XKB_KEY_Control_L: | 125 | state->xkb.caps_lock = !state->xkb.caps_lock; |
132 | case XKB_KEY_Control_R: | 126 | state->auth_state = AUTH_STATE_INPUT_NOP; |
133 | case XKB_KEY_Meta_L: | 127 | damage_state(state); |
134 | case XKB_KEY_Meta_R: | 128 | break; |
135 | case XKB_KEY_Alt_L: | 129 | case XKB_KEY_Shift_L: |
136 | case XKB_KEY_Alt_R: | 130 | case XKB_KEY_Shift_R: |
137 | case XKB_KEY_Super_L: | 131 | case XKB_KEY_Control_L: |
138 | case XKB_KEY_Super_R: | 132 | case XKB_KEY_Control_R: |
139 | state->auth_state = AUTH_STATE_INPUT_NOP; | 133 | case XKB_KEY_Meta_L: |
140 | render_frames(state); | 134 | case XKB_KEY_Meta_R: |
141 | break; | 135 | case XKB_KEY_Alt_L: |
142 | default: | 136 | case XKB_KEY_Alt_R: |
143 | if (codepoint) { | 137 | case XKB_KEY_Super_L: |
144 | append_ch(&state->password, codepoint); | 138 | case XKB_KEY_Super_R: |
145 | state->auth_state = AUTH_STATE_INPUT; | 139 | state->auth_state = AUTH_STATE_INPUT_NOP; |
146 | render_frames(state); | 140 | damage_state(state); |
147 | } | 141 | break; |
148 | break; | 142 | default: |
143 | if (codepoint) { | ||
144 | append_ch(&state->password, codepoint); | ||
145 | state->auth_state = AUTH_STATE_INPUT; | ||
146 | damage_state(state); | ||
147 | } | ||
148 | break; | ||
149 | } | 149 | } |
150 | } | 150 | } |