aboutsummaryrefslogtreecommitdiff
path: root/swaylock
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-10-13 17:06:33 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-10-15 00:26:27 +1000
commitf98f351a5275967c46482e1c9c754fee927d72ee (patch)
treeb94809766ed3a6a0a1523a2fcf3ff6988892403d /swaylock
parentfa11b7f7012d153ba9728fe718ffc1a2650d6e98 (diff)
swaylock: Don't wait too long for surface damage before verifying
Diffstat (limited to 'swaylock')
-rw-r--r--swaylock/password.c19
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) {
state->eventloop, 10000, clear_password, state);
}
+static void handle_preverify_timeout(int fd, short mask, void *data) {
+ struct swaylock_state *state = data;
+ state->verify_password_timer = NULL;
+}
+
void swaylock_handle_key(struct swaylock_state *state,
xkb_keysym_t keysym, uint32_t codepoint) {
switch (keysym) {
@@ -83,7 +88,18 @@ void swaylock_handle_key(struct swaylock_state *state,
state->auth_state = AUTH_STATE_VALIDATING;
damage_state(state);
- while (wl_display_dispatch(state->display) != -1 && state->run_display) {
+
+ // We generally want to wait until all surfaces are showing the
+ // "verifying" state before we go and verify the password, because
+ // verifying it is a blocking operation. However, if the surface is on
+ // an output with DPMS off then it won't update, so we set a timer.
+ state->verify_password_timer = loop_add_timer(
+ state->eventloop, 50, handle_preverify_timeout, state);
+
+ while (state->run_display && state->verify_password_timer) {
+ wl_display_flush(state->display);
+ loop_poll(state->eventloop);
+
bool ok = 1;
struct swaylock_surface *surface;
wl_list_for_each(surface, &state->surfaces, link) {
@@ -103,6 +119,7 @@ void swaylock_handle_key(struct swaylock_state *state,
}
state->auth_state = AUTH_STATE_INVALID;
damage_state(state);
+ schedule_indicator_clear(state);
break;
case XKB_KEY_Delete:
case XKB_KEY_BackSpace: