about summary refs log tree commit diff
path: root/src/x
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-11-14 02:35:53 -0700
committerIrene Knapp <ireneista@irenes.space>2026-11-14 02:35:53 -0700
commit815fb567bdfdbc3901148a4b9f49fd42a56c4f27 (patch)
treea0fdd871ccf943e1b3d0247b01a359bcec48f078 /src/x
parentd0c5a0eeec74de59a4919a42412d41fafb2593e3 (diff)
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
Diffstat (limited to 'src/x')
-rw-r--r--src/x/connection.rs17
1 files changed, 17 insertions, 0 deletions
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()
   }