diff options
author | tcmal <me@aria.rip> | 2024-09-13 13:26:35 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-09-13 13:47:34 +0100 |
commit | 1c3e83df5595b173d3421172a8bc343601ca4ddf (patch) | |
tree | b907666c2c1535e57f25507b75d66c3e56f08c5e /src/clients/mod.rs | |
parent | 06a9a8f08b59cd17a22e8cb3a8d2815bb2042f3c (diff) |
Unconditionally set properties on configurerequest
Diffstat (limited to 'src/clients/mod.rs')
-rw-r--r-- | src/clients/mod.rs | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/src/clients/mod.rs b/src/clients/mod.rs index 7a06210..6152be5 100644 --- a/src/clients/mod.rs +++ b/src/clients/mod.rs @@ -1,7 +1,7 @@ //! Tracking and managing windows. use std::{ - cmp::{min, Ordering}, + cmp::{max, min, Ordering}, mem, }; @@ -64,34 +64,19 @@ impl WM<'_> { c.configure_notify(&self.conn); } else { - let (mut x, mut y, mut width, mut height, mut border_width) = - (0_i32, 0_i32, 1_u32, 1_u32, 0_u32); - - if e.value_mask().contains(ConfigWindowMask::X) { - x = i32::from(e.x()); - } - if e.value_mask().contains(ConfigWindowMask::Y) { - y = i32::from(e.y()); - } - if e.value_mask().contains(ConfigWindowMask::HEIGHT) { - height = u32::from(e.height()); - } - if e.value_mask().contains(ConfigWindowMask::WIDTH) { - width = u32::from(e.width()); - } - if e.value_mask().contains(ConfigWindowMask::BORDER_WIDTH) { - border_width = u32::from(e.border_width()); - } - // Configure it as requested, and sort the rest when we actually map the window + // According to spec, we should check the property mask and only set properties that are specified, setting defaults + // for other ones. + // Unfortunately, some clients (such as Audacity) will not set the mask correctly. + // So instead we just use all the properties, and the ones that can be invalid (width, height > 0) we clamp. self.conn.send_request(&ConfigureWindow { window: e.window(), value_list: &[ - ConfigWindow::X(x), - ConfigWindow::Y(y), - ConfigWindow::Width(width), - ConfigWindow::Height(height), - ConfigWindow::BorderWidth(border_width), + ConfigWindow::X(e.x().into()), + ConfigWindow::Y(e.y().into()), + ConfigWindow::Width(max(e.width().into(), 1)), + ConfigWindow::Height(max(e.height().into(), 1)), + ConfigWindow::BorderWidth(e.border_width().into()), ConfigWindow::StackMode(e.stack_mode()), ], }); |