aboutsummaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-02-23 14:40:56 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-23 14:40:56 +0400
commiteb2dce1b530584496034bc6d7f14e9b29a487faf (patch)
treebde5e6c9ebcde740136950111e554b6e16bc0254 /src/layout/mod.rs
parentf5b776a9471b20f795823f8343a1ac24f5df4c1e (diff)
downloadniri-eb2dce1b530584496034bc6d7f14e9b29a487faf.tar.gz
niri-eb2dce1b530584496034bc6d7f14e9b29a487faf.tar.bz2
niri-eb2dce1b530584496034bc6d7f14e9b29a487faf.zip
Fix default width fixed not being honored with borders
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 4fc8021a..61bdaa8d 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -534,13 +534,12 @@ impl<W: LayoutElement> Layout<W> {
width: Option<ColumnWidth>,
is_full_width: bool,
) -> Option<&Output> {
- let width = width.unwrap_or_else(|| {
- let mut width = window.size().w;
+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
+ if let ColumnWidth::Fixed(w) = &mut width {
if !self.options.border.off {
- width += self.options.border.width as i32 * 2;
+ *w += self.options.border.width as i32 * 2;
}
- ColumnWidth::Fixed(width)
- });
+ }
match &mut self.monitor_set {
MonitorSet::Normal {
@@ -591,13 +590,12 @@ impl<W: LayoutElement> Layout<W> {
width: Option<ColumnWidth>,
is_full_width: bool,
) -> Option<&Output> {
- let width = width.unwrap_or_else(|| {
- let mut width = window.size().w;
+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
+ if let ColumnWidth::Fixed(w) = &mut width {
if !self.options.border.off {
- width += self.options.border.width as i32 * 2;
+ *w += self.options.border.width as i32 * 2;
}
- ColumnWidth::Fixed(width)
- });
+ }
match &mut self.monitor_set {
MonitorSet::Normal { monitors, .. } => {
@@ -628,13 +626,12 @@ impl<W: LayoutElement> Layout<W> {
width: Option<ColumnWidth>,
is_full_width: bool,
) {
- let width = width.unwrap_or_else(|| {
- let mut width = window.size().w;
+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
+ if let ColumnWidth::Fixed(w) = &mut width {
if !self.options.border.off {
- width += self.options.border.width as i32 * 2;
+ *w += self.options.border.width as i32 * 2;
}
- ColumnWidth::Fixed(width)
- });
+ }
let MonitorSet::Normal {
monitors,