diff --git a/src/icccm/connection.rs b/src/icccm/connection.rs index b9fe72d..d79ee3b 100644 --- a/src/icccm/connection.rs +++ b/src/icccm/connection.rs @@ -77,7 +77,7 @@ impl<'a> Connection<'a> { #[cfg(test)] mod tests { use crate::icccm::proto::{ - GetWmHints, GetWmNormalHints, SetWmName, SetWmNormalHints, WmSizeHints, + GetWmHints, GetWmNormalHints, SetWmHints, SetWmName, SetWmNormalHints, WmSizeHints, }; #[test] @@ -140,4 +140,27 @@ mod tests { let reply = icccm_con.wait_for_reply(cookie); println!("{:?}", reply); } + + #[test] + fn set_urgent() { + let xcb_con = xcb::Connection::connect(Option::None).unwrap().0; + let icccm_con = crate::icccm::Connection::connect(&xcb_con); + + use xcb::XidNew; + + let window = unsafe { xcb::x::Window::new(0x3c0013e) }; + + let request = GetWmHints::new(window); + let cookie = icccm_con.send_request(&request); + let reply = icccm_con.wait_for_reply(cookie); + println!("{:?}", reply); + + let mut wm_hints = reply.size_hints; + wm_hints.toggle_urgent(); + + let urgent = SetWmHints::new(window, &mut wm_hints); + let cookie = icccm_con.send_request_checked(&urgent); + let reply = xcb_con.check_request(cookie); + println!("{:?}", reply); + } }