From 4c6e8e8618afcd1b7216fa47c7054c8ba4477000 Mon Sep 17 00:00:00 2001 From: Armin Friedl Date: Fri, 3 Jun 2022 11:41:50 +0200 Subject: [PATCH] Test setting window urgency --- src/icccm/connection.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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); + } }