This blocks until there's an X11 event available:
int x11_fd = ConnectionNumber(display);
fd_set in_fds;
FD_ZERO(&in_fds);
FD_SET(x11_fd, &in_fds);
select(x11_fd + 1, &in_fds, NULL, NULL, NULL);
This just immediately returns:
int x11_fd = ConnectionNumber(display);
int kq = kqueue();
struct kevent ev;
EV_SET(&ev, x11_fd, EVFILT_READ, EV_ADD, 0, 0, 0);
kevent(kq, &ev, 1, NULL, 0, NULL);
Why? Am I using kqueue
incorrectly?