Skip to content

Commit 0dcc34f

Browse files
murarthkosyak
authored and
kosyak
committed
Remove XFlush call in event loop (rust-windowing#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 rust-windowing#865
1 parent ea5ec7c commit 0dcc34f

File tree

1 file changed

+0
-5
lines changed
  • src/platform_impl/linux/x11

1 file changed

+0
-5
lines changed

src/platform_impl/linux/x11/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,6 @@ impl<T: 'static> EventLoop<T> {
291291
);
292292
}
293293

294-
// flush the X11 connection
295-
unsafe {
296-
(wt.xconn.xlib.XFlush)(wt.xconn.display);
297-
}
298-
299294
match control_flow {
300295
ControlFlow::Exit => break,
301296
ControlFlow::Poll => {

0 commit comments

Comments
 (0)