diff options
Diffstat (limited to 'src/conn_info/mod.rs')
-rw-r--r-- | src/conn_info/mod.rs | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/conn_info/mod.rs b/src/conn_info/mod.rs index 623e2a5..521bf3e 100644 --- a/src/conn_info/mod.rs +++ b/src/conn_info/mod.rs @@ -157,11 +157,6 @@ impl<'a> Connection<'a> { }) } - /// Get the root window our WM is using - pub const fn root(&self) -> Window { - self.root - } - /// Refresh cached info about keyboard layout pub fn refresh_keyboard_info(&mut self) -> Result<()> { self.keyboard_state = KeyboardInfo::new_with(self.conn)?; @@ -194,10 +189,12 @@ impl<'a> Connection<'a> { self.conn.wait_for_event().map_err(Into::into) } + /// Delegate for [`RawConnection::active_extensions`] pub fn active_extensions(&self) -> impl Iterator<Item = xcb::Extension> + '_ { self.conn.active_extensions() } + /// Delegate for [`RawConnection::wait_for_reply`] pub fn wait_for_reply<C>(&self, cookie: C) -> xcb::Result<C::Reply> where C: xcb::CookieWithReplyChecked, @@ -205,10 +202,17 @@ impl<'a> Connection<'a> { self.conn.wait_for_reply(cookie) } + /// Delegate for [`RawConnection::get_setup`] pub fn get_setup(&self) -> &x::Setup { self.conn.get_setup() } + /// The root window + pub const fn root(&self) -> Window { + self.root + } + + /// The 'screen' number on the X server. Note this isn’t what you think it is on multi-monitor setups pub const fn screen_num(&self) -> usize { self.screen_num } @@ -219,7 +223,29 @@ impl Drop for Connection<'_> { self.send_request(&DestroyWindow { window: self.check_window, }); - // TODO: Unset attributes of root window - todo!() + + // Unset attributes of root window + self.conn.send_request(&DeleteProperty { + window: self.root, + property: self.atoms.net_wm_check, + }); + self.conn.send_request(&DeleteProperty { + window: self.root, + property: self.atoms.net_client_list, + }); + self.conn.send_request(&DeleteProperty { + window: self.root, + property: self.atoms.net_supported, + }); + self.conn.send_request(&ChangeWindowAttributes { + window: self.root, + value_list: &[x::Cw::EventMask(x::EventMask::NO_EVENT)], + }); + + // Safety: These methods only require that the object is not used again, which will be true since we're in the destructor. + unsafe { + self.cursors.free(self.conn); + self.colours.free(self.conn); + } } } |