diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conn_info/mod.rs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/conn_info/mod.rs b/src/conn_info/mod.rs index bd6f0cd..fbbbb54 100644 --- a/src/conn_info/mod.rs +++ b/src/conn_info/mod.rs @@ -49,6 +49,17 @@ pub struct Connection<'a> { pub keyboard_state: KeyboardInfo, } +macro_rules! debug_req { + ($req:ident) => { + #[cfg(debug_assertions)] + eprintln!("seq ?: {:?}", $req) + }; + ($req:ident, $cookie:ident) => { + #[cfg(debug_assertions)] + eprintln!("seq {}: {:?}", $cookie.sequence(), $req) + }; +} + impl<'a> Connection<'a> { /// Prepare the window manager to run on the given connection and screen number. /// This will fail if another WM is running. @@ -172,16 +183,19 @@ impl<'a> Connection<'a> { /// Delegate for [`RawConnection::send_request`] pub fn send_request<R>(&self, req: &R) -> R::Cookie where - R: xcb::Request, + R: xcb::Request + Debug, { - self.conn.send_request(req) + let cookie = self.conn.send_request(req); + debug_req!(req, cookie); + cookie } /// Delegate for [`RawConnection::send_and_check_request`] pub fn send_and_check_request<R>(&self, req: &R) -> Result<()> where - R: xcb::RequestWithoutReply, + R: xcb::RequestWithoutReply + Debug, { + debug_req!(req); self.conn.send_and_check_request(req).map_err(Into::into) } @@ -226,7 +240,7 @@ impl<'a> Connection<'a> { impl Drop for Connection<'_> { fn drop(&mut self) { - self.send_request(&DestroyWindow { + self.conn.send_request(&DestroyWindow { window: self.check_window, }); |