1
0
Fork 0
forked from wry/wry

add window gaps

This commit is contained in:
atagen 2026-04-05 20:04:13 +10:00
parent 769d12a525
commit 750bf06ce9
9 changed files with 144 additions and 13 deletions

View file

@ -334,18 +334,102 @@ impl Renderer<'_> {
}
}
if let Some(child) = container.mono_child.get() {
let body = container.mono_body.get().move_(x, y);
let mb = container.mono_body.get();
if self.state.theme.sizes.gap.get() > 0 && !child.node.node_is_container() {
let srgb_srgb = self.state.color_manager.srgb_gamma22();
let bw = self.state.theme.sizes.border_width.get();
let border_color = self.state.theme.colors.border.get();
let focused_border_color =
self.state.theme.colors.focused_title_background.get();
let c = if child.active.get() {
&focused_border_color
} else {
&border_color
};
let full_h = mb.y2();
let full_w = mb.width();
let frame_rects = [
Rect::new_sized_saturating(mb.x1() - bw, 0, bw, full_h),
Rect::new_sized_saturating(mb.x2(), 0, bw, full_h),
Rect::new_sized_saturating(mb.x1() - bw, -bw, full_w + 2 * bw, bw),
Rect::new_sized_saturating(mb.x1() - bw, full_h, full_w + 2 * bw, bw),
];
self.base.fill_boxes2(
&frame_rects,
c,
&srgb_srgb.linear,
RenderIntent::Perceptual,
x,
y,
);
}
let body = mb.move_(x, y);
let body = self.base.scale_rect(body);
let content = container.mono_content.get();
child
.node
.node_render(self, x + content.x1(), y + content.y1(), Some(&body));
} else {
let gap = self.state.theme.sizes.gap.get();
let (srgb_srgb, bw, border_color, focused_border_color, tpuh) = if gap > 0 {
let srgb_srgb = self.state.color_manager.srgb_gamma22();
let bw = self.state.theme.sizes.border_width.get();
let border_color = self.state.theme.colors.border.get();
let focused_border_color = self.state.theme.colors.focused_title_background.get();
let tpuh = self.state.theme.title_plus_underline_height();
(
Some(srgb_srgb),
bw,
border_color,
focused_border_color,
tpuh,
)
} else {
(None, 0, Color::SOLID_BLACK, Color::SOLID_BLACK, 0)
};
for child in container.children.iter() {
let body = child.body.get();
if body.x1() >= container.width.get() || body.y1() >= container.height.get() {
break;
}
if let Some(srgb_srgb) = srgb_srgb {
if !child.node.node_is_container() {
let srgb = &srgb_srgb.linear;
let c = if child.border_color_is_focused.get() {
&focused_border_color
} else {
&border_color
};
let title_rect = child.title_rect.get();
let top_y = if tpuh > 0 { title_rect.y1() } else { body.y1() };
let full_h = body.y2() - top_y;
let full_w = body.width();
let frame_rects = [
Rect::new_sized_saturating(body.x1() - bw, top_y, bw, full_h),
Rect::new_sized_saturating(body.x2(), top_y, bw, full_h),
Rect::new_sized_saturating(
body.x1() - bw,
top_y - bw,
full_w + 2 * bw,
bw,
),
Rect::new_sized_saturating(
body.x1() - bw,
body.y2(),
full_w + 2 * bw,
bw,
),
];
self.base.fill_boxes2(
&frame_rects,
c,
srgb,
RenderIntent::Perceptual,
x,
y,
);
}
}
let body = body.move_(x, y);
let body = self.base.scale_rect(body);
let content = child.content.get();