aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-15 14:33:12 +0100
committerDavid Robillard <d@drobilla.net>2020-03-15 14:33:12 +0100
commit4693e9ac0b6792e8a6d2af2e46499158bf6b2509 (patch)
tree5ece79e5bce91e497d82e270456ed512f7369e14 /pugl
parent390f756a37af8f5a2336e43edff8ef345a39743e (diff)
downloadpugl-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.
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/x11.c6
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);