Check for error while communicating with Wayland.

This commit is contained in:
ManoloFLTK 2022-08-06 10:07:38 +02:00
parent 128aa08be8
commit e73e13120e
1 changed files with 7 additions and 5 deletions

View File

@ -1065,11 +1065,13 @@ static const struct wl_registry_listener registry_listener = {
static void fd_callback(int fd, struct wl_display *display) {
struct pollfd fds;
fds.fd = fd;
fds.events = POLLIN;
fds.revents = 0;
do wl_display_dispatch(display);
struct pollfd fds = (struct pollfd) { fd, POLLIN, 0 };
do {
if (wl_display_dispatch(display) == -1) {
Fl::fatal("Fatal error while communicating with the Wayland server: errno=%d\n",
wl_display_get_error(display));
}
}
while (poll(&fds, 1, 0) > 0);
}