1
0
Fork 0
forked from wry/wry

renderer: fix overextended borders for floating windows w/ title gaps

This commit is contained in:
atagen 2026-04-07 12:14:48 +10:00
parent fc3c39bded
commit 381c5f8478

View file

@ -683,31 +683,44 @@ impl Renderer<'_> {
theme.colors.unfocused_title_background.get() theme.colors.unfocused_title_background.get()
}; };
let uc = theme.colors.separator.get(); let uc = theme.colors.separator.get();
let borders = [ let gap = theme.sizes.gap.get();
Rect::new_sized_saturating(x, y, pos.width(), bw), let floating_title = theme.floating_titles.get() && gap != 0;
Rect::new_sized_saturating(x, y + bw, bw, pos.height() - bw),
Rect::new_sized_saturating(x + pos.width() - bw, y + bw, bw, pos.height() - bw),
Rect::new_sized_saturating(x + bw, y + pos.height() - bw, pos.width() - 2 * bw, bw),
];
let srgb_srgb = self.state.color_manager.srgb_gamma22(); let srgb_srgb = self.state.color_manager.srgb_gamma22();
let srgb = &srgb_srgb.linear; let srgb = &srgb_srgb.linear;
let perceptual = RenderIntent::Perceptual; let perceptual = RenderIntent::Perceptual;
self.base.fill_boxes(&borders, &bc, srgb, perceptual); if floating_title {
let title = [Rect::new_sized_saturating( let title_frame = [
x + bw, Rect::new_sized_saturating(x, y, pos.width(), bw),
y + bw, Rect::new_sized_saturating(x, y + bw, bw, th),
pos.width() - 2 * bw, Rect::new_sized_saturating(x + pos.width() - bw, y + bw, bw, th),
th, Rect::new_sized_saturating(x, y + bw + th, pos.width(), bw),
)]; ];
self.base.fill_boxes(&title, &tc, srgb, perceptual); self.base.fill_boxes(&title_frame, &bc, srgb, perceptual);
let title_underline = [Rect::new_sized_saturating( let title_bg = [Rect::new_sized_saturating(x + bw, y + bw, pos.width() - 2 * bw, th)];
x + bw, self.base.fill_boxes(&title_bg, &tc, srgb, perceptual);
y + bw + th, let body_top = y + tpuh;
pos.width() - 2 * bw, let body_inner_top = y + bw + tpuh;
tuh, let body_inner_height = pos.height() - 2 * bw - tpuh;
)]; let body_frame = [
self.base Rect::new_sized_saturating(x, body_top, pos.width(), bw),
.fill_boxes(&title_underline, &uc, srgb, perceptual); Rect::new_sized_saturating(x, body_inner_top, bw, body_inner_height),
Rect::new_sized_saturating(x + pos.width() - bw, body_inner_top, bw, body_inner_height),
Rect::new_sized_saturating(x, y + pos.height() - bw, pos.width(), bw),
];
self.base.fill_boxes(&body_frame, &bc, srgb, perceptual);
} else {
let borders = [
Rect::new_sized_saturating(x, y, pos.width(), bw),
Rect::new_sized_saturating(x, y + bw, bw, pos.height() - bw),
Rect::new_sized_saturating(x + pos.width() - bw, y + bw, bw, pos.height() - bw),
Rect::new_sized_saturating(x + bw, y + pos.height() - bw, pos.width() - 2 * bw, bw),
];
self.base.fill_boxes(&borders, &bc, srgb, perceptual);
let title = [Rect::new_sized_saturating(x + bw, y + bw, pos.width() - 2 * bw, th)];
self.base.fill_boxes(&title, &tc, srgb, perceptual);
let title_underline = [Rect::new_sized_saturating(x + bw, y + bw + th, pos.width() - 2 * bw, tuh)];
self.base.fill_boxes(&title_underline, &uc, srgb, perceptual);
}
let rect = floating.title_rect.get().move_(x, y); let rect = floating.title_rect.get().move_(x, y);
let bounds = self.base.scale_rect(rect); let bounds = self.base.scale_rect(rect);
let (mut x1, y1) = rect.position(); let (mut x1, y1) = rect.position();