From 29e2481597e0184d65cd652ec7e817efe315602b Mon Sep 17 00:00:00 2001 From: Murarth Date: Tue, 25 Jun 2019 14:29:52 -0700 Subject: [PATCH] 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 --- src/platform_impl/linux/x11/mod.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/platform_impl/linux/x11/mod.rs b/src/platform_impl/linux/x11/mod.rs index 0f8b9b1a..65f0737d 100644 --- a/src/platform_impl/linux/x11/mod.rs +++ b/src/platform_impl/linux/x11/mod.rs @@ -291,11 +291,6 @@ impl EventLoop { ); } - // flush the X11 connection - unsafe { - (wt.xconn.xlib.XFlush)(wt.xconn.display); - } - match control_flow { ControlFlow::Exit => break, ControlFlow::Poll => {