diff options
Diffstat (limited to 'src/x')
| -rw-r--r-- | src/x/connection.rs | 17 |
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() } |