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

View File

@ -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);