summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-17 08:12:03 -0500
committerGitHub <noreply@github.com>2019-01-17 08:12:03 -0500
commit79dd99cb3c8c8de81c822be04442aeff597aea70 (patch)
treeb509cdf4456b212af4fc8c392838f29446cd5c35 /main.c
parentdb577f8e671fe65fd1d0b56f9d5ef4143f0752d1 (diff)
parentc77f0eb4ed6af1fad071be0113b3822b96b561aa (diff)
Merge pull request #19 from swaywm/async
Async password verification
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/main.c b/main.c
index 462316e..2f26c1a 100644
--- a/main.c
+++ b/main.c
@@ -17,6 +17,7 @@
#include <wordexp.h>
#include "background-image.h"
#include "cairo.h"
+#include "comm.h"
#include "log.h"
#include "loop.h"
#include "pool-buffer.h"
@@ -956,6 +957,17 @@ static void display_in(int fd, short mask, void *data) {
}
}
+static void comm_in(int fd, short mask, void *data) {
+ if (read_comm_reply()) {
+ // Authentication succeeded
+ state.run_display = false;
+ } else {
+ state.auth_state = AUTH_STATE_INVALID;
+ schedule_indicator_clear(&state);
+ damage_state(&state);
+ }
+}
+
int main(int argc, char **argv) {
swaylock_log_init(LOG_ERROR);
initialize_pw_backend();
@@ -1081,6 +1093,8 @@ int main(int argc, char **argv) {
loop_add_fd(state.eventloop, wl_display_get_fd(state.display), POLLIN,
display_in, NULL);
+ loop_add_fd(state.eventloop, get_comm_reply_fd(), POLLIN, comm_in, NULL);
+
state.run_display = true;
while (state.run_display) {
errno = 0;