Client-drawn window frames: GTK apps (GNOME Files) get no second title bar
CI / test (push) Successful in 2m57s

GTK never asks for server-side decoration (it has no xdg-decoration support), so it draws its
own header bar plus a transparent shadow margin around it, and says where the real window is
with xdg_surface.set_window_geometry. Chandra drew its Breeze frame around every window anyway
and blitted the whole buffer from the frame's corner: a second title bar on top, and the
content shifted down/right by the shadow (a see-through gap), with the right/bottom cut off.

- The server reports per window who draws the frame (ToplevelFrame: client-side when the
  client never made a zxdg_toplevel_decoration_v1, plus the window-geometry offset).
- A client-decorated window gets no Chandra frame and fills the frame's whole box
  (HostWindow::client_rect): it is configured for that size, drawn with its buffer shifted by
  the geometry offset (its own shadow drawn around it), and pointer coordinates and popup
  placement use the same origin. Tiling, title-bar hit areas and resize zones are unchanged.
- xdg_toplevel.move / resize (dragging a header bar, a CSD border) start Chandra's move and
  resize drags; they were ignored before.
- Tiled windows get the tiled_left/right/top/bottom states, so GTK drops its shadow and
  rounded corners there.

Checked with real Nautilus 46 and gtk4-demo on the headless native compositor. Tests:
compositor/host/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 01:35:31 +00:00
1 parent b097116ded
commit 90fdda2455
5 files changed
+405 -33

No files matched your search

+51
View File
@@ -127,3 +127,54 @@ fn ChandraCompositor::title_bar_release(self : ChandraCompositor) -> Unit {
None => ()
}
}
///|
/// xdg_toplevel.move from a client-decorated window (a press on its own title bar): the same
/// drag as a press on Chandra's title bar, without the double-click (the client handles that
/// and asks to maximize). Only while the press that asked for it is still held.
fn ChandraCompositor::client_move(self : ChandraCompositor, wid : UInt64) -> Unit {
if !self.press_fwd || self.ptr_win != Some(wid) || self.wm.drag is Some(_) {
return
}
// The compositor takes the pointer for the drag: the client sees it leave (and no release).
self.press_fwd = false
self.leave_pointer()
let x = self.ptr_x.to_int()
let y = self.ptr_y.to_int()
let tiled = match self.wm.windows.get(wid) {
Some(r) => !r.is_floating && !r.maximized && !r.fullscreen
None => return
}
self.title_press = Some({ wid, x, y, time: 0, held: true, moved: true, float_pending: tiled })
if !tiled {
ignore(self.wm.start_drag(wid, @wm.DragMode::Move, x, y))
}
}
///|
/// xdg_toplevel.resize from a client-decorated window (a press on its own border or shadow):
/// a floating window resizes from that edge, like Chandra's own resize zones. Tiled windows
/// resize through the dividers instead.
fn ChandraCompositor::client_resize(self : ChandraCompositor, wid : UInt64, edges : UInt) -> Unit {
if !self.press_fwd || self.ptr_win != Some(wid) || self.wm.drag is Some(_) {
return
}
match self.wm.windows.get(wid) {
Some(r) => if !r.is_floating || r.maximized || r.fullscreen { return }
None => return
}
let mode = match edges {
1U => @wm.DragMode::ResizeN
2U => @wm.DragMode::ResizeS
4U => @wm.DragMode::ResizeW
8U => @wm.DragMode::ResizeE
5U => @wm.DragMode::ResizeNW
9U => @wm.DragMode::ResizeNE
6U => @wm.DragMode::ResizeSW
10U => @wm.DragMode::ResizeSE
_ => return
}
self.press_fwd = false
self.leave_pointer()
ignore(self.wm.start_drag(wid, mode, self.ptr_x.to_int(), self.ptr_y.to_int()))
}