mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-05 07:15:30 -04:00
wayland: backend now configures FD as non-blocking, not main
This commit is contained in:
parent
2eaa258e11
commit
4a63defeb1
2 changed files with 17 additions and 16 deletions
17
main.c
17
main.c
|
|
@ -588,20 +588,6 @@ main(int argc, char *const *argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
int fd = wl_display_get_fd(term.wl->display);
|
|
||||||
int fd_flags = fcntl(fd, F_GETFL);
|
|
||||||
if (fd_flags == -1) {
|
|
||||||
LOG_ERRNO("failed to set non blocking mode on Wayland display connection");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
if (fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK) == -1) {
|
|
||||||
LOG_ERRNO("failed to set non blocking mode on Wayland display connection");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fdm_add(fdm, term.ptmx, EPOLLIN, &fdm_ptmx, &term);
|
fdm_add(fdm, term.ptmx, EPOLLIN, &fdm_ptmx, &term);
|
||||||
fdm_add(fdm, term.flash.fd, EPOLLIN, &fdm_flash, &term);
|
fdm_add(fdm, term.flash.fd, EPOLLIN, &fdm_flash, &term);
|
||||||
fdm_add(fdm, term.blink.fd, EPOLLIN, &fdm_blink, &term);
|
fdm_add(fdm, term.blink.fd, EPOLLIN, &fdm_blink, &term);
|
||||||
|
|
@ -609,7 +595,8 @@ main(int argc, char *const *argv)
|
||||||
fdm_add(fdm, term.delayed_render_timer.upper_fd, EPOLLIN, &fdm_delayed_render, &term);
|
fdm_add(fdm, term.delayed_render_timer.upper_fd, EPOLLIN, &fdm_delayed_render, &term);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
wl_display_flush(term.wl->display);
|
wl_display_flush(term.wl->display); /* TODO: figure out how to get rid of this */
|
||||||
|
|
||||||
if (!fdm_poll(fdm))
|
if (!fdm_poll(fdm))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
16
wayland.c
16
wayland.c
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include <wayland-cursor.h>
|
#include <wayland-cursor.h>
|
||||||
|
|
@ -520,7 +521,18 @@ wayl_init(struct fdm *fdm)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fdm_add(fdm, wl_display_get_fd(wayl->display), EPOLLIN, &fdm_wayl, wayl)) {
|
int wl_fd = wl_display_get_fd(wayl->display);
|
||||||
|
int fd_flags = fcntl(wl_fd, F_GETFL);
|
||||||
|
if (fd_flags == -1) {
|
||||||
|
LOG_ERRNO("failed to set non blocking mode on Wayland display connection");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
if (fcntl(wl_fd, F_SETFL, fd_flags | O_NONBLOCK) == -1) {
|
||||||
|
LOG_ERRNO("failed to set non blocking mode on Wayland display connection");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fdm_add(fdm, wl_fd, EPOLLIN, &fdm_wayl, wayl)) {
|
||||||
LOG_ERR("failed to register Wayland connection with the FDM");
|
LOG_ERR("failed to register Wayland connection with the FDM");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -530,6 +542,8 @@ wayl_init(struct fdm *fdm)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//wl_display_dispatch_pending(wayl->display);
|
||||||
|
//wl_display_flush(wayl->display);
|
||||||
return wayl;
|
return wayl;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue