From 815fb567bdfdbc3901148a4b9f49fd42a56c4f27 Mon Sep 17 00:00:00 2001 From: Irene Knapp Date: Sat, 14 Nov 2026 02:35:53 -0700 Subject: return a sleep duration to the event loop this isn't immediately useful, but it will be when threading is added... Force-Push: yes Change-Id: I7abc35826d4ff4a7a63d57f4f7f5e0e0461d23d9 --- src/x/connection.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/x') diff --git a/src/x/connection.rs b/src/x/connection.rs index 78e721d..c4e879f 100644 --- a/src/x/connection.rs +++ b/src/x/connection.rs @@ -1,5 +1,6 @@ use crate::x::atoms::Atoms; +use x11::xlib::XFlush; use xcb::XidNew; use xcb::x::{ Atom, InternAtom }; @@ -26,6 +27,22 @@ impl HasConnection for Connection { pub trait ConnectionExt: HasConnection { + fn flush(&self) -> xcb::Result<()> { + self.connection().0.flush()?; + + /* xlib is managing our socket. That means: + * + * we aren't fully flushed + * til we're xlib'fully flushed. + * + * Young people will not have this commercial in their heads. Lucky! + */ + let xlib_display = self.get_xlib_display(); + let _ = unsafe { XFlush(xlib_display) }; + + Ok(()) + } + fn get_setup(&self) -> &xcb::x::Setup { self.connection().0.get_setup() } -- cgit 1.4.1