From 8d1a64c83180fd8c5e41b5f2af3416d604261383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 17 May 2018 14:41:16 +0200 Subject: [PATCH] X11: Make event polling more robust This makes X11 event polling less likely to block if the application uses the display via native access. Fixes #1225. --- src/x11_window.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/x11_window.c b/src/x11_window.c index fc24f285..1c4e9c3c 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2672,8 +2672,9 @@ void _glfwPlatformPollEvents(void) #if defined(__linux__) _glfwDetectJoystickConnectionLinux(); #endif - int count = XPending(_glfw.x11.display); - while (count--) + XPending(_glfw.x11.display); + + while (XQLength(_glfw.x11.display)) { XEvent event; XNextEvent(_glfw.x11.display, &event);