mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-17 05:33:52 -04: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));
|
ssize_t count = read(term->ptmx, buf, sizeof(buf));
|
||||||
|
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
if (errno == EAGAIN)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
LOG_ERRNO("failed to read from pseudo terminal");
|
LOG_ERRNO("failed to read from pseudo terminal");
|
||||||
return false;
|
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));
|
term->flash.fd, &expiration_count, sizeof(expiration_count));
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
LOG_ERRNO("failed to read flash timer");
|
LOG_ERRNO("failed to read flash timer");
|
||||||
return false;
|
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));
|
term->blink.fd, &expiration_count, sizeof(expiration_count));
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
if (errno == EAGAIN)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
LOG_ERRNO("failed to read blink timer");
|
LOG_ERRNO("failed to read blink timer");
|
||||||
return false;
|
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)
|
if (fd == term->delayed_render_timer.upper_fd)
|
||||||
ret2 = read(term->delayed_render_timer.upper_fd, &unused, sizeof(unused));
|
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");
|
LOG_ERRNO("failed to read timeout timer");
|
||||||
else if (ret1 > 0 || ret2 > 0) {
|
return false;
|
||||||
render_refresh(term);
|
}
|
||||||
|
|
||||||
/* Reset timers */
|
render_refresh(term);
|
||||||
term->delayed_render_timer.is_armed = false;
|
|
||||||
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &(struct itimerspec){.it_value = {0}}, NULL);
|
/* Reset timers */
|
||||||
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &(struct itimerspec){.it_value = {0}}, NULL);
|
struct itimerspec reset = {{0}};
|
||||||
} else
|
timerfd_settime(term->delayed_render_timer.lower_fd, 0, &reset, NULL);
|
||||||
assert(false);
|
timerfd_settime(term->delayed_render_timer.upper_fd, 0, &reset, NULL);
|
||||||
|
term->delayed_render_timer.is_armed = false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue