Window frames in the style of V's Flatkit Aurorae theme, the classic frame as a setting
CI / test (push) Canceled after 52s
CI / test (push) Canceled after 52s
The default frame now follows codegod100/kde aurorae (Flatkit / Flatkit Dark): the kit's neutral title bar, a 1px outline with 10px top corners, a hairline under the title, a soft 16px shadow all round, a centred title and 24px flat buttons with hover and pressed fills (close turns red). 38px title bar, 1px border. Maximized: no shadow, square corners. - scene: WindowStyle (frame sizes, button layout, hit test) and build_window_decoration; the shadow is part of the decoration ops, so the three rasterisers lost their own offset shadow and redraw 18px around a changed window. - host: the frame size follows the style (work area, wm title-bar room, CSD client boxes, hit zones, screenshots); title-bar buttons track hover, show pressed, act on release. - Settings > Session > Flat window frames (off: the old Breeze-like frame), saved as :window-style :breeze; an unknown value is logged. - docs/window-frames.md; tests for both styles' pixels, button states and switching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hmKDDLLES2aBrrnPxT
This commit is contained in:
20 files changed
+1005
-142
No files matched your search
+8
-25
@@ -828,8 +828,9 @@ pub struct Raster {
|
||||
pub last_drawn: usize,
|
||||
}
|
||||
|
||||
/// Room around a window for its drop shadow (4 px right, 6 px down) and a little slack.
|
||||
const SHADOW_PAD: i32 = 8;
|
||||
/// Room around a window's frame for its shadow, which the decoration ops draw (up to 16 px all
|
||||
/// round for the flat frame, `decoration_shadow_reach` in compositor/scene).
|
||||
const SHADOW_PAD: i32 = 18;
|
||||
|
||||
/// What a window covers on screen: its decoration and drop shadow, or just itself when fullscreen.
|
||||
fn window_footprint(win: &wt::Window) -> R {
|
||||
@@ -1017,25 +1018,8 @@ impl Raster {
|
||||
}
|
||||
}
|
||||
if !win.fullscreen {
|
||||
// The frame, shadow included, is all in the decoration ops.
|
||||
let (outer_x, outer_y) = (g.x - win.inset_left, g.y - win.inset_top);
|
||||
let outer_w = g.w + win.inset_left + win.inset_right;
|
||||
let outer_h = g.h + win.inset_top + win.inset_bottom;
|
||||
// Subtle drop shadow: only the strips that stick out from under the window (and the
|
||||
// part under the translucent title bar) are blended.
|
||||
let shadow = R { x: outer_x + 4, y: outer_y + 6, w: outer_w, h: outer_h };
|
||||
let col = wt::Color { r: 0, g: 0, b: 0, a: 80 };
|
||||
let strips = [
|
||||
R { x: outer_x + outer_w, y: outer_y, w: 4, h: outer_h + 6 },
|
||||
R { x: outer_x, y: outer_y + outer_h, w: outer_w + 4, h: 6 },
|
||||
R { x: outer_x, y: outer_y, w: outer_w, h: win.inset_top + 2 },
|
||||
];
|
||||
for s in strips {
|
||||
if let Some(k) = intersect(Some(s), clip) {
|
||||
if k.w > 0 && k.h > 0 {
|
||||
fill_rounded_rect(&mut c, shadow, col, 8, Some(k));
|
||||
}
|
||||
}
|
||||
}
|
||||
draw_ops(&mut c, fonts, imgs, &win.deco, outer_x, outer_y, clip);
|
||||
}
|
||||
match surfaces.get(&win.surface) {
|
||||
@@ -1170,7 +1154,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn windows_blit_their_surface_converted_from_bgra_and_shadow_only_sticks_out() {
|
||||
fn windows_blit_their_surface_converted_from_bgra_and_the_host_draws_no_shadow() {
|
||||
let mut r = Raster::default();
|
||||
// A 4x2 XRGB buffer, every pixel B=10 G=20 R=30.
|
||||
let bgra: Vec<u8> = (0..8).flat_map(|_| [10u8, 20, 30, 0]).collect();
|
||||
@@ -1190,10 +1174,9 @@ mod tests {
|
||||
r.submit(&f, &mut Fonts::default());
|
||||
assert_eq!(px(&r, 10, 10), [30, 20, 10, 255]); // R, G, B order after conversion
|
||||
assert_eq!(px(&r, 13, 11), [30, 20, 10, 255]);
|
||||
// The shadow sits to the right of / below the window, not under it.
|
||||
// The shadow rectangle is the window moved by (4, 6): (14..18, 16..18) here.
|
||||
assert!(px(&r, 15, 17)[0] < 200, "shadow strip below and to the right");
|
||||
assert_eq!(px(&r, 15, 12)[0], 200, "no shadow where the offset rectangle does not reach");
|
||||
// The shadow is the decoration's to draw (compositor/scene): none without its ops.
|
||||
assert_eq!(px(&r, 15, 17)[0], 200, "no shadow of the host's own");
|
||||
assert_eq!(px(&r, 9, 10)[0], 200);
|
||||
r.release(id);
|
||||
assert_eq!(r.surface_count(), 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user