diff --git a/src/x11_window.c b/src/x11_window.c index 86a17b5a..66fc8919 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -59,16 +59,19 @@ static GLFWbool waitForEvent(double* timeout) const int fd = ConnectionNumber(_glfw.x11.display); int count = fd + 1; - FD_ZERO(&fds); - FD_SET(fd, &fds); #if defined(__linux__) - FD_SET(_glfw.linjs.inotify, &fds); - - if (fd < _glfw.linjs.inotify) + if (_glfw.linjs.inotify > fd) count = _glfw.linjs.inotify + 1; #endif for (;;) { + FD_ZERO(&fds); + FD_SET(fd, &fds); +#if defined(__linux__) + if (_glfw.linjs.inotify > 0) + FD_SET(_glfw.linjs.inotify, &fds); +#endif + if (timeout) { const long seconds = (long) *timeout;