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.
This commit is contained in:
Camilla Löwy 2018-05-17 14:41:16 +02:00
parent 15d89bdff6
commit 8d1a64c831
1 changed files with 3 additions and 2 deletions

View File

@ -2672,8 +2672,9 @@ void _glfwPlatformPollEvents(void)
#if defined(__linux__) #if defined(__linux__)
_glfwDetectJoystickConnectionLinux(); _glfwDetectJoystickConnectionLinux();
#endif #endif
int count = XPending(_glfw.x11.display); XPending(_glfw.x11.display);
while (count--)
while (XQLength(_glfw.x11.display))
{ {
XEvent event; XEvent event;
XNextEvent(_glfw.x11.display, &event); XNextEvent(_glfw.x11.display, &event);