From 06a9a8f08b59cd17a22e8cb3a8d2815bb2042f3c Mon Sep 17 00:00:00 2001 From: tcmal Date: Wed, 28 Aug 2024 17:14:51 +0000 Subject: [PATCH] Fix sending invalid configuration requests sometimes --- src/clients/client.rs | 4 ++-- src/clients/mod.rs | 20 +++++++++----------- 2 file(s) changed, 11 insertion(s)(+), 13 deletion(s)(-) diff --git a/src/clients/client.rs b/src/clients/client.rs --- a/src/clients/client.rs +++ b/src/clients/client.rs @@ -51,8 +51,8 @@ Self { window, x: 0, y: 0, - width: 0, - height: 0, + width: 1, + height: 1, border_width: BORDER_WIDTH, mapped: false, urgent: false, diff --git a/src/clients/mod.rs b/src/clients/mod.rs --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -46,7 +46,7 @@ pub type ClientIdx = usize; impl WM<'_> { /// Perform configure requests if we're happy with them, or they're for an unmanaged window. - pub(crate) fn handle_configure_request(&mut self, e: &ConfigureRequestEvent) -> Result<()> { + pub(crate) fn handle_configure_request(&mut self, e: &ConfigureRequestEvent) { if let Some(c) = self.clients.find_client_mut(e.window()) { // Always allow setting border width if c.floating() { @@ -65,26 +65,26 @@ c.configure_notify(&self.conn); } else { let (mut x, mut y, mut width, mut height, mut border_width) = - (0_i32, 0_i32, 0_u32, 0_u32, 0_u32); + (0_i32, 0_i32, 1_u32, 1_u32, 0_u32); if e.value_mask().contains(ConfigWindowMask::X) { - x = e.x() as i32; + x = i32::from(e.x()); } if e.value_mask().contains(ConfigWindowMask::Y) { - y = e.y() as i32; + y = i32::from(e.y()); } if e.value_mask().contains(ConfigWindowMask::HEIGHT) { - height = e.height() as u32; + height = u32::from(e.height()); } if e.value_mask().contains(ConfigWindowMask::WIDTH) { - width = e.width() as u32; + width = u32::from(e.width()); } if e.value_mask().contains(ConfigWindowMask::BORDER_WIDTH) { - border_width = e.border_width() as u32; + border_width = u32::from(e.border_width()); } // Configure it as requested, and sort the rest when we actually map the window - self.conn.send_and_check_request(&ConfigureWindow { + self.conn.send_request(&ConfigureWindow { window: e.window(), value_list: &[ ConfigWindow::X(x), @@ -94,10 +94,8 @@ ConfigWindow::Height(height), ConfigWindow::BorderWidth(border_width), ConfigWindow::StackMode(e.stack_mode()), ], - })?; + }); } - - Ok(()) } /// Update our monitor geometry if the root window is reconfigured -- tangled.sh