Chrome's own frame: honor zxdg_toplevel_decoration_v1.set_mode(client_side)
CI / test (push) Successful in 2m18s

Chrome with "Use system title bar and borders" off, and its installed web apps (PWAs), ask
for client-side decoration. Chandra always answered server-side, and Chrome kept drawing its
own title bar and shadow anyway (window geometry 10px in), so Chandra's title bar showed above
Chrome's with Chrome's shadow as a gap. Now a client asking for client_side gets it and is
framed like a GTK window (ToplevelFrame client_side); unset_mode or server_side keep Chandra's
frame. Checked with Chromium 158 on Ozone Wayland, headless. Test in csd_test.mbt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkfW5ttNd831XmdsC5
This commit is contained in:
Claude committed 2026-11-26 02:27:05 +00:00
1 parent 81cb8f9a1c
commit 0a9787ae36
2 files changed
+58 -6

No files matched your search

+38
View File
@@ -179,3 +179,41 @@ test "dragging a GTK header bar moves the window, and its border resizes it" {
comp.handle_input(@nested.InputEvent::PointerButton(0x110U, false), 23U)
}
}
///|
test "Chrome asking to draw its own frame gets it, instead of a second one around it" {
// Chrome with "Use system title bar and borders" off (and its installed web apps) asks for
// client-side decoration and keeps drawing its own title bar and shadow even when told
// server-side: Chandra's title bar showed above Chrome's, with Chrome's shadow as a gap.
let socket_path = "/tmp/wayland-moon-csd-chrome-" + @sys.getpid().to_string() + ".sock"
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
comp.set_layout_mode(@wm.LayoutMode::Floating)
let (c, shm, surf, xdg, tl, deco) = open_and_configure_client(comp, socket_path, "YouTube", "chrome-youtube")
assert_eq(c.deco_mode, Some(2U))
// zxdg_toplevel_decoration_v1.set_mode(client_side)
let m = @wayland.WireWriter::new()
m.u32(1U)
c.send(m.finish_msg(deco, 1U))
for _i = 0; _i < 4; _i = _i + 1 {
comp.step()
c.read_events(xdg, tl, deco)
@sys.sleep_ms(2)
}
assert_eq(c.deco_mode, Some(1U))
ignore(gtk_frame(comp, c, shm, surf, xdg, tl))
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))
// unset_mode: back to Chandra's frame.
c.send(@wayland.WireWriter::new().finish_msg(deco, 2U))
for _i = 0; _i < 4; _i = _i + 1 {
comp.step()
c.read_events(xdg, tl, deco)
@sys.sleep_ms(2)
}
assert_eq(c.deco_mode, Some(2U))
ignore(gtk_frame(comp, c, shm, surf, xdg, tl))
assert_false(comp.windows.get(1UL).unwrap().csd)
}