From 6eeea06cc0525f9f0d2548ebf685b15f257142b6 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 15 Mar 2020 13:37:56 +0100 Subject: wayland: add FDs to FDM as soon as the FDs are ready --- wayland.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wayland.c b/wayland.c index 7ae2e29f..c9eedc60 100644 --- a/wayland.c +++ b/wayland.c @@ -851,20 +851,20 @@ 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 (wl_display_prepare_read(wayl->display) != 0) { - LOG_ERRNO("failed to prepare for reading wayland events"); + if (!fdm_add(fdm, wayl->kbd.repeat.fd, EPOLLIN, &fdm_repeat, wayl)) 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)) - { + if (wl_display_prepare_read(wayl->display) != 0) { + LOG_ERRNO("failed to prepare for reading wayland events"); goto out; } -- cgit v1.3