forge
Explore
Log in

Don't you dare go Hollow

Fix default width fixed not being honored with borders

Browse files at this commit

eb2dce1b530584496034bc6d7f14e9b29a487fafIvan MolodetskikhParent: f5b776a
src/layout/mod.rsmodified+12 -15
@@ -534,13 +534,12 @@ impl<W: LayoutElement> Layout<W> {
534 width: Option<ColumnWidth>,534 width: Option<ColumnWidth>,
535 is_full_width: bool,535 is_full_width: bool,
536 ) -> Option<&Output> {536 ) -> Option<&Output> {
537- let width = width.unwrap_or_else(|| {537+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
538- let mut width = window.size().w;538+ if let ColumnWidth::Fixed(w) = &mut width {
539 if !self.options.border.off {539 if !self.options.border.off {
540- width += self.options.border.width as i32 * 2;540+ *w += self.options.border.width as i32 * 2;
541 }541 }
542- ColumnWidth::Fixed(width)542+ }
543- });
544 543
545 match &mut self.monitor_set {544 match &mut self.monitor_set {
546 MonitorSet::Normal {545 MonitorSet::Normal {
@@ -591,13 +590,12 @@ impl<W: LayoutElement> Layout<W> {
591 width: Option<ColumnWidth>,590 width: Option<ColumnWidth>,
592 is_full_width: bool,591 is_full_width: bool,
593 ) -> Option<&Output> {592 ) -> Option<&Output> {
594- let width = width.unwrap_or_else(|| {593+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
595- let mut width = window.size().w;594+ if let ColumnWidth::Fixed(w) = &mut width {
596 if !self.options.border.off {595 if !self.options.border.off {
597- width += self.options.border.width as i32 * 2;596+ *w += self.options.border.width as i32 * 2;
598 }597 }
599- ColumnWidth::Fixed(width)598+ }
600- });
601 599
602 match &mut self.monitor_set {600 match &mut self.monitor_set {
603 MonitorSet::Normal { monitors, .. } => {601 MonitorSet::Normal { monitors, .. } => {
@@ -628,13 +626,12 @@ impl<W: LayoutElement> Layout<W> {
628 width: Option<ColumnWidth>,626 width: Option<ColumnWidth>,
629 is_full_width: bool,627 is_full_width: bool,
630 ) {628 ) {
631- let width = width.unwrap_or_else(|| {629+ let mut width = width.unwrap_or_else(|| ColumnWidth::Fixed(window.size().w));
632- let mut width = window.size().w;630+ if let ColumnWidth::Fixed(w) = &mut width {
633 if !self.options.border.off {631 if !self.options.border.off {
634- width += self.options.border.width as i32 * 2;632+ *w += self.options.border.width as i32 * 2;
635 }633 }
636- ColumnWidth::Fixed(width)634+ }
637- });
638 635
639 let MonitorSet::Normal {636 let MonitorSet::Normal {
640 monitors,637 monitors,
src/layout/workspace.rsmodified+5 -1
@@ -335,10 +335,14 @@ impl<W: LayoutElement> Workspace<W> {
335 335
336 pub fn new_window_size(&self, width: Option<ColumnWidth>) -> Size<i32, Logical> {336 pub fn new_window_size(&self, width: Option<ColumnWidth>) -> Size<i32, Logical> {
337 let width = if let Some(width) = width {337 let width = if let Some(width) = width {
338+ let is_fixed = matches!(width, ColumnWidth::Fixed(_));
339+
338 let mut width = width.resolve(&self.options, self.working_area.size.w);340 let mut width = width.resolve(&self.options, self.working_area.size.w);
339- if !self.options.border.off {341+
342+ if !is_fixed && !self.options.border.off {
340 width -= self.options.border.width as i32 * 2;343 width -= self.options.border.width as i32 * 2;
341 }344 }
345+
342 max(1, width)346 max(1, width)
343 } else {347 } else {
344 0348 0