--x11 shows the desktop on the X server in $DISPLAY: a resizable window under a window manager (--fullscreen asks it for fullscreen), or the whole screen when no window manager runs, following xrandr resizes. compositor/x11 is a pure X11 wire-protocol client (no libX11/xcb), so it runs in the wasm compositor on both hosts and in the native build. Frames go through MIT-SHM 1.2 (ShmAttachFd of the host frame memfd, paced by ShmCompletion), with a core PutImage fallback. The keymap given to clients is the X server's own (xkbcomp -xkb $DISPLAY -); X auto-repeat is dropped, modifier/lock state comes from X's modifier map; MIT-MAGIC-COOKIE-1 auth. chandra-session --x11 (and the new "Chandra (X11)" xsessions entry) runs it as the login session; --login-session gives an X11 session what --drm implied (power actions, polkit agent, system theme). just run-x11. Docs: docs/x11.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhLFs4VtHV26G1iyeo
This commit is contained in:
14 files changed
+1777
-19
No files matched your search
@@ -0,0 +1,8 @@
|
||||
import {
|
||||
"moonbitlang/core/builtin",
|
||||
"chandra/desktop/compositor/sys" @sys,
|
||||
"chandra/desktop/compositor/renderer" @renderer,
|
||||
"chandra/desktop/compositor/nested" @nested,
|
||||
}
|
||||
|
||||
supported_targets = "+native+wasm"
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,54 @@
|
||||
///|
|
||||
test "parse_display: local displays only" {
|
||||
assert_eq(@x11.parse_display(":0"), Some((0, 0)))
|
||||
assert_eq(@x11.parse_display(":1.2"), Some((1, 2)))
|
||||
assert_eq(@x11.parse_display("unix:10"), Some((10, 0)))
|
||||
assert_eq(@x11.parse_display("localhost:10.0"), None)
|
||||
assert_eq(@x11.parse_display(""), None)
|
||||
assert_eq(@x11.parse_display(":"), None)
|
||||
}
|
||||
|
||||
///| One Xauthority entry: family, address, display number, auth name, data (big-endian lengths).
|
||||
fn xauth_entry(family : Int, addr : String, num : String, data : Array[Byte]) -> Array[Byte] {
|
||||
let out : Array[Byte] = []
|
||||
fn field(b : Array[Byte]) -> Unit {
|
||||
out.push(((b.length() >> 8) & 0xFF).to_byte())
|
||||
out.push((b.length() & 0xFF).to_byte())
|
||||
for c in b {
|
||||
out.push(c)
|
||||
}
|
||||
}
|
||||
|
||||
fn text(s : String) -> Array[Byte] {
|
||||
let b : Array[Byte] = []
|
||||
for c in s {
|
||||
b.push(c.to_int().to_byte())
|
||||
}
|
||||
b
|
||||
}
|
||||
|
||||
out.push(((family >> 8) & 0xFF).to_byte())
|
||||
out.push((family & 0xFF).to_byte())
|
||||
field(text(addr))
|
||||
field(text(num))
|
||||
field(text("MIT-MAGIC-COOKIE-1"))
|
||||
field(data)
|
||||
out
|
||||
}
|
||||
|
||||
///|
|
||||
test "xauth_cookie: picks this host's entry for the display" {
|
||||
let file : Array[Byte] = []
|
||||
file.append(xauth_entry(256, "otherhost", "0", [b'\x01']))
|
||||
file.append(xauth_entry(256, "rig", "1", [b'\x02']))
|
||||
file.append(xauth_entry(256, "rig", "0", [b'\x03', b'\x04']))
|
||||
let f = Bytes::from_array(file)
|
||||
assert_eq(@x11.xauth_cookie(f, 0, "rig").to_array(), [b'\x03', b'\x04'])
|
||||
assert_eq(@x11.xauth_cookie(f, 1, "rig").to_array(), [b'\x02'])
|
||||
// No entry for this host: any local one for the display.
|
||||
assert_eq(@x11.xauth_cookie(f, 0, "elsewhere").to_array(), [b'\x01'])
|
||||
assert_eq(@x11.xauth_cookie(f, 7, "rig").length(), 0)
|
||||
// FamilyWild (xauth's "ffff" entries, as Docker setups write) matches any host.
|
||||
let wild = Bytes::from_array(xauth_entry(0xFFFF, "", "0", [b'\x09']))
|
||||
assert_eq(@x11.xauth_cookie(wild, 0, "rig").to_array(), [b'\x09'])
|
||||
}
|
||||
Reference in new issue
Block a user