GTK 3 windows get Chandra's frame: org_kde_kwin_server_decoration
CI / test (push) Successful in 12m52s
CI / test (push) Successful in 12m52s
GTK 3 has no xdg-decoration support, so every GTK 3 window without its own header bar (Webby, Nemo-style apps) drew GTK's fallback title bar: a centered title, only a close button, and a dark border inside Chandra's CSD box. GTK 3 asks for server-side decoration through KWin's org_kde_kwin_server_decoration instead. Chandra now advertises it with default mode Server; request_mode(Client) (GTK 3 apps with a header bar) keeps their own frame. The Settings portal also answers org.gnome.desktop.wm.preferences button-layout "appmenu:minimize,maximize,close", so apps that still draw their own title bar show the same three buttons as Chandra's frame. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hghaEWWsCBgEq6iZHj
This commit is contained in:
4 files changed
+117
-4
No files matched your search
@@ -52,6 +52,11 @@ enum ObjKind {
|
||||
ObjXdgPopup(UInt64)
|
||||
ObjDecoManager
|
||||
ObjToplevelDeco(UInt64)
|
||||
/// org_kde_kwin_server_decoration_manager: GTK 3's way of asking for server-side decoration
|
||||
/// (it has no xdg-decoration support).
|
||||
ObjKdeDecoManager
|
||||
/// org_kde_kwin_server_decoration for the wl_surface with this id.
|
||||
ObjKdeDeco(UInt)
|
||||
ObjSeat
|
||||
ObjPointer
|
||||
ObjKeyboard
|
||||
@@ -99,6 +104,9 @@ struct SurfaceState {
|
||||
mut window_id : UInt64?
|
||||
/// wl_surface.set_buffer_scale: the buffer is this many times the window's size.
|
||||
mut buffer_scale : Int
|
||||
/// org_kde_kwin_server_decoration mode Server: Chandra draws this window's frame (GTK 3 apps
|
||||
/// without their own header bar, like Webby).
|
||||
mut kde_ssd : Bool
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -361,6 +369,7 @@ fn emit_registry_globals(c : ClientConn, reg_id : UInt) -> Unit {
|
||||
(7U, "wl_subcompositor", 1U),
|
||||
(8U, "wl_data_device_manager", 3U),
|
||||
(9U, "wp_cursor_shape_manager_v1", 1U),
|
||||
(10U, "org_kde_kwin_server_decoration_manager", 1U),
|
||||
]
|
||||
for g in globals {
|
||||
let w = WireWriter::new()
|
||||
@@ -565,6 +574,11 @@ fn WaylandServer::dispatch_msg(
|
||||
c.objects.set(new_id, ObjXdgWmBase)
|
||||
} else if iface == "zxdg_decoration_manager_v1" {
|
||||
c.objects.set(new_id, ObjDecoManager)
|
||||
} else if iface == "org_kde_kwin_server_decoration_manager" {
|
||||
c.objects.set(new_id, ObjKdeDecoManager)
|
||||
// default_mode(Server): GTK 3 then leaves out its own title bar and shadow on every
|
||||
// window that has no custom header bar, and asks for Chandra's frame.
|
||||
send_decoration_mode(c, new_id, 2U)
|
||||
} else if iface == "wl_seat" {
|
||||
c.objects.set(new_id, ObjSeat)
|
||||
c.seat_ver = ver
|
||||
@@ -591,6 +605,7 @@ fn WaylandServer::dispatch_msg(
|
||||
xdg_surface_id: None,
|
||||
window_id: None,
|
||||
buffer_scale: 1,
|
||||
kde_ssd: false,
|
||||
})
|
||||
} else if opcode == 1U {
|
||||
let rid = reader.u32()
|
||||
@@ -658,7 +673,13 @@ fn WaylandServer::dispatch_msg(
|
||||
Some(xs) => (xs.geo_x, xs.geo_y)
|
||||
None => (0, 0)
|
||||
}
|
||||
let frame = (tl.deco_obj_id is None || tl.wants_csd, gx, gy)
|
||||
let kde_ssd = match c.surfaces.get(tl.wl_surface_id) {
|
||||
Some(s) => s.kde_ssd
|
||||
None => false
|
||||
}
|
||||
let client_side = tl.wants_csd ||
|
||||
(tl.deco_obj_id is None && !kde_ssd)
|
||||
let frame = (client_side, gx, gy)
|
||||
if tl.frame_sent != Some(frame) {
|
||||
tl.frame_sent = Some(frame)
|
||||
events.push(ToplevelFrame(wid, frame.0, gx, gy))
|
||||
@@ -1206,6 +1227,38 @@ fn WaylandServer::dispatch_msg(
|
||||
// Negotiate Server-Side Decoration (2)
|
||||
send_decoration_mode(c, deco_id, 2U)
|
||||
}
|
||||
ObjKdeDecoManager =>
|
||||
if opcode == 0U {
|
||||
// create(id, surface): KWin's protocol starts every decoration in the default mode.
|
||||
let deco_id = reader.u32()
|
||||
let sid = reader.u32()
|
||||
c.objects.set(deco_id, ObjKdeDeco(sid))
|
||||
match c.surfaces.get(sid) {
|
||||
Some(s) => s.kde_ssd = true
|
||||
None => ()
|
||||
}
|
||||
send_decoration_mode(c, deco_id, 2U)
|
||||
}
|
||||
ObjKdeDeco(sid) =>
|
||||
if opcode == 0U {
|
||||
// release: the client draws its own frame again.
|
||||
match c.surfaces.get(sid) {
|
||||
Some(s) => s.kde_ssd = false
|
||||
None => ()
|
||||
}
|
||||
c.objects.remove(obj_id)
|
||||
send_delete_id(c, obj_id)
|
||||
} else if opcode == 1U {
|
||||
// request_mode(mode): 2 Server gets Chandra's frame; 1 Client (a GTK 3 app with its own
|
||||
// header bar) and 0 None draw their own.
|
||||
let mode = reader.u32()
|
||||
let ssd = mode == 2U
|
||||
match c.surfaces.get(sid) {
|
||||
Some(s) => s.kde_ssd = ssd
|
||||
None => ()
|
||||
}
|
||||
send_decoration_mode(c, obj_id, mode)
|
||||
}
|
||||
ObjToplevelDeco(wid) =>
|
||||
if opcode == 0U {
|
||||
// Without its decoration object the client goes back to drawing its own frame.
|
||||
|
||||
Reference in new issue
Block a user