diff options
author | David Robillard <d@drobilla.net> | 2020-03-15 14:33:12 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-03-15 14:33:12 +0100 |
commit | 4693e9ac0b6792e8a6d2af2e46499158bf6b2509 (patch) | |
tree | 5ece79e5bce91e497d82e270456ed512f7369e14 | |
parent | 390f756a37af8f5a2336e43edff8ef345a39743e (diff) | |
download | pugl-4693e9ac0b6792e8a6d2af2e46499158bf6b2509.tar.gz pugl-4693e9ac0b6792e8a6d2af2e46499158bf6b2509.tar.bz2 pugl-4693e9ac0b6792e8a6d2af2e46499158bf6b2509.zip |
X11: Read from server if necessary in puglDispatchEvents()
This reduces input lag. The previous approach was an over-optimization: what's
important here is to keep the iteration bounded by not continually flushing,
but we do want to read everything to be as up to date as possible.
-rw-r--r-- | pugl/detail/x11.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index 7b83b38..4747f64 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -744,14 +744,14 @@ puglDispatchEvents(PuglWorld* world) { const PuglX11Atoms* const atoms = &world->impl->atoms; - // Flush just once at the start to fill event queue + // Flush output to the server once at the start Display* display = world->impl->display; XFlush(display); world->impl->dispatchingEvents = true; - // Process all queued events (locally, without flushing or reading) - while (XEventsQueued(display, QueuedAlready) > 0) { + // Process all queued events (without further flushing) + while (XEventsQueued(display, QueuedAfterReading) > 0) { XEvent xevent; XNextEvent(display, &xevent); |