1
0
Fork 0
forked from wry/wry

Add support for experimental xx_foreign_toplevel_geometry_tracker_v1 (#1)

Co-authored-by: entailz <entail-wraps0r@icloud.com>
Reviewed-on: wry/wry#1
Co-authored-by: entailz <entailzwrapped@proton.me>
Co-committed-by: entailz <entailzwrapped@proton.me>
This commit is contained in:
entailz 2026-04-30 17:08:19 -04:00 committed by kossLAN
parent 4e9b6def83
commit f056727621
36 changed files with 497 additions and 243 deletions

View file

@ -299,8 +299,7 @@ impl Renderer<'_> {
// RoundedFillRect z1 rounded border ring (on top of bg)
// RoundedCopyTexture title text (on top of everything)
for entry in &tab_bar.entries {
let (bg_color, border_color, _text_color) =
TabBar::entry_colors(self.state, entry);
let (bg_color, border_color, _text_color) = TabBar::entry_colors(self.state, entry);
let ex = entry.x.get();
let ew = entry.width.get();
let tab_rect = Rect::new_sized_saturating(ex, 0, ew, bar_height);
@ -308,7 +307,12 @@ impl Renderer<'_> {
// Tiny FillRect strip to establish Vulkan paint regions (visually hidden
// behind the RoundedFillRect bg that renders later).
let strip = Rect::new_sized_saturating(ex + radius, bar_height / 2, (ew - 2 * radius).max(1), 1);
let strip = Rect::new_sized_saturating(
ex + radius,
bar_height / 2,
(ew - 2 * radius).max(1),
1,
);
self.base
.fill_boxes2(slice::from_ref(&strip), &bg_color, srgb, perceptual, x, y);
@ -350,7 +354,10 @@ impl Renderer<'_> {
let text_x = match self.state.theme.tab_title_align.get() {
TabTitleAlign::Start => x + ex + text_padding + border_width,
TabTitleAlign::Center => {
x + ex + border_width + (tab_inner.max(0) - tex_width).max(0) / 2 + text_padding.min(tab_inner.max(0) / 2)
x + ex
+ border_width
+ (tab_inner.max(0) - tex_width).max(0) / 2
+ text_padding.min(tab_inner.max(0) / 2)
}
TabTitleAlign::End => {
let end_x = x + ex + ew - tex_width - text_padding - border_width;
@ -405,8 +412,7 @@ impl Renderer<'_> {
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 focused_border_color = self.state.theme.colors.focused_title_background.get();
let c = if child.active.get() {
&focused_border_color
} else {
@ -423,10 +429,21 @@ impl Renderer<'_> {
let frame_rects = [
Rect::new_sized_saturating(mb.x1() - bw, frame_y, bw, frame_h),
Rect::new_sized_saturating(mb.x2(), frame_y, bw, frame_h),
Rect::new_sized_saturating(mb.x1() - bw, frame_y - bw, full_w + 2 * bw, bw),
Rect::new_sized_saturating(mb.x1() - bw, frame_y + frame_h, full_w + 2 * bw, bw),
Rect::new_sized_saturating(
mb.x1() - bw,
frame_y - bw,
full_w + 2 * bw,
bw,
),
Rect::new_sized_saturating(
mb.x1() - bw,
frame_y + frame_h,
full_w + 2 * bw,
bw,
),
];
self.base.fill_boxes2(&frame_rects, c, srgb, perceptual, x, y);
self.base
.fill_boxes2(&frame_rects, c, srgb, perceptual, x, y);
} else {
let outer = Rect::new_sized_saturating(
mb.x1() - bw,
@ -477,12 +494,7 @@ impl Renderer<'_> {
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();
(
Some(srgb_srgb),
bw,
border_color,
focused_border_color,
)
(Some(srgb_srgb), bw, border_color, focused_border_color)
} else {
(None, 0, Color::SOLID_BLACK, Color::SOLID_BLACK)
};
@ -507,10 +519,21 @@ impl Renderer<'_> {
let frame_rects = [
Rect::new_sized_saturating(body.x1() - bw, body.y1(), bw, full_h),
Rect::new_sized_saturating(body.x2(), body.y1(), bw, full_h),
Rect::new_sized_saturating(body.x1() - bw, body.y1() - bw, full_w + 2 * bw, bw),
Rect::new_sized_saturating(body.x1() - bw, body.y2(), full_w + 2 * bw, bw),
Rect::new_sized_saturating(
body.x1() - bw,
body.y1() - 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, perceptual, x, y);
self.base
.fill_boxes2(&frame_rects, c, srgb, perceptual, x, y);
} else {
let outer = Rect::new_sized_saturating(
body.x1() - bw,
@ -533,11 +556,12 @@ impl Renderer<'_> {
}
}
let content = child.content.get();
self.stretch = if content.width() != body.width() || content.height() != body.height() {
Some(self.base.scale_point(body.width(), body.height()))
} else {
None
};
self.stretch =
if content.width() != body.width() || content.height() != body.height() {
Some(self.base.scale_point(body.width(), body.height()))
} else {
None
};
if !cr.is_zero() && !child.node.node_is_container() && gap != 0 {
let scalef = self.base.scalef as f32;
let inner_cr = cr.expanded_by(-(bw as f32)).scaled_by(scalef);
@ -624,7 +648,6 @@ impl Renderer<'_> {
self.render_surface_scaled(surface, x, y, None, bounds, false);
}
pub fn render_surface_scaled(
&mut self,
surface: &WlSurface,
@ -797,18 +820,8 @@ impl Renderer<'_> {
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,
),
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);
} else {
@ -825,12 +838,8 @@ impl Renderer<'_> {
bw as f32 * scalef,
);
}
let body = Rect::new_sized_saturating(
x + bw,
y + bw,
pos.width() - 2 * bw,
pos.height() - 2 * bw,
);
let body =
Rect::new_sized_saturating(x + bw, y + bw, pos.width() - 2 * bw, pos.height() - 2 * bw);
let scissor_body = self.base.scale_rect(body);
if !cr.is_zero() {
let scalef = self.base.scalef as f32;