wayland: add FDs to FDM as soon as the FDs are ready

This commit is contained in:
Daniel Eklöf 2020-03-15 13:37:56 +01:00
parent 71fde3bfac
commit 6eeea06cc0
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -851,23 +851,23 @@ wayl_init(const struct config *conf, struct fdm *fdm)
goto out;
}
if (!fdm_add(fdm, wayl->fd, EPOLLIN, &fdm_wayl, wayl))
goto out;
wayl->kbd.repeat.fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC | TFD_NONBLOCK);
if (wayl->kbd.repeat.fd == -1) {
LOG_ERRNO("failed to create keyboard repeat timer FD");
goto out;
}
if (!fdm_add(fdm, wayl->kbd.repeat.fd, EPOLLIN, &fdm_repeat, wayl))
goto out;
if (wl_display_prepare_read(wayl->display) != 0) {
LOG_ERRNO("failed to prepare for reading wayland events");
goto out;
}
if (!fdm_add(fdm, wl_display_get_fd(wayl->display), EPOLLIN, &fdm_wayl, wayl) ||
!fdm_add(fdm, wayl->kbd.repeat.fd, EPOLLIN, &fdm_repeat, wayl))
{
goto out;
}
return wayl;
out: