wayland: integrate directly with the FDM

This commit is contained in:
Daniel Eklöf 2019-10-27 19:11:35 +01:00
parent 61cc8c3c55
commit 1e75b89552
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 23 additions and 17 deletions

16
main.c
View file

@ -44,20 +44,6 @@
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
static bool
fdm_wayl(struct fdm *fdm, int fd, int events, void *data)
{
struct wayland *wayl = data;
int event_count = wl_display_dispatch(wayl->display);
if (events & EPOLLHUP) {
LOG_ERR("disconnected from Wayland");
return false;
}
return event_count != -1 && !wayl->term->quit;
}
static bool
fdm_ptmx(struct fdm *fdm, int fd, int events, void *data)
{
@ -650,7 +636,6 @@ main(int argc, char *const *argv)
}
}
fdm_add(fdm, wl_display_get_fd(term.wl->display), EPOLLIN, &fdm_wayl, term.wl);
fdm_add(fdm, term.ptmx, EPOLLIN, &fdm_ptmx, &term);
fdm_add(fdm, term.wl->kbd.repeat.fd, EPOLLIN, &fdm_repeat, term.wl);
fdm_add(fdm, term.flash.fd, EPOLLIN, &fdm_flash, &term);
@ -669,7 +654,6 @@ main(int argc, char *const *argv)
out:
if (fdm != NULL) {
fdm_del(fdm, wl_display_get_fd(term.wl->display));
fdm_del(fdm, term.ptmx);
fdm_del(fdm, term.wl->kbd.repeat.fd);
fdm_del(fdm, term.flash.fd);