container: expand title bars to fit window size when gapped w/o title gaps
This commit is contained in:
parent
6dba659978
commit
fc3c39bded
1 changed files with 30 additions and 7 deletions
|
|
@ -909,13 +909,15 @@ impl ContainerNode {
|
||||||
let abs_x = self.abs_x1.get();
|
let abs_x = self.abs_x1.get();
|
||||||
let abs_y = self.abs_y1.get();
|
let abs_y = self.abs_y1.get();
|
||||||
let gap = self.state.theme.sizes.gap.get();
|
let gap = self.state.theme.sizes.gap.get();
|
||||||
|
let floating_titles = self.state.theme.floating_titles.get();
|
||||||
|
let title_bw = if gap != 0 && !floating_titles { bw } else { 0 };
|
||||||
for (i, child) in self.children.iter().enumerate() {
|
for (i, child) in self.children.iter().enumerate() {
|
||||||
let rect = child.title_rect.get();
|
let rect = child.title_rect.get();
|
||||||
if self.toplevel_data.visible.get() && !mono && split != ContainerSplit::Horizontal {
|
if self.toplevel_data.visible.get() && !mono && split != ContainerSplit::Horizontal {
|
||||||
self.state.damage(Rect::new_sized_saturating(
|
self.state.damage(Rect::new_sized_saturating(
|
||||||
abs_x,
|
abs_x - title_bw,
|
||||||
abs_y + rect.y1(),
|
abs_y + rect.y1(),
|
||||||
cwidth,
|
cwidth + 2 * title_bw,
|
||||||
rect.height() + tuh,
|
rect.height() + tuh,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -929,8 +931,7 @@ impl ContainerNode {
|
||||||
} else {
|
} else {
|
||||||
Rect::new_sized_saturating(0, rect.y1() - bw, cwidth, bw)
|
Rect::new_sized_saturating(0, rect.y1() - bw, cwidth, bw)
|
||||||
};
|
};
|
||||||
let floating = self.state.theme.floating_titles.get();
|
if gap == 0 || (mono && !floating_titles) {
|
||||||
if gap == 0 || (mono && !floating) {
|
|
||||||
rd.border_rects.push(sep);
|
rd.border_rects.push(sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -943,7 +944,7 @@ impl ContainerNode {
|
||||||
} else {
|
} else {
|
||||||
rd.title_rects.push(rect);
|
rd.title_rects.push(rect);
|
||||||
}
|
}
|
||||||
if !mono && (!self.state.theme.floating_titles.get() || gap == 0) {
|
if !mono && (!floating_titles || gap == 0) {
|
||||||
let rect = Rect::new_sized_saturating(rect.x1(), rect.y2(), rect.width(), 1);
|
let rect = Rect::new_sized_saturating(rect.x1(), rect.y2(), rect.width(), 1);
|
||||||
rd.underline_rects.push(rect);
|
rd.underline_rects.push(rect);
|
||||||
}
|
}
|
||||||
|
|
@ -955,7 +956,7 @@ impl ContainerNode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if mono && (!self.state.theme.floating_titles.get() || gap == 0) {
|
if mono && (!floating_titles || gap == 0) {
|
||||||
rd.underline_rects
|
rd.underline_rects
|
||||||
.push(Rect::new_sized_saturating(0, th, cwidth, tuh));
|
.push(Rect::new_sized_saturating(0, th, cwidth, tuh));
|
||||||
}
|
}
|
||||||
|
|
@ -963,9 +964,31 @@ impl ContainerNode {
|
||||||
rd.underline_rects
|
rd.underline_rects
|
||||||
.push(Rect::new_sized_saturating(0, 0, cwidth, tuh));
|
.push(Rect::new_sized_saturating(0, 0, cwidth, tuh));
|
||||||
}
|
}
|
||||||
|
if title_bw > 0 {
|
||||||
|
let extend = |r: Rect| {
|
||||||
|
let x1 = if r.x1() == 0 { -title_bw } else { r.x1() };
|
||||||
|
let x2 = if r.x2() == cwidth { r.x2() + title_bw } else { r.x2() };
|
||||||
|
Rect::new_sized_saturating(x1, r.y1(), x2 - x1, r.height())
|
||||||
|
};
|
||||||
|
for r in &mut rd.title_rects {
|
||||||
|
*r = extend(*r);
|
||||||
|
}
|
||||||
|
for r in &mut rd.active_title_rects {
|
||||||
|
*r = extend(*r);
|
||||||
|
}
|
||||||
|
for r in &mut rd.attention_title_rects {
|
||||||
|
*r = extend(*r);
|
||||||
|
}
|
||||||
|
if let Some(r) = &mut rd.last_active_rect {
|
||||||
|
*r = extend(*r);
|
||||||
|
}
|
||||||
|
for r in &mut rd.underline_rects {
|
||||||
|
*r = extend(*r);
|
||||||
|
}
|
||||||
|
}
|
||||||
if self.toplevel_data.visible.get() && (mono || split == ContainerSplit::Horizontal) {
|
if self.toplevel_data.visible.get() && (mono || split == ContainerSplit::Horizontal) {
|
||||||
self.state
|
self.state
|
||||||
.damage(Rect::new_sized_saturating(abs_x, abs_y, cwidth, tpuh));
|
.damage(Rect::new_sized_saturating(abs_x - title_bw, abs_y, cwidth + 2 * title_bw, tpuh));
|
||||||
}
|
}
|
||||||
rd.titles.remove_if(|_, v| v.is_empty());
|
rd.titles.remove_if(|_, v| v.is_empty());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue