X11 dock bridge: show and control host EWMH windows under --x11
CI / test (push) Failing after 2m37s
CI / test (push) Failing after 2m37s
Under --x11 with a host EWMH window manager (e.g. Openbox in Gamerig), Chandra is one top-level X11 client while other apps run directly on Xorg, so the dock only saw Chandra's Wayland windows. - compositor/x11: intern EWMH/ICCCM atoms and track _NET_CLIENT_LIST, _NET_ACTIVE_WINDOW, titles, and window states via PropertyChangeMask, filtering non-taskbar/child windows and adding focus, close, minimize, and toggle-maximize EWMH/ICCCM actions. - compositor/shell: add resolve_external_app_id (matching WM_CLASS and StartupWMClass against installed .desktop files) and publish_windows. - compositor/host: bridge ExternalWindow entries with bit-30 tagged IDs into shell.windows/win_list while keeping Wayland wm.windows and session snapshots untouched, and route activate_task / window_command actions. - compositor/app, compositor/bin, docs/x11.md: wire external window sync before X11 input handling and register ExternalWindowHandler. Verified: moon test --target native compositor/x11 compositor/shell (38/38), external_windows_test.mbt + dock_test.mbt (3/3), build-compositor-wasm.sh, and moon build --target native compositor/bin.
This commit is contained in:
1 parent
15b7c3f0e3
commit
1871d50a3e
12 files changed
+949
-68
No files matched your search
@@ -309,6 +309,9 @@ pub(all) struct ChandraCompositor {
|
||||
/// 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)?
|
||||
/// External windows from the host X11 WM (`--x11`), bridged into the dock/panel only.
|
||||
mut ext_windows : Array[ExternalWindow]
|
||||
mut ext_handler : ExternalWindowHandler?
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -443,6 +446,8 @@ pub fn ChandraCompositor::new(
|
||||
rec_press: false,
|
||||
last_recording: "",
|
||||
kiosk: None,
|
||||
ext_windows: [],
|
||||
ext_handler: None,
|
||||
}
|
||||
// Client popups (menus) are placed to stay on screen: the server asks for the output's
|
||||
// rectangle relative to the parent's content origin when it applies constraint adjustment.
|
||||
@@ -1118,46 +1123,7 @@ fn ChandraCompositor::build_scene(
|
||||
@wm.LayoutMode::Monocle => 1
|
||||
@wm.LayoutMode::Floating => 2
|
||||
}
|
||||
// The task list shows every window, minimized ones too (so they can be restored).
|
||||
let wins : Array[@shell.WinInfo] = []
|
||||
for wid in order {
|
||||
match self.windows.get(wid) {
|
||||
Some(win) =>
|
||||
wins.push({
|
||||
id: win.id,
|
||||
title: if win.title.length() > 0 { win.title } else { win.app_id },
|
||||
focused: win.focused,
|
||||
minimized: false,
|
||||
maximized: win.maximized,
|
||||
})
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
for id, r in self.wm.windows {
|
||||
if r.minimized {
|
||||
match self.windows.get(id) {
|
||||
Some(win) =>
|
||||
wins.push({
|
||||
id,
|
||||
title: if win.title.length() > 0 { win.title } else { win.app_id },
|
||||
focused: false,
|
||||
minimized: true,
|
||||
maximized: win.maximized,
|
||||
})
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
self.shell.windows = wins
|
||||
// The window list the `windows` interface serves to wasm widgets (task-bar order).
|
||||
let entries : Array[@wasm.WindowEntry] = []
|
||||
for w in wins {
|
||||
match self.windows.get(w.id) {
|
||||
Some(win) => entries.push({ id: w.id, title: w.title, app_id: win.app_id, focused: w.focused })
|
||||
None => ()
|
||||
}
|
||||
}
|
||||
self.shell.win_list = entries
|
||||
self.sync_shell_windows()
|
||||
self.shell.screenshot_state = (if self.rec is Some(_) { 1 } else { 0 }) |
|
||||
(if self.rec_pointer { 2 } else { 0 })
|
||||
// A window over the whole desktop (maximized, fullscreen, monocle) pauses a desktop module's
|
||||
@@ -1714,6 +1680,16 @@ fn ChandraCompositor::activate_window(self : ChandraCompositor, wid : UInt64) ->
|
||||
|
||||
///| Restore a minimized window (or focus a visible one) from its task-bar pill.
|
||||
fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> Unit {
|
||||
match external_host_id(wid) {
|
||||
Some(xid) => {
|
||||
match self.ext_handler {
|
||||
Some(h) => (h.focus)(xid)
|
||||
None => ()
|
||||
}
|
||||
return
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
let minimized = match self.wm.windows.get(wid) {
|
||||
Some(r) => r.minimized
|
||||
None => return
|
||||
@@ -1735,6 +1711,17 @@ fn ChandraCompositor::window_command(
|
||||
wid : UInt64,
|
||||
cmd : @shell.WindowCommand,
|
||||
) -> Unit {
|
||||
match external_host_id(wid) {
|
||||
Some(xid) => {
|
||||
match self.ext_handler {
|
||||
Some(h) => (h.command)(xid, cmd)
|
||||
None => ()
|
||||
}
|
||||
self.damage.mark_full()
|
||||
return
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
if self.wm.windows.get(wid) is None {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user