Compile the compositor to a wasm component, run by a small wasmtime host
CI / test (push) Failing after 22s
CI / test (push) Failing after 22s
The whole compositor (Wayland server, window manager, scene, rasteriser, shell) now builds as build/components/compositor.wasm: a component that imports only moonplasma:host/sys (wit/host/sys.wit: sockets + SCM_RIGHTS, memfd, poll, spawn, files, clock) and exports run(). host-wasm/ is the native side: a wasmtime program implementing that interface with libc. - compositor/sys: per-target backends (sys_native.mbt over the C shim, sys_wasm.mbt over the WIT imports) behind one API; wayland/nested/host/shell/scene/renderer/gfx build for wasm unchanged. - compositor/app: the entry point (arg parsing + main loop) as a library for both targets; --serve keeps refreshing a PNG so a live compositor can be inspected without a display. - compositor/font, compositor/wasm: wasm-side placeholders (bitmap font; no panel modules yet, since a component can't embed a second wasm runtime: that becomes a host import). - scripts/gen-native-stubs.py: native stand-ins for wasm-only generated imports. - just compositor-wasm / host-wasm / run-wasm. Verified: foot connects to the component's socket and renders into it; native build and tests unchanged (16/23, the same 7 need unbuilt panel modules). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92d2b29889
commit
6aba9b6a4f
42 files changed
+3163
-10
No files matched your search
@@ -5,4 +5,4 @@ import {
|
||||
"moonplasma/desktop/compositor/wayland" @wayland,
|
||||
}
|
||||
|
||||
supported_targets = "-all+native"
|
||||
supported_targets = "+native+wasm"
|
||||
@@ -129,7 +129,7 @@ fn NestedWindow::dispatch(
|
||||
if op == 0U {
|
||||
let _id = r.u32()
|
||||
let _code = r.u32()
|
||||
println("nested: host wl_display error: " + r.str())
|
||||
@sys.log("nested: host wl_display error: " + r.str())
|
||||
self.closed = true
|
||||
}
|
||||
} else if obj == 2U {
|
||||
@@ -342,7 +342,7 @@ pub fn NestedWindow::open(
|
||||
self.seat_id = self.bind("wl_seat", 5U)
|
||||
self.shape_mgr_id = self.bind("wp_cursor_shape_manager_v1", 1U)
|
||||
if self.comp_id == 0U || self.shm_id == 0U || self.wm_id == 0U {
|
||||
println("nested: host compositor lacks wl_compositor/wl_shm/xdg_wm_base")
|
||||
@sys.log("nested: host compositor lacks wl_compositor/wl_shm/xdg_wm_base")
|
||||
return None
|
||||
}
|
||||
self.surf_id = self.alloc()
|
||||
@@ -381,7 +381,7 @@ pub fn NestedWindow::open(
|
||||
tries = tries + 1
|
||||
}
|
||||
if !self.configured {
|
||||
println("nested: host never sent xdg_surface.configure")
|
||||
@sys.log("nested: host never sent xdg_surface.configure")
|
||||
return None
|
||||
}
|
||||
Some(self)
|
||||
|
||||
Reference in new issue
Block a user