Window frames in the style of V's Flatkit Aurorae theme, the classic frame as a setting
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:
Claude committed 2026-11-26 04:09:38 +00:00
1 parent 2c2ce3f913
commit 14acc5d42e
20 files changed
+1005 -142

No files matched your search

+149 -45
View File
@@ -20,12 +20,27 @@ pub(all) struct HostWindow {
mut geo_y : Int
}
///| Height of the server-side title bar above `geometry`, and the frame's side/bottom border:
/// the layout in `@scene.build_breeze_decoration` (outer box w + 4, h + 34).
let frame_top : Int = 32
///| The window style in use (Settings > Session > Flat window frames). Global because the frame's
/// size is part of every window's on-screen box (`client_rect`); the compositor sets it from the
/// shell's setting (`ChandraCompositor::apply_window_style`).
let window_style : Ref[@scene.WindowStyle] = { val: @scene.WindowStyle::Flat }
///|
let frame_side : Int = 2
///| Height of the server-side frame above `geometry` (title bar, outline, hairline) ...
fn frame_top() -> Int {
window_style.val.frame_top()
}
///| ... and its border left, right and below.
fn frame_side() -> Int {
window_style.val.frame_side()
}
///| The frame's outer box around a server-decorated window's `geometry`.
fn frame_rect(g : @scene.Rect) -> @scene.Rect {
let t = frame_top()
let s = frame_side()
@scene.Rect::new(g.x - s, g.y - t, g.w + 2 * s, g.h + t + s)
}
///| The box the client's own window fills on screen. A server-decorated window's is its
/// geometry (Chandra's frame goes around it); a client-decorated one takes the frame's whole
@@ -33,7 +48,7 @@ let frame_side : Int = 2
pub fn HostWindow::client_rect(self : HostWindow) -> @scene.Rect {
let g = self.geometry
if self.csd && !self.fullscreen {
@scene.Rect::new(g.x - frame_side, g.y - frame_top, g.w + 2 * frame_side, g.h + frame_top + frame_side)
frame_rect(g)
} else {
g
}
@@ -207,6 +222,10 @@ pub(all) struct ChandraCompositor {
mut mods_latched : UInt
mut mods_locked : UInt
mut mods_group : UInt
/// The title-bar button under the pointer and the one held down: (window, button), button
/// 1 minimize, 2 maximize, 3 close. A press shows pressed; the release over it acts.
mut deco_hover : (UInt64, Int)?
mut deco_pressed : (UInt64, Int)?
}
///|
@@ -221,11 +240,14 @@ pub fn ChandraCompositor::new(
Some(s) => s
None => return None
}
// A new compositor starts in the default style; the shell's setting is applied from the
// first frame on (`sync_window_style`).
window_style.val = @scene.WindowStyle::Flat
let wm = @wm.WmState::new(
inner_gap=8,
outer_gap=8,
titlebar_h=32,
border_w=2,
titlebar_h=frame_top(),
border_w=frame_side(),
)
let work_area = work_area_for(output_w, output_h, theme)
let shell = @shell.DesktopShell::new(socket_path)
@@ -249,6 +271,8 @@ pub fn ChandraCompositor::new(
mods_latched: 0U,
mods_locked: 0U,
mods_group: 0U,
deco_hover: None,
deco_pressed: None,
settings_portal: None,
control: None,
login_session: false,
@@ -333,7 +357,7 @@ fn work_area_for(w : Int, h : Int, theme : @scene.ThemeTokens, kiosk~ : Bool = f
}
@wm.compute_work_area(
{ x: 0, y: 0, w, h },
excl_top=32, // room for the server-side title bar drawn above each client
excl_top=frame_top(), // room for the server-side title bar drawn above each client
excl_bottom=theme.panel_height,
)
}
@@ -584,7 +608,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
(Some(r), Some(win)) =>
if r.is_floating && !r.maximized && !r.fullscreen && self.wm.drag is None && self.split_drag is None {
// A client-decorated window's size includes the room of Chandra's frame.
let (w, h) = if win.csd { (w - 2 * frame_side, h - frame_top - frame_side) } else { (w, h) }
let (w, h) = if win.csd { (w - 2 * frame_side(), h - frame_top() - frame_side()) } else { (w, h) }
self.apply_actions(self.wm.handle_request(wid, @wm.WindowRequest::ResizeTo(w, h), self.work_area))
}
_ => ()
@@ -781,6 +805,7 @@ pub fn ChandraCompositor::restore_state(self : ChandraCompositor) -> Unit {
let st = self.shell.load_state()
self.shell.apply_state(st)
self.apply_theme()
self.sync_window_style()
match st.layout {
Some(0) => self.set_layout_mode(@wm.LayoutMode::Tiling)
Some(1) => self.set_layout_mode(@wm.LayoutMode::Monocle)
@@ -793,6 +818,7 @@ pub fn ChandraCompositor::restore_state(self : ChandraCompositor) -> Unit {
fn ChandraCompositor::build_scene(
self : ChandraCompositor,
) -> (@scene.SceneGraph, Bool) {
self.sync_window_style()
self.flush_configures()
self.overview_sync()
let scene = @scene.SceneGraph::new(self.output_w, self.output_h)
@@ -823,15 +849,40 @@ fn ChandraCompositor::build_scene(
surface: win.surface,
})
}
Some(win) if win.fullscreen =>
scene.windows.push({
id: win.id,
title: win.title,
app_id: win.app_id,
focused: win.focused,
fullscreen: true,
geometry: win.geometry,
deco_insets: (0, 0, 0, 0),
deco_ops: [],
surface: win.surface,
})
Some(win) => {
let (insets, deco_ops) = @scene.build_breeze_decoration(
win.title,
win.app_id,
win.focused,
win.fullscreen,
win.geometry.w + 4,
win.geometry.h + 34,
let outer = frame_rect(win.geometry)
let btn = fn(st : (UInt64, Int)?) {
match st {
Some((w, b)) if w == win.id => b
_ => 0
}
}
let (insets, deco_ops) = @scene.build_window_decoration(
window_style.val,
{
title: win.title,
app_id: win.app_id,
focused: win.focused,
maximized: win.maximized,
hover: btn(self.deco_hover),
pressed: btn(self.deco_pressed),
},
outer.w,
outer.h,
self.theme,
fn(s, size, bold) { @renderer.text_width(s, size, bold, false) },
)
scene.windows.push({
id: win.id,
@@ -1010,7 +1061,7 @@ pub fn ChandraCompositor::handle_gfx_events(
Some(win) =>
if px >= win.geometry.x &&
px < win.geometry.x + win.geometry.w &&
py >= win.geometry.y - 32 &&
py >= win.geometry.y - frame_top() &&
py < win.geometry.y + win.geometry.h {
self.apply_actions(
self.wm.handle_request(wid, @wm.WindowRequest::Activate, self.work_area),
@@ -1201,7 +1252,8 @@ fn ChandraCompositor::window_at(self : ChandraCompositor, x : Int, y : Int) -> (
if x >= g.x && x < g.x + g.w && y >= g.y && y < g.y + g.h {
return Some((win.id, true))
}
if x >= g.x - 2 && x < g.x + g.w + 2 && y >= g.y - 32 && y < g.y {
let f = frame_rect(g)
if x >= f.x && x < f.x + f.w && y >= f.y && y < g.y {
return Some((win.id, false))
}
}
@@ -1314,7 +1366,7 @@ fn ChandraCompositor::resize_at(
let g = win.geometry
let l = g.x
let r = g.x + g.w
let t = g.y - 32
let t = g.y - frame_top()
let b = g.y + g.h
if x >= l - 6 && x < r + 6 && y >= t - 6 && y < b + 6 {
if !rec.is_floating || rec.maximized || rec.fullscreen {
@@ -1358,7 +1410,7 @@ fn ChandraCompositor::resize_at(
}
///| Title-bar button under (x, y) for window `wid`: 1 minimize, 2 maximize, 3 close, 0 none.
/// Mirrors the layout in `build_breeze_decoration` (18px buttons, 8px apart, 10px from the right edge).
/// The layout is the window style's (`@scene.WindowStyle::buttons`), as drawn.
fn ChandraCompositor::title_button_at(
self : ChandraCompositor,
wid : UInt64,
@@ -1366,29 +1418,48 @@ fn ChandraCompositor::title_button_at(
y : Int,
) -> Int {
match self.windows.get(wid) {
None => 0
Some(win) => {
let g = win.geometry
let outer_w = g.w + 4
let lx = x - (g.x - 2)
let ly = y - (g.y - 32)
let size = 18
let by = (32 - size) / 2
if ly < by - 3 || ly >= by + size + 3 {
return 0
Some(win) if !win.csd && !win.fullscreen => {
let f = frame_rect(win.geometry)
window_style.val.button_at(f.w, x - f.x, y - f.y)
}
_ => 0
}
}
///| Track the title-bar button under the pointer (drawn in its hover state), redrawing when it
/// changes. While a button is held, only that one shows hovered (pressed) when under the pointer.
fn ChandraCompositor::title_button_hover(self : ChandraCompositor, x : Int, y : Int) -> Unit {
let now = match self.window_at(x, y) {
Some((wid, false)) =>
match self.title_button_at(wid, x, y) {
0 => None
b => Some((wid, b))
}
let close_x = outer_w - 10 - size
let max_x = close_x - 8 - size
let min_x = max_x - 8 - size
if lx >= close_x - 3 && lx < close_x + size + 3 {
3
} else if lx >= max_x - 3 && lx < max_x + size + 3 {
2
} else if lx >= min_x - 3 && lx < min_x + size + 3 {
1
} else {
0
_ => None
}
if now != self.deco_hover {
self.deco_hover = now
self.damage.mark_full()
}
}
///| A release ends a press on a title-bar button: the button acts when the pointer is still over
/// it (moving off first cancels, as in KWin). True when there was such a press.
fn ChandraCompositor::release_title_button(self : ChandraCompositor, x : Int, y : Int) -> Bool {
match self.deco_pressed {
None => false
Some((wid, btn)) => {
self.deco_pressed = None
self.damage.mark_full()
let over = match self.window_at(x, y) {
Some((w, false)) if w == wid => self.title_button_at(wid, x, y) == btn
_ => false
}
if over {
self.deco_hover = None
self.press_title_button(wid, btn)
}
true
}
}
}
@@ -1472,6 +1543,31 @@ fn ChandraCompositor::window_command(
self.damage.mark_full()
}
///| Use the shell's window style (Settings > Session > Flat window frames) if it isn't the one in
/// use: the frame's size changes, so the work area, the tiled layout and every client-decorated
/// window's size (it fills the frame's box) follow.
pub fn ChandraCompositor::sync_window_style(self : ChandraCompositor) -> Unit {
let style = self.shell.window_style
if style == window_style.val {
return
}
window_style.val = style
self.wm.titlebar_h = frame_top()
self.wm.border_w = frame_side()
self.work_area = work_area_for(self.output_w, self.output_h, self.theme, kiosk=self.kiosk_strict())
self.apply_actions(self.wm.fit_work_area(self.work_area))
for _, win in self.windows {
if win.csd {
self.configure_window(win)
}
}
self.deco_hover = None
self.deco_pressed = None
self.last_frame = None
self.last_sig = None
self.damage.mark_full()
}
///| Use the dark (configured) or the light theme, as the shell's Dark mode setting says, for the
/// shell, the panel modules, the window decorations and the switcher; redraws everything, and
/// (in the login session) tells apps through the system preference.
@@ -1493,6 +1589,7 @@ fn ChandraCompositor::run_shell_actions(self : ChandraCompositor) -> Unit {
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
@shell.ShellAction::Logout => self.quit_requested = true
@shell.ShellAction::ThemeChanged => self.apply_theme()
@shell.ShellAction::WindowStyleChanged => self.sync_window_style()
@shell.ShellAction::AuthAgentChanged => self.auth_agent_setting_changed()
@shell.ShellAction::Screenshot(code) => self.screenshot_request(code)
@shell.ShellAction::SystemPower(a) => self.system_power(a)
@@ -1522,9 +1619,9 @@ fn ChandraCompositor::handle_at(
let slop = 3
for h in self.wm.split_handles(self.work_area) {
let r = h.rect
// Title bars sit 32px above the windows, so the hit area reaches up over them.
// Title bars sit above the windows, so the hit area reaches up over them.
let hit = if h.horizontal {
x >= r.x - slop && x < r.x + r.w + slop && y >= r.y - 32 && y < r.y + r.h
x >= r.x - slop && x < r.x + r.w + slop && y >= r.y - frame_top() && y < r.y + r.h
} else {
y >= r.y - slop && y < r.y + r.h + slop && x >= r.x && x < r.x + r.w
}
@@ -1652,6 +1749,7 @@ pub fn ChandraCompositor::handle_input(
if self.overview_motion(xi, yi) {
return
}
self.title_button_hover(xi, yi)
if self.title_bar_motion(xi, yi) {
return
}
@@ -1796,6 +1894,9 @@ pub fn ChandraCompositor::handle_input(
if self.overview_button(button, pressed, xi, yi) {
return
}
if !pressed && self.release_title_button(xi, yi) {
return
}
if !pressed && button == 272U {
self.title_bar_release()
}
@@ -1844,7 +1945,10 @@ pub fn ChandraCompositor::handle_input(
Some((wid, false)) => {
let btn = self.title_button_at(wid, xi, yi)
if btn != 0 {
self.press_title_button(wid, btn)
// Shown pressed until the release, which acts if it is still over the button.
self.leave_pointer()
self.deco_pressed = Some((wid, btn))
self.damage.mark_full()
return
}
if button == 272U && self.resize_at(xi, yi) is None {
+2 -2
View File
@@ -100,7 +100,7 @@ test "a GTK window draws its own frame: no second title bar, and its shadow is n
assert_eq((win.geo_x, win.geo_y), (gtk_shadow, gtk_shadow))
// The client is asked to fill the frame's whole box: where Chandra's title bar would be is its own.
let r = win.client_rect()
assert_eq((r.w, r.h), (win.geometry.w + 4, win.geometry.h + 34))
assert_eq((r.w, r.h), (win.geometry.w + 2, win.geometry.h + 39))
let (w, h) = gtk_frame(comp, c, shm, surf, xdg, tl)
assert_eq((w, h), (r.w, r.h))
let red = Some(@scene.Rgba::new(0xff, 0, 0, 0xff))
@@ -204,7 +204,7 @@ test "Chrome asking to draw its own frame gets it, instead of a second one aroun
let win = comp.windows.get(1UL).unwrap()
assert_true(win.csd)
let r = win.client_rect()
assert_eq((r.w, r.h), (win.geometry.w + 4, win.geometry.h + 34))
assert_eq((r.w, r.h), (win.geometry.w + 2, win.geometry.h + 39))
// unset_mode: back to Chandra's frame.
c.send(@wayland.WireWriter::new().finish_msg(deco, 2U))
+92
View File
@@ -0,0 +1,92 @@
///| Window frames: the flat (Flatkit Aurorae) style's button states, and switching styles.
///|
test "title-bar buttons hover, show pressed, act on release and cancel when left" {
let socket_path = "/tmp/wayland-moon-decohover-" + @sys.getpid().to_string() + ".sock"
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(comp.compose_frame())
let (mx, my) = button_centre(comp, 1UL, 2)
let move = fn(x : Int, y : Int, t : UInt) {
comp.handle_input(@nested.InputEvent::PointerMove(x.to_double(), y.to_double()), t)
}
move(mx, my, 1U)
assert_eq(comp.deco_hover, Some((1UL, 2)))
move(mx - 28, my, 2U)
assert_eq(comp.deco_hover, Some((1UL, 1)))
// Press maximize: shown pressed, nothing happens yet.
move(mx, my, 3U)
let w0 = comp.windows.get(1UL).unwrap().geometry.w
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 4U)
assert_eq(comp.deco_pressed, Some((1UL, 2)))
assert_eq(comp.windows.get(1UL).unwrap().geometry.w, w0)
ignore(comp.compose_frame())
// Moving off and releasing cancels.
move(mx, my + 60, 5U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 6U)
assert_eq(comp.deco_pressed, None)
assert_eq(comp.windows.get(1UL).unwrap().geometry.w, w0)
// Press and release over it: it maximizes.
move(mx, my, 7U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 8U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 9U)
assert_true(comp.windows.get(1UL).unwrap().maximized)
// Off the title bar nothing is hovered.
move(600, 400, 10U)
assert_eq(comp.deco_hover, None)
}
///|
test "Flat window frames off switches to the classic frame: sizes, layout and state.edn follow" {
let socket_path = "/tmp/wayland-moon-decostyle-" + @sys.getpid().to_string() + ".sock"
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(comp.compose_frame())
let flat_area = comp.work_area
assert_eq(comp.shell.window_style, @scene.WindowStyle::Flat)
assert_eq(comp.wm.titlebar_h, 38)
// The settings module's sixth switch, "Flat window frames", off.
comp.shell.set_session_setting(5, false)
ignore(comp.compose_frame())
assert_eq(comp.shell.window_style, @scene.WindowStyle::Breeze)
assert_eq((comp.wm.titlebar_h, comp.wm.border_w), (32, 2))
assert_eq(comp.work_area.y, flat_area.y - 6)
// The tiled window moved up with the work area.
let g = comp.windows.get(1UL).unwrap().geometry
assert_eq(g.y, comp.work_area.y + 8)
// The classic buttons are where they are drawn: the close button 10px from the right edge.
let outer_w = g.w + 4
let close = @scene.WindowStyle::Breeze.buttons(outer_w)[2].1
assert_eq(close.x, outer_w - 28)
comp.shell.set_session_setting(5, true)
ignore(comp.compose_frame())
assert_eq(comp.work_area, flat_area)
}
///|
test "state.edn :window-style :breeze turns Flat window frames off" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
let dir = @sys.getenv("XDG_CONFIG_HOME") + "/chandra"
assert_true(@sys.mkdir_p(dir))
let state0 = @sys.read_file_bytes(dir + "/state.edn")
ignore(@sys.write_file_bytes(dir + "/state.edn", @utf8.encode("{:window-style :breeze}\n")))
let boot = fn() {
let s = @shell.DesktopShell::new("x")
s.persist = true
s.set_output(@scene.ThemeTokens::moon_night(), 1280, 720)
ignore(s.slots())
s.apply_state(s.load_state())
s
}
let a = boot()
assert_eq(a.window_style, @scene.WindowStyle::Breeze)
a.set_session_setting(5, true)
let text = @utf8.decode_lossy(@sys.read_file_bytes(dir + "/state.edn"))
assert_false(text.contains("window-style"))
a.set_session_setting(5, false)
let text = @utf8.decode_lossy(@sys.read_file_bytes(dir + "/state.edn"))
assert_true(text.contains(":window-style :breeze"))
assert_eq(boot().window_style, @scene.WindowStyle::Breeze)
ignore(@sys.write_file_bytes(dir + "/state.edn", state0))
}
}
+14 -10
View File
@@ -37,6 +37,16 @@ fn new_comp(tag : String) -> @host.ChandraCompositor {
comp
}
///| Centre of title-bar button `n` (1 minimize, 2 maximize, 3 close) of window `wid`, in the
/// default (flat) window style.
fn button_centre(comp : @host.ChandraCompositor, wid : UInt64, n : Int) -> (Int, Int) {
let style = @scene.WindowStyle::Flat
let g = comp.windows.get(wid).unwrap().geometry
let (ox, oy) = (g.x - style.frame_side(), g.y - style.frame_top())
let r = style.buttons(g.w + 2 * style.frame_side())[n - 1].1
(ox + r.x + r.w / 2, oy + r.y + r.h / 2)
}
///| Drain everything the compositor sent this client as (object, opcode) pairs.
fn drain_msgs(c : TestWaylandClient) -> Array[(UInt, UInt)] {
let scratch : FixedArray[Byte] = FixedArray::make(65536, b'\x00')
@@ -223,14 +233,8 @@ test "title-bar buttons minimize, maximize and close windows" {
let (c, _shm, _surf, _xdg, tl, _deco) = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame())
// Button centres, from the decoration layout (18px buttons, 10px from the right edge).
let btn = fn(wid : UInt64, n : Int) {
let g = comp.windows.get(wid).unwrap().geometry
let outer_w = g.w + 4
let x = g.x - 2 + outer_w - 10 - 9 - (3 - n) * 26
let y = g.y - 32 + 16
(x, y)
}
// Button centres, from the flat frame's layout (24px buttons, 8px from the right edge).
let btn = fn(wid : UInt64, n : Int) { button_centre(comp, wid, n) }
let click = fn(p : (Int, Int), t : UInt) {
click_at(comp, p.0, p.1, t)
}
@@ -1694,8 +1698,8 @@ test "open_settings opens the settings module on the tab asked for" {
assert_eq(pr.h, 40 + (1 + 5 + 6) * 28 + 6)
assert_true(comp.shell.open_settings(Session))
ignore(comp.compose_frame())
// The five settings, then Face unlock (a heading; chandra-face isn't installed in tests).
assert_eq(comp.shell.slot_popup_rect(slot).h, 40 + 7 * 28 + 6)
// The six settings, then Face unlock (a heading; chandra-face isn't installed in tests).
assert_eq(comp.shell.slot_popup_rect(slot).h, 40 + 8 * 28 + 6)
assert_true(
comp.shell.slot_popup_texts(slot).iter().any(t => t.0.has_prefix("Lighter animations (")),
)
+2 -1
View File
@@ -10,7 +10,8 @@ test "resize redraws the desktop at the new output size" {
let after = comp.compose_frame()
assert_eq((after.width, after.height), (900, 560))
assert_eq((comp.output_w, comp.output_h), (900, 560))
assert_eq(comp.work_area.h, 560 - 32 - comp.theme.panel_height)
// The flat frame's 38px title bar is kept free at the top.
assert_eq(comp.work_area.h, 560 - 38 - comp.theme.panel_height)
assert_eq(comp.server.output_w, 900)
comp.close()
}
+1 -1
View File
@@ -224,7 +224,7 @@ fn ChandraCompositor::outer_rect(self : ChandraCompositor, wid : UInt64) -> @sce
let r = if win.fullscreen {
g
} else {
@scene.Rect::new(g.x - 2, g.y - 32, g.w + 4, g.h + 34)
frame_rect(g)
}
Some(self.clip_to_screen(r))
}
+2 -2
View File
@@ -118,12 +118,12 @@ test "escape cancels the overlay; a click on a window selects it; W takes the ac
let g = comp.windows.get(1UL).unwrap().geometry
chord(comp, [125U, 42U], 65U, 31U, 10U)
click_at(comp, g.x + 20, g.y + 20, 20U)
assert_eq(comp.screenshot_selection(), Some(@scene.Rect::new(g.x - 2, g.y - 32, g.w + 4, g.h + 34)))
assert_eq(comp.screenshot_selection(), Some(@scene.Rect::new(g.x - 1, g.y - 38, g.w + 2, g.h + 39)))
// W takes the active window (B) instead.
key(comp, 17U, true, 30U)
key(comp, 17U, false, 31U)
let gb = comp.windows.get(2UL).unwrap().geometry
assert_eq(png_size(@sys.read_file_bytes(comp.last_screenshot())), (gb.w + 4, gb.h + 34))
assert_eq(png_size(@sys.read_file_bytes(comp.last_screenshot())), (gb.w + 2, gb.h + 39))
}
///|