Remove XFlush call in event loop (#982)

Internally, `XFlush` calls `_XSend` to write data. It then calls
`XEventsQueued(display, QueuedAfterReading)`, which reads data from the
X server connection. This prevents the event loop source callback from
being run, as there is no longer data waiting on the socket.

Ideally, we would want to call `_XSend` directly to ensure that no
output is buffered by Xlib. However, this function is not exported as
part of Xlib's public API.

Testing with the `XFlush` call removed does not appear to adversely
affect the performance of an application. If any bugs should eventually
arise from this change, perhaps another function may be used in place of
`XFlush`, such as `XPending`, which writes buffered output but does not
so aggressively read from the X server connection.

Closes #865
This commit is contained in:
Murarth 2019-06-25 14:29:52 -07:00 committed by Hal Gentz
parent 3555de114a
commit 29e2481597

View file

@ -291,11 +291,6 @@ impl<T: 'static> EventLoop<T> {
);
}
// flush the X11 connection
unsafe {
(wt.xconn.xlib.XFlush)(wt.xconn.display);
}
match control_flow {
ControlFlow::Exit => break,
ControlFlow::Poll => {