Skip to content

Commit

Permalink
add more exits
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGantner committed Sep 8, 2024
1 parent 12f5a02 commit 6293749
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,23 +650,24 @@ int main(int argc, char *argv[]) {
};

state.run = true;
int timeout;
while (state.run) {
errno = 0;
do {
if (wl_display_flush(state.display) == -1 && errno != EAGAIN) {
fprintf(stderr, "wl_display_flush: %s\n", strerror(errno));
break;
exit(8);
}
} while (errno == EAGAIN);

int timeout = -1;
timeout = -1;
if (state.keys) {
timeout = 100;
}

if (poll(pollfds, sizeof(pollfds) / sizeof(pollfds[0]), timeout) < 0) {
fprintf(stderr, "poll: %s\n", strerror(errno));
break;
exit(9);
}

/* Clear out old keys */
Expand All @@ -687,7 +688,7 @@ int main(int argc, char *argv[]) {
if ((pollfds[0].revents & POLLIN)) {
if (libinput_dispatch(state.libinput) != 0) {
fprintf(stderr, "libinput_dispatch: %s\n", strerror(errno));
break;
exit(10);
}
struct libinput_event *event;
while ((event = libinput_get_event(state.libinput))) {
Expand All @@ -699,7 +700,7 @@ int main(int argc, char *argv[]) {
if ((pollfds[1].revents & POLLIN)
&& wl_display_dispatch(state.display) == -1) {
fprintf(stderr, "wl_display_dispatch: %s\n", strerror(errno));
break;
exit(11);
}
}
return 0;
Expand Down

0 comments on commit 6293749

Please sign in to comment.