diff options
-rw-r--r-- | swaybar/bar.c | 5 | ||||
-rw-r--r-- | swaylock/main.c | 15 | ||||
-rw-r--r-- | swaylock/password.c | 6 |
3 files changed, 22 insertions, 4 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 88de8c04..08c386a7 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -415,7 +415,10 @@ void bar_run(struct swaybar *bar) { | |||
415 | status_in, bar); | 415 | status_in, bar); |
416 | } | 416 | } |
417 | while (1) { | 417 | while (1) { |
418 | wl_display_flush(bar->display); | 418 | errno = 0; |
419 | if (wl_display_flush(bar->display) == -1 && errno != EAGAIN) { | ||
420 | break; | ||
421 | } | ||
419 | loop_poll(bar->eventloop); | 422 | loop_poll(bar->eventloop); |
420 | } | 423 | } |
421 | } | 424 | } |
diff --git a/swaylock/main.c b/swaylock/main.c index f88663c2..9b74b671 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _POSIX_C_SOURCE 200112L | 2 | #define _POSIX_C_SOURCE 200112L |
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | #include <ctype.h> | 4 | #include <ctype.h> |
5 | #include <errno.h> | ||
5 | #include <fcntl.h> | 6 | #include <fcntl.h> |
6 | #include <getopt.h> | 7 | #include <getopt.h> |
7 | #include <stdbool.h> | 8 | #include <stdbool.h> |
@@ -844,7 +845,9 @@ static int load_config(char *path, struct swaylock_state *state, | |||
844 | static struct swaylock_state state; | 845 | static struct swaylock_state state; |
845 | 846 | ||
846 | static void display_in(int fd, short mask, void *data) { | 847 | static void display_in(int fd, short mask, void *data) { |
847 | wl_display_dispatch(state.display); | 848 | if (wl_display_dispatch(state.display) == -1) { |
849 | state.run_display = false; | ||
850 | } | ||
848 | } | 851 | } |
849 | 852 | ||
850 | int main(int argc, char **argv) { | 853 | int main(int argc, char **argv) { |
@@ -928,6 +931,11 @@ int main(int argc, char **argv) { | |||
928 | } | 931 | } |
929 | 932 | ||
930 | zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager); | 933 | zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager); |
934 | if (wl_display_roundtrip(state.display) == -1) { | ||
935 | wlr_log(WLR_ERROR, "Exiting - failed to inhibit input:" | ||
936 | " is another lockscreen already running?"); | ||
937 | return 2; | ||
938 | } | ||
931 | 939 | ||
932 | if (state.zxdg_output_manager) { | 940 | if (state.zxdg_output_manager) { |
933 | struct swaylock_surface *surface; | 941 | struct swaylock_surface *surface; |
@@ -959,7 +967,10 @@ int main(int argc, char **argv) { | |||
959 | 967 | ||
960 | state.run_display = true; | 968 | state.run_display = true; |
961 | while (state.run_display) { | 969 | while (state.run_display) { |
962 | wl_display_flush(state.display); | 970 | errno = 0; |
971 | if (wl_display_flush(state.display) == -1 && errno != EAGAIN) { | ||
972 | break; | ||
973 | } | ||
963 | loop_poll(state.eventloop); | 974 | loop_poll(state.eventloop); |
964 | } | 975 | } |
965 | 976 | ||
diff --git a/swaylock/password.c b/swaylock/password.c index fecaecbf..6138e1fe 100644 --- a/swaylock/password.c +++ b/swaylock/password.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #define _XOPEN_SOURCE 500 | 1 | #define _XOPEN_SOURCE 500 |
2 | #include <assert.h> | 2 | #include <assert.h> |
3 | #include <errno.h> | ||
3 | #include <pwd.h> | 4 | #include <pwd.h> |
4 | #include <stdlib.h> | 5 | #include <stdlib.h> |
5 | #include <string.h> | 6 | #include <string.h> |
@@ -97,7 +98,10 @@ void swaylock_handle_key(struct swaylock_state *state, | |||
97 | state->eventloop, 50, handle_preverify_timeout, state); | 98 | state->eventloop, 50, handle_preverify_timeout, state); |
98 | 99 | ||
99 | while (state->run_display && state->verify_password_timer) { | 100 | while (state->run_display && state->verify_password_timer) { |
100 | wl_display_flush(state->display); | 101 | errno = 0; |
102 | if (wl_display_flush(state->display) == -1 && errno != EAGAIN) { | ||
103 | break; | ||
104 | } | ||
101 | loop_poll(state->eventloop); | 105 | loop_poll(state->eventloop); |
102 | 106 | ||
103 | bool ok = 1; | 107 | bool ok = 1; |