diff options
Diffstat (limited to 'swaylock/password.c')
-rw-r--r-- | swaylock/password.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/swaylock/password.c b/swaylock/password.c index 5ab50042..3f9949b2 100644 --- a/swaylock/password.c +++ b/swaylock/password.c | |||
@@ -72,6 +72,11 @@ static void schedule_password_clear(struct swaylock_state *state) { | |||
72 | state->eventloop, 10000, clear_password, state); | 72 | state->eventloop, 10000, clear_password, state); |
73 | } | 73 | } |
74 | 74 | ||
75 | static void handle_preverify_timeout(int fd, short mask, void *data) { | ||
76 | struct swaylock_state *state = data; | ||
77 | state->verify_password_timer = NULL; | ||
78 | } | ||
79 | |||
75 | void swaylock_handle_key(struct swaylock_state *state, | 80 | void swaylock_handle_key(struct swaylock_state *state, |
76 | xkb_keysym_t keysym, uint32_t codepoint) { | 81 | xkb_keysym_t keysym, uint32_t codepoint) { |
77 | switch (keysym) { | 82 | switch (keysym) { |
@@ -83,7 +88,18 @@ void swaylock_handle_key(struct swaylock_state *state, | |||
83 | 88 | ||
84 | state->auth_state = AUTH_STATE_VALIDATING; | 89 | state->auth_state = AUTH_STATE_VALIDATING; |
85 | damage_state(state); | 90 | damage_state(state); |
86 | while (wl_display_dispatch(state->display) != -1 && state->run_display) { | 91 | |
92 | // We generally want to wait until all surfaces are showing the | ||
93 | // "verifying" state before we go and verify the password, because | ||
94 | // verifying it is a blocking operation. However, if the surface is on | ||
95 | // an output with DPMS off then it won't update, so we set a timer. | ||
96 | state->verify_password_timer = loop_add_timer( | ||
97 | state->eventloop, 50, handle_preverify_timeout, state); | ||
98 | |||
99 | while (state->run_display && state->verify_password_timer) { | ||
100 | wl_display_flush(state->display); | ||
101 | loop_poll(state->eventloop); | ||
102 | |||
87 | bool ok = 1; | 103 | bool ok = 1; |
88 | struct swaylock_surface *surface; | 104 | struct swaylock_surface *surface; |
89 | wl_list_for_each(surface, &state->surfaces, link) { | 105 | wl_list_for_each(surface, &state->surfaces, link) { |
@@ -103,6 +119,7 @@ void swaylock_handle_key(struct swaylock_state *state, | |||
103 | } | 119 | } |
104 | state->auth_state = AUTH_STATE_INVALID; | 120 | state->auth_state = AUTH_STATE_INVALID; |
105 | damage_state(state); | 121 | damage_state(state); |
122 | schedule_indicator_clear(state); | ||
106 | break; | 123 | break; |
107 | case XKB_KEY_Delete: | 124 | case XKB_KEY_Delete: |
108 | case XKB_KEY_BackSpace: | 125 | case XKB_KEY_BackSpace: |