diff options
Diffstat (limited to 'swaylock/main.c')
-rw-r--r-- | swaylock/main.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index 8ed8adf5..ebc2b263 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> |
@@ -841,7 +842,9 @@ static int load_config(char *path, struct swaylock_state *state, | |||
841 | static struct swaylock_state state; | 842 | static struct swaylock_state state; |
842 | 843 | ||
843 | static void display_in(int fd, short mask, void *data) { | 844 | static void display_in(int fd, short mask, void *data) { |
844 | wl_display_dispatch(state.display); | 845 | if (wl_display_dispatch(state.display) == -1) { |
846 | state.run_display = false; | ||
847 | } | ||
845 | } | 848 | } |
846 | 849 | ||
847 | int main(int argc, char **argv) { | 850 | int main(int argc, char **argv) { |
@@ -961,7 +964,10 @@ int main(int argc, char **argv) { | |||
961 | 964 | ||
962 | state.run_display = true; | 965 | state.run_display = true; |
963 | while (state.run_display) { | 966 | while (state.run_display) { |
964 | wl_display_flush(state.display); | 967 | errno = 0; |
968 | if (wl_display_flush(state.display) == -1 && errno != EAGAIN) { | ||
969 | break; | ||
970 | } | ||
965 | loop_poll(state.eventloop); | 971 | loop_poll(state.eventloop); |
966 | } | 972 | } |
967 | 973 | ||