From 077b31875b5fdd0d6f299c8834b8a626e263c099 Mon Sep 17 00:00:00 2001 From: osch Date: Wed, 11 Sep 2019 20:20:59 +0200 Subject: X11: Don't select on server socket if events are already queued --- pugl/detail/x11.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pugl/detail') diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index cc6eb5d..4f4d7e8 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -118,7 +118,9 @@ puglInitViewInternals(void) PuglStatus puglPollEvents(PuglWorld* world, const double timeout) { - XFlush(world->impl->display); + if (XPending(world->impl->display) > 0) { + return PUGL_SUCCESS; + } const int fd = ConnectionNumber(world->impl->display); const int nfds = fd + 1; -- cgit v1.2.1