mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
terminal: no need to check for EAGAIN - we don't use non-blocking
This commit is contained in:
parent
dac1ba18c8
commit
2286bcf23d
1 changed files with 10 additions and 18 deletions
28
terminal.c
28
terminal.c
|
|
@ -40,9 +40,6 @@ fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
|
|||
ssize_t count = read(term->ptmx, buf, sizeof(buf));
|
||||
|
||||
if (count < 0) {
|
||||
if (errno == EAGAIN)
|
||||
return true;
|
||||
|
||||
LOG_ERRNO("failed to read from pseudo terminal");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -116,9 +113,6 @@ fdm_flash(struct fdm *fdm, int fd, int events, void *data)
|
|||
term->flash.fd, &expiration_count, sizeof(expiration_count));
|
||||
|
||||
if (ret < 0) {
|
||||
if (errno == EAGAIN)
|
||||
return true;
|
||||
|
||||
LOG_ERRNO("failed to read flash timer");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -144,9 +138,6 @@ fdm_blink(struct fdm *fdm, int fd, int events, void *data)
|
|||
term->blink.fd, &expiration_count, sizeof(expiration_count));
|
||||
|
||||
if (ret < 0) {
|
||||
if (errno == EAGAIN)
|
||||
return true;
|
||||
|
||||
LOG_ERRNO("failed to read blink timer");
|
||||
return false;
|
||||
}
|
||||
|
|
@ -192,17 +183,18 @@ fdm_delayed_render(struct fdm *fdm, int fd, int events, void *data)
|
|||
if (fd == term->delayed_render_timer.upper_fd)
|
||||
ret2 = read(term->delayed_render_timer.upper_fd, &unused, sizeof(unused));
|
||||
|
||||
if ((ret1 < 0 || ret2 < 0) && errno != EAGAIN)
|
||||
if ((ret1 < 0 || ret2 < 0)) {
|
||||
LOG_ERRNO("failed to read timeout timer");
|
||||
else if (ret1 > 0 || ret2 > 0) {
|
||||
render_refresh(term);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reset timers */
|
||||
term->delayed_render_timer.is_armed = false;
|
||||
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &(struct itimerspec){.it_value = {0}}, NULL);
|
||||
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &(struct itimerspec){.it_value = {0}}, NULL);
|
||||
} else
|
||||
assert(false);
|
||||
render_refresh(term);
|
||||
|
||||
/* Reset timers */
|
||||
struct itimerspec reset = {{0}};
|
||||
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &reset, NULL);
|
||||
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &reset, NULL);
|
||||
term->delayed_render_timer.is_armed = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue