From 28d1cbca91c35175137ec8f9a9f816f3448467b6 Mon Sep 17 00:00:00 2001 From: tcmal Date: Fri, 21 Jun 2024 21:31:59 +0100 Subject: fix some problems when clients were destroyed --- src/clients/client.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/clients/client.rs') diff --git a/src/clients/client.rs b/src/clients/client.rs index a7b1a8d..3648f0c 100644 --- a/src/clients/client.rs +++ b/src/clients/client.rs @@ -3,7 +3,7 @@ use xcb::{ ChangeProperty, ChangeWindowAttributes, ConfigWindow, ConfigureNotifyEvent, ConfigureWindow, Cw, EventMask, MapWindow, SendEvent, SendEventDest, Window, }, - Xid, + VoidCookie, VoidCookieChecked, Xid, }; use crate::{config::BORDER_WIDTH, conn_info::Connection}; @@ -125,11 +125,15 @@ impl Client { /// Set the event mask for this window /// This function does not check for success, so `conn.flush()` should be called after. - pub fn set_event_mask(&self, conn: &Connection<'_>, event_mask: EventMask) { - conn.send_request(&ChangeWindowAttributes { + pub fn set_event_mask( + &self, + conn: &Connection<'_>, + event_mask: EventMask, + ) -> VoidCookieChecked { + conn.send_request_checked(&ChangeWindowAttributes { window: self.window(), value_list: &[Cw::EventMask(event_mask)], - }); + }) } /// Sync the non-geometry related properties with EWMH hints @@ -150,14 +154,14 @@ impl Client { } /// Set the given window as withdrawn / not withdrawn. - pub fn set_withdrawn(&self, conn: &Connection<'_>, withdrawn: bool) { - conn.send_request(&ChangeProperty { + pub fn set_withdrawn(&self, conn: &Connection<'_>, withdrawn: bool) -> VoidCookieChecked { + conn.send_request_checked(&ChangeProperty { mode: xcb::x::PropMode::Replace, window: self.window, property: conn.atoms.wm_state, r#type: conn.atoms.wm_state, - data: &[u8::from(!withdrawn), 0_u8], - }); + data: &[u32::from(!withdrawn), 0_u32], + }) } pub fn set_urgent(&mut self, urgent: bool) { -- cgit v1.2.3