Remove the Rust host (host-wasm)
CI / test (push) Canceled after 0s

The MoonBit host (wasmhost/, build/wasmhost) is the only host now. Gone:
host-wasm/ (Rust on the wasmtime crate, ~5,700 lines incl. Cargo.lock),
the run-rust, run-drm-rust and host-wasm recipes, and `just install --rust`
(both the recipe and session/install.py now stop with an error naming the
removal instead of quietly ignoring the flag). remote-build.sh builds and
pulls build/wasmhost. README, wasmhost/README and docs no longer describe a
second host, apart from short history notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiBxpbLoeUM9xfZayq
This commit is contained in:
Claude committed 2026-11-26 04:19:19 +00:00
1 parent 024f18ce61
commit 41c6ec1135
31 files changed
+59 -5827

No files matched your search

-1
View File
@@ -7,7 +7,6 @@ node_modules/
*.log *.log
host-native/target/ host-native/target/
.pixi/ .pixi/
host-wasm/target/
# moon rewrites these for whichever target was built last, so they differ run to run. A few # moon rewrites these for whichever target was built last, so they differ run to run. A few
# (app, gfx, renderer, scene) were committed early and stay tracked; the rest are not. # (app, gfx, renderer, scene) were committed early and stay tracked; the rest are not.
+7 -11
View File
@@ -38,16 +38,14 @@ hosts). Toolchain notes: [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md). Dark mode and t
``` ```
build/compositor.wasm the compositor, a wasm component (components/compositor, code in compositor/) build/compositor.wasm the compositor, a wasm component (components/compositor, code in compositor/)
build/wasmhost the host that runs it: MoonBit, linked to the prebuilt wasmtime C API (default) build/wasmhost the host that runs it: MoonBit, linked to the prebuilt wasmtime C API
host-wasm/ the same host in Rust on the wasmtime crate (fallback)
build/components/*.wasm panel modules, loaded by the host and drawn by the compositor build/components/*.wasm panel modules, loaded by the host and drawn by the compositor
``` ```
The **MoonBit host** ([wasmhost/](wasmhost/README.md)) is the default. It links The **MoonBit host** ([wasmhost/](wasmhost/README.md)) is the only host. It links
`libwasmtime` from the upstream C API release instead of compiling wasmtime, so a cold build takes `libwasmtime` from the upstream C API release instead of compiling wasmtime, so a cold build takes
about 4 seconds (the Rust host takes about 2 minutes). The **Rust host** about 4 seconds. (An earlier host in Rust on the wasmtime crate, `host-wasm/`, was removed on
([host-wasm/](host-wasm/README.md)) serves the same `wit/host` interfaces and is kept as a 2026-11-26.) A **native build** of the same
fallback until it is removed; any host change goes into both. A **native build** of the same
compositor code (no wasm, `just run-native`) is used by the test suite. compositor code (no wasm, `just run-native`) is used by the test suite.
The compositor runs **nested**, as a window on your current Wayland session, as a **login The compositor runs **nested**, as a window on your current Wayland session, as a **login
@@ -77,12 +75,11 @@ just client # start foot inside it (or: just client konsol
| `just run` | Nested in a window on your Wayland session, MoonBit host | | `just run` | Nested in a window on your Wayland session, MoonBit host |
| `just run-drm` | As a login session on the real screen (from a text console, as yourself) | | `just run-drm` | As a login session on the real screen (from a text console, as yourself) |
| `just run-x11` | On the X server in `$DISPLAY` (NVIDIA on Xorg; the whole screen when no window manager runs) | | `just run-x11` | On the X server in `$DISPLAY` (NVIDIA on Xorg; the whole screen when no window manager runs) |
| `just install` | Install everything: the "Chandra" display-manager session, "Chandra (X11)" for Xorg, and face unlock (asks for root once). `--link` symlinks into this checkout (later just rebuild), `--rust` / `--native` pick the Rust host / native compositor, `--pam` turns face unlock on, `--no-face` skips it | | `just install` | Install everything: the "Chandra" display-manager session, "Chandra (X11)" for Xorg, and face unlock (asks for root once). `--link` symlinks into this checkout (later just rebuild), `--native` picks the native compositor, `--pam` turns face unlock on, `--no-face` skips it |
| `just uninstall` | Remove it all again (`--purge` also deletes enrolled faces) | | `just uninstall` | Remove it all again (`--purge` also deletes enrolled faces) |
| `just reload` | Reload the running session's panel modules from disk (`chandra-ctl reload [NAME]`) | | `just reload` | Reload the running session's panel modules from disk (`chandra-ctl reload [NAME]`) |
| `just run-rust`, `run-drm-rust` | The same with the Rust host |
| `just run-native`, `run-drm-native` | The native (non-wasm) build | | `just run-native`, `run-drm-native` | The native (non-wasm) build |
| `just compositor-wasm`, `wasmhost`, `host-wasm`, `modules` | Build one piece | | `just compositor-wasm`, `wasmhost`, `modules` | Build one piece |
| `just test` | Native compositor tests and lib tests | | `just test` | Native compositor tests and lib tests |
| `just frame` | Render one composed frame to `_build/e2e_frame.png` | | `just frame` | Render one composed frame to `_build/e2e_frame.png` |
| `just remote-build` | Build on a sprites.dev sprite (`CHANDRA_SPRITE`) and pull the artifacts back | | `just remote-build` | Build on a sprites.dev sprite (`CHANDRA_SPRITE`) and pull the artifacts back |
@@ -225,8 +222,7 @@ wit/ WIT packages: chandra:desktop (components) and chandra:hos
compositor/ the compositor in MoonBit: wayland/, shell/, scene/, raster/, kms/, network/, portal/, host/, ... compositor/ the compositor in MoonBit: wayland/, shell/, scene/, raster/, kms/, network/, portal/, host/, ...
components/<n>/ one wasm component each: compositor, shell, panel modules (gen/ bindings + thin stub.mbt) components/<n>/ one wasm component each: compositor, shell, panel modules (gen/ bindings + thin stub.mbt)
lib/ pure, unit-tested logic (panel layout, clock, launcher, battery, task pills, ...) lib/ pure, unit-tested logic (panel layout, clock, launcher, battery, task pills, ...)
wasmhost/ the default host (MoonBit + wasmtime C API) wasmhost/ the host (MoonBit + wasmtime C API)
host-wasm/ the fallback host (Rust + wasmtime)
host/ the original M0 browser/Node host (jco), kept for the component demos host/ the original M0 browser/Node host (jco), kept for the component demos
session/ chandra-session, chandra-root, chandra-ctl, chandra.desktop, chandra.portal, install.py session/ chandra-session, chandra-root, chandra-ctl, chandra.desktop, chandra.portal, install.py
config/ desktop configs, themes, app list config/ desktop configs, themes, app list
+1 -1
View File
@@ -455,7 +455,7 @@ fn ascii(s : String) -> Array[Byte] {
///| The start of the Matroska stream sent to ffmpeg: the EBML header, a Segment of unknown size ///| The start of the Matroska stream sent to ffmpeg: the EBML header, a Segment of unknown size
/// (it is a live stream), millisecond timestamps, and one video track of uncompressed RGBA /// (it is a live stream), millisecond timestamps, and one video track of uncompressed RGBA
/// `w` x `h` frames. The hosts' writers (wasmhost raster_stub.c, host-wasm main.rs) then send /// `w` x `h` frames. The host's writer (wasmhost raster_stub.c) then sends
/// each frame as a Cluster made by `mkv_frame_header`. /// each frame as a Cluster made by `mkv_frame_header`.
pub fn mkv_stream_header(w : Int, h : Int) -> Bytes { pub fn mkv_stream_header(w : Int, h : Int) -> Bytes {
let out : Array[Byte] = [] let out : Array[Byte] = []
+4 -4
View File
@@ -219,7 +219,7 @@ using the **same WIT and the same build outputs** (the components are standard;
only `host/` changes), then (c) from M5 as the path to real windows. The WIT stays only `host/` changes), then (c) from M5 as the path to real windows. The WIT stays
host-agnostic: nothing in `wit/` mentions JS, a browser or a window system. What host-agnostic: nothing in `wit/` mentions JS, a browser or a window system. What
does **not** transfer is `host/src/desktop.mjs`; it is intentionally small does **not** transfer is `host/src/desktop.mjs`; it is intentionally small
(~200 lines) and is the executable spec for the Rust host. (~200 lines) and was the executable spec for the native host (now the MoonBit `wasmhost/`).
## 9. Interface catalogue ## 9. Interface catalogue
@@ -255,8 +255,8 @@ Designed next (no WIT yet): `window-registry`/`wm-policy`/`decoration`, `search-
## 11. Roadmap ## 11. Roadmap
> Status as of 2026-11-25: M0 is done; the native host (M3) exists as the MoonBit wasmhost > Status as of 2026-11-26: M0 is done; the native host (M3) is the MoonBit wasmhost on the
> (default) and the Rust host-wasm; the compositor hosts real Wayland clients (M5, in MoonBit > wasmtime C API (a Rust host on the wasmtime crate came first and was removed on 2026-11-26); the compositor hosts real Wayland clients (M5, in MoonBit
> rather than smithay) and runs as a DRM/KMS + libinput login session (M8). Settings, power and > rather than smithay) and runs as a DRM/KMS + libinput login session (M8). Settings, power and
> clipboard from M6 are in; notifications, tray, vfs and packaging are not. > clipboard from M6 are in; notifications, tray, vfs and packaging are not.
@@ -274,7 +274,7 @@ Designed next (no WIT yet): `window-registry`/`wm-policy`/`decoration`, `search-
## 12. Open design questions (with recommendations) ## 12. Open design questions (with recommendations)
1. **Host language/long-term host** — Rust+wasmtime native host vs trying to keep even the host in MoonBit. *Recommend Rust+wasmtime for M3; revisit MoonBit-native host only if wasmtime's C API gains full component embedding.* 1. **Host language/long-term host** — Rust+wasmtime native host vs trying to keep even the host in MoonBit. *Recommend Rust+wasmtime for M3; revisit MoonBit-native host only if wasmtime's C API gains full component embedding.* Resolved: the host is MoonBit (`wasmhost/`) on the wasmtime C API, whose component model support turned out to be enough; the Rust host was removed on 2026-11-26.
2. **Render-list vs textures** — *Recommend render-list as the default, `buffer-surface` resource only for non-vector content (§4).* 2. **Render-list vs textures** — *Recommend render-list as the default, `buffer-surface` resource only for non-vector content (§4).*
3. **UI toolkit inside components** — adopt `moon-gpui` or a tiny immediate-mode helper (`lib/ui`)? *Recommend `lib/ui` until moon-gpui has a stable scene package and a flatten-to-draw-op adapter, then migrate widget internals; keep the WIT draw-op vocabulary as the stable boundary.* 3. **UI toolkit inside components** — adopt `moon-gpui` or a tiny immediate-mode helper (`lib/ui`)? *Recommend `lib/ui` until moon-gpui has a stable scene package and a flatten-to-draw-op adapter, then migrate widget internals; keep the WIT draw-op vocabulary as the stable boundary.*
4. **Text and fonts** — host-provided shaping (`text` interface) vs components bundling a shaper. *Recommend host-provided: layout needs metrics from the same engine that rasterises.* 4. **Text and fonts** — host-provided shaping (`text` interface) vs components bundling a shaper. *Recommend host-provided: layout needs metrics from the same engine that rasterises.*
+3 -3
View File
@@ -1,9 +1,9 @@
# Toolchain: what works today (verified 2026-11-24) # Toolchain: what works today (verified 2026-11-24)
> This page records the M0 toolchain proof (browser/Node host via jco). Since then the > This page records the M0 toolchain proof (browser/Node host via jco). Since then the
> components also run natively under wasmtime: the default host is the MoonBit > components also run natively under wasmtime: the host is the MoonBit
> [wasmhost](../wasmhost/README.md) on the wasmtime C API, with the Rust > [wasmhost](../wasmhost/README.md) on the wasmtime C API (an earlier Rust host on the
> [host-wasm](../host-wasm/README.md) as a fallback. For the current build see the > wasmtime crate was removed on 2026-11-26). For the current build see the
> [README](../README.md). Pinned versions live in `scripts/versions.env`. > [README](../README.md). Pinned versions live in `scripts/versions.env`.
Everything here was run on x86_64 Linux (glibc 2.43 locally; CI uses Everything here was run on x86_64 Linux (glibc 2.43 locally; CI uses
+3 -4
View File
@@ -97,9 +97,8 @@ is reported and the running instance stays (see [reloading.md](reloading.md)).
## Hosts ## Hosts
All three module hosts serve desktop modules: the native compositor and the MoonBit Both module hosts serve desktop modules: the native compositor and the MoonBit
`build/wasmhost` (both through `compositor/wasm/wasm_stub.c`) and the Rust `host-wasm` `build/wasmhost`, both through `compositor/wasm/wasm_stub.c`. The compositor-as-wasm reaches them
(`src/plasmoid.rs`, bound with the `desktop-export` world). The compositor-as-wasm reaches them
through `desktop-backdrop`, `desktop-scroll`, `desktop-tick` and `publish-desktop` in through `desktop-backdrop`, `desktop-scroll`, `desktop-tick` and `publish-desktop` in
`wit/host/plasmoids.wit`. The settings module reads the list through the `wallpaper` `wit/host/plasmoids.wit`. The settings module reads the list through the `wallpaper`
capability's `desktops`, `current-desktop` and `set-desktop` (`wit/capabilities.wit`). capability's `desktops`, `current-desktop` and `set-desktop` (`wit/capabilities.wit`).
@@ -115,5 +114,5 @@ XDG_CONFIG_HOME=$(mktemp -d) CHANDRA_TEST_CONFIG=1 \
moon test --target native --warn-list -a -p chandra/desktop/compositor/host --filter "*desktop*" moon test --target native --warn-list -a -p chandra/desktop/compositor/host --filter "*desktop*"
``` ```
Also checked headless on `build/wasmhost` and `host-wasm` (`--gfx-out`) with `:desktop` set in Also checked headless on `build/wasmhost` (`--gfx-out`) with `:desktop` set in
state.edn. state.edn.
+2 -2
View File
@@ -61,8 +61,8 @@ capability (`wit/capabilities.wit`):
rig's X server through server.py, exactly as from the web library, and Openbox stacks them over rig's X server through server.py, exactly as from the web library, and Openbox stacks them over
Chandra's window. Chandra's window.
Served by every host: the wasmer/wasmtime stub (`compositor/wasm/wasm_stub.c`), the MoonBit Served by every host: the wasmer/wasmtime stub (`compositor/wasm/wasm_stub.c`), and the MoonBit
wasmhost and the Rust `host-wasm`. wasmhost.
Code: `components/gamerig-library` (bindings and a thin stub), `lib/gamelib` (model, JSON, Code: `components/gamerig-library` (bindings and a thin stub), `lib/gamelib` (model, JSON,
layout, drawing, input; tests in `lib/gamelib/gamelib_test.mbt`), `compositor/shell/gamelib.mbt` layout, drawing, input; tests in `lib/gamelib/gamelib_test.mbt`), `compositor/shell/gamelib.mbt`
-1
View File
@@ -26,7 +26,6 @@ for a new compositor or host; `just reload` picks up new panel modules in a runn
| Flag | What it changes | | Flag | What it changes |
|---|---| |---|---|
| `--link` | Symlink the session into this checkout instead of copying: after that, rebuilding (`just compositor-wasm wasmhost modules`) is all the next login needs, no root. The checkout must stay where it is. Face unlock is copied either way. | | `--link` | Symlink the session into this checkout instead of copying: after that, rebuilding (`just compositor-wasm wasmhost modules`) is all the next login needs, no root. The checkout must stay where it is. Face unlock is copied either way. |
| `--rust` | Use the Rust host (`host-wasm`, about 2 minutes to build cold) instead of the MoonBit one |
| `--native` | Install the native compositor (system-cc release build) instead of the wasm one | | `--native` | Install the native compositor (system-cc release build) instead of the wasm one |
| `--pam` | Also turn face unlock on for `polkit-1` and `sudo` (Settings > Session can do it later) | | `--pam` | Also turn face unlock on for `polkit-1` and `sudo` (Settings > Session can do it later) |
| `--no-face` | Leave face unlock out | | `--no-face` | Leave face unlock out |
+3 -3
View File
@@ -113,7 +113,7 @@ starting with `ok` or `error`. Several commands may be sent on one connection.
The compositor handles the socket in its main loop (`compositor/host/control.mbt`, from The compositor handles the socket in its main loop (`compositor/host/control.mbt`, from
`ChandraCompositor::step`), and the listening socket and its clients are among the fds the idle `ChandraCompositor::step`), and the listening socket and its clients are among the fds the idle
loop waits on, so an idle desktop still sleeps (about 0.4% CPU, unchanged) and wakes for a loop waits on, so an idle desktop still sleeps (about 0.4% CPU, unchanged) and wakes for a
command. It is the same code on the MoonBit host, the Rust host and the native build. command. It is the same code on the MoonBit host and the native build.
## Not reloadable ## Not reloadable
@@ -125,7 +125,7 @@ WM, portal backend or host need a new session: log out and back in.
## Status ## Status
Tested headless on both hosts (`build/wasmhost` and `host-wasm`) with the modules from Tested headless on `build/wasmhost` (and on the Rust host, since removed) with the modules
`build/components`: `ping`, `list`, `reload`, `reload NAME`, a module replaced by a broken file from `build/components`: `ping`, `list`, `reload`, `reload NAME`, a module replaced by a broken file
(reported, old instance kept), SIGUSR1, and idle CPU before and after. Tests: (reported, old instance kept), SIGUSR1, and idle CPU before and after. Tests:
`compositor/host/control_test.mbt`. Not yet run against an installed login session. `compositor/host/control_test.mbt`. Not yet run against an installed login session.
+2 -2
View File
@@ -1,7 +1,7 @@
# Rendering, animations and machines without a GPU # Rendering, animations and machines without a GPU
Chandra draws the desktop on the CPU on every machine: the host (build/wasmhost, or the Rust Chandra draws the desktop on the CPU on every machine: the host (build/wasmhost)
host) rasterises each frame into its own framebuffer and hands it to the display (KMS, X11, a rasterises each frame into its own framebuffer and hands it to the display (KMS, X11, a
nested Wayland window). A GPU never makes Chandra's own frames cheaper. What it changes is how nested Wayland window). A GPU never makes Chandra's own frames cheaper. What it changes is how
much CPU is left: with a GPU, apps (browsers, video, games) draw there; without one they draw much CPU is left: with a GPU, apps (browsers, video, games) draw there; without one they draw
with llvmpipe or their own software paths on the same cores as Chandra. with llvmpipe or their own software paths on the same cores as Chandra.
+1 -1
View File
@@ -15,7 +15,7 @@ Everything below works with sudo, doas or pkexec too; run0 is only preferred whe
## Installing the login session ## Installing the login session
```bash ```bash
just install # flags: --link, --rust, --native, --pam, --no-face; and `just uninstall` just install # flags: --link, --native, --pam, --no-face; and `just uninstall`
``` ```
These go through `scripts/as-root`, which uses run0 if systemd is PID 1 and run0 is installed, These go through `scripts/as-root`, which uses run0 if systemd is PID 1 and run0 is installed,
+1 -2
View File
@@ -52,8 +52,7 @@ right and 6px down. Hover and pressed show as a ring around the button.
- `compositor/scene/scene.mbt`: `WindowStyle` (frame sizes, button layout and hit test, - `compositor/scene/scene.mbt`: `WindowStyle` (frame sizes, button layout and hit test,
`button_at`) and `build_window_decoration`, which returns the frame as draw ops in the frame's `button_at`) and `build_window_decoration`, which returns the frame as draw ops in the frame's
own coordinates, shadow included. Every host draws them as they are: the software renderer own coordinates, shadow included. Every host draws them as they are: the software renderer
(compositor/renderer), the MoonBit host (wasmhost/bin/raster.mbt) and the Rust host (compositor/renderer) and the MoonBit host (wasmhost/bin/raster.mbt) have no shadow of their own and redraw `SHADOW_PAD` (18px) around a
(host-wasm/src/raster.rs) have no shadow of their own and redraw `SHADOW_PAD` (18px) around a
window that changed. window that changed.
- `compositor/host/compositor.mbt`: `window_style` (the style in use; `frame_top()`, - `compositor/host/compositor.mbt`: `window_style` (the style in use; `frame_top()`,
`frame_side()`, `frame_rect()`), `sync_window_style` (applies the setting: the work area, the `frame_side()`, `frame_rect()`), `sync_window_style` (applies the setting: the work area, the
-1493
View File
File diff suppressed because it is too large. Load diff
-29
View File
@@ -1,29 +0,0 @@
[package]
name = "chandra-host"
version = "0.1.0"
edition = "2021"
description = "Runs the chandra compositor wasm component (build/components/compositor.wasm) and gives it the OS surface it imports (wit/host/sys.wit)."
[features]
# Login-session display backend (DRM/KMS + libinput + libseat + xkbcommon). Needs those libraries'
# development files; build with --no-default-features to leave it out (--drm then reports it).
default = ["drm"]
drm = ["dep:cc"]
[build-dependencies]
cc = { version = "1", optional = true }
[dependencies]
ab_glyph = "0.2"
ab_glyph_rasterizer = "0.1"
libc = "0.2"
png = "0.17"
resvg = { version = "0.50.0", default-features = false }
wasmtime = { version = "50", default-features = false, features = ["component-model", "cranelift", "runtime", "std"] }
[profile.release]
opt-level = 2
# Recompile only what changed in this crate (dependencies are unaffected): an edit to main.rs or
# raster.rs rebuilds in about 3 s instead of 6.5 s. The cold build is dominated by wasmtime and
# cranelift (about 2 min on 4 cores), which this does not change.
incremental = true
-82
View File
@@ -1,82 +0,0 @@
# chandra-host (Rust, fallback)
Runs the compositor **as a WebAssembly component**. The default host is now the MoonBit one in
[`wasmhost/`](../wasmhost/README.md), which builds in seconds; this crate compiles wasmtime (about
2 minutes cold) and is kept as a fallback until it is removed. Both serve the same `wit/host`.
```
just compositor-wasm # build/compositor.wasm (the compositor, a component)
just host-wasm # host-wasm/target/release/chandra-host (this crate)
just run-rust # both, then run in a window on your current Wayland session
```
The component (`components/compositor`, entry in `compositor/app`) imports exactly one interface,
`chandra:host/sys` ([`wit/host/sys.wit`](../wit/host/sys.wit)), and exports `run(args) -> s32`.
It is the same MoonBit code as the native compositor: the Wayland server, window manager, scene,
rasteriser and shell. Only `compositor/sys` differs per target (`sys_native.mbt` over a C shim,
`sys_wasm.mbt` over the WIT imports). The component holds integer handles and bytes only; every real
file descriptor lives in this host, which implements `sys` with libc (sockets and `SCM_RIGHTS`,
`memfd`, `poll`, spawn, files, clock).
```
chandra-host build/compositor.wasm --socket PATH [--theme PATH] [--window]
chandra-host build/compositor.wasm --socket PATH --gfx-out frame.png # one frame
chandra-host build/compositor.wasm --socket PATH --gfx-out frame.png --serve # keep refreshing it
```
## Drawing
The compositor component decides what the screen shows and the host draws it
(`chandra:host/raster`, [`wit/host/raster.wit`](../wit/host/raster.wit)). Each frame the component
sends a list of draw operations (fill, stroke, line, circle, text, clip), the windows with their
decoration ops and a surface id, and the panel ops; `src/raster.rs` draws them natively into a
framebuffer it owns (a port of `compositor/renderer`, with the same blend arithmetic). The pixels never
cross the component boundary:
- **Client windows:** at commit the host copies the buffer out of the client's shared memory into a
surface (`capture`, converted to RGBA once) and the component keeps only its id. Solid surfaces blit
as row copies.
- **Backdrop:** the wallpaper and the desktop card are cached as one layer and sent only when they change.
- **Showing it:** the login session shows the framebuffer straight from the host (`display.present-frame`);
the nested window gets it as a memfd (`raster.export-memfd`) that goes to the host compositor as a
`wl_shm` pool. `read-frame` returns the pixels for screenshots (`--gfx-out`).
- **Unchanged desktop:** if a scene is identical to the last one (no client damage, same ops) nothing is
sent or presented.
- `--profile` prints, every 3 s, frames, step, shell and draw (submit) time.
- **Session restore:** the windows open when a session ends are kept in `state.edn` (`:session`) and
their apps are started again at the next start. `--no-restore`, or `:restore-session false` in
`state.edn`, starts with an empty desktop instead.
The native compositor build keeps the software renderer (`compositor/renderer`); the two are tested
against each other's rules (`cargo test` here, `moon test` for the MoonBit side).
## Status
Working: Wayland server (real clients such as `foot` run and draw), window management, decorations,
the desktop card, input routing, the nested window on the host session, real fonts (Allo Variable,
Adwaita Mono: the host rasterises glyphs, `chandra:host/font`) and the panel modules.
**Panel modules** run in this host. A component can't embed a second runtime, so the compositor
drives them through `chandra:host/plasmoids` ([`wit/host/plasmoids.wit`](../wit/host/plasmoids.wit)):
load, render, popup, on-event, plus the data they read (apps, windows, layouts, modules, system
snapshot) and the requests they make (launch, focus, set layout, load/unload). `src/plasmoid.rs`
instantiates each module as a real component against one world, `plasmoid-host`
([`wit/worlds.wit`](../wit/worlds.wit)); a module imports the subset of host interfaces it needs and
each is served here. `cargo test --release` loads the built modules (`just modules` first).
**Login session** (`--drm`): the host takes the display and input through the seat
(`chandra:host/display`, [`wit/host/display.wit`](../wit/host/display.wit)): DRM/KMS output with page
flips and a hardware cursor, libinput keyboard and pointer, an xkb keymap, libseat for device access and
VT switching. It is the compositor's own C shim (`compositor/kms/kms_stub.c`) compiled into this host
by `build.rs` (feature `drm`, on by default; `--no-default-features` leaves it out), so the native and
wasm backends can't drift. Run `just run-drm` from a login VT, or `just install` to add Moon
Plasma to your display manager (`session/install.py`; `--native` installs the native compositor instead).
Not yet exercised on a real VT; it is only built and instantiated.
Regenerating the host bindings (into a temp dir, then copy `interface/chandra/host`,
`world/compositor` and `components/compositor/gen/{ffi.mbt,world}`; regenerating in place would
overwrite the hand-fixed `desktop/theme` package):
`wit-bindgen moonbit wit/host --world compositor --out-dir $T --gen-dir components/compositor/gen
--project-name chandra/desktop --ignore-module-file --ignore-stub`, then
`scripts/gen-native-stubs.py interface/chandra/host/<sys|font|plasmoids>` (the imports are
wasm-only; this restores the native stand-ins and the per-file targets).
-25
View File
@@ -1,25 +0,0 @@
// The login-session display backend (feature `drm`, on by default) compiles the compositor's own
// C shim for DRM/KMS + libinput + libseat + xkbcommon and links the libraries it uses.
fn main() {
#[cfg(feature = "drm")]
{
cc::Build::new()
.file("csrc/kms.c")
.include("csrc/fake")
.include("/usr/include/libdrm")
.warnings(false)
.compile("kms");
for lib in ["drm", "input", "seat", "xkbcommon", "udev"] {
println!("cargo:rustc-link-lib={lib}");
}
// libseat comes from the pixi env (see pixi.toml). Record its lib dir in the binary so
// the login session finds it without LD_LIBRARY_PATH, which apps started by the
// compositor would inherit.
let pixi_lib = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.pixi/envs/default/lib");
if let Ok(dir) = pixi_lib.canonicalize() {
println!("cargo:rustc-link-arg-bins=-Wl,-rpath,{}", dir.display());
}
println!("cargo:rerun-if-changed=csrc/kms.c");
println!("cargo:rerun-if-changed=../compositor/kms/kms_stub.c");
}
}
-9
View File
@@ -1,9 +0,0 @@
/* Just enough of moonbit.h for compositor/kms/kms_stub.c to build outside the MoonBit runtime.
* The shim uses MoonBit only for the export macro and the length of byte arrays it is handed;
* csrc/kms.c supplies the length through kms_bytes_len. */
#pragma once
#include <stdint.h>
#define MOONBIT_FFI_EXPORT
typedef uint8_t *moonbit_bytes_t;
extern int32_t kms_bytes_len;
#define Moonbit_array_length(p) (kms_bytes_len)
-19
View File
@@ -1,19 +0,0 @@
/* The login-session display backend for the wasm host: the same C file the native compositor uses
* (libseat + DRM/KMS dumb buffers + libinput + xkbcommon), compiled here against a stand-in
* moonbit.h, so the two backends can't drift. The mp_kms_* functions are called from Rust. */
#include <stdint.h>
int32_t kms_bytes_len;
#include "../../compositor/kms/kms_stub.c"
/* The two shim functions that take a MoonBit byte array need its length. */
int32_t hw_kms_present(uint8_t *pixels, int32_t w, int32_t h) {
kms_bytes_len = w * h * 4;
return mp_kms_present(pixels, w, h);
}
int32_t hw_kms_keymap_copy(uint8_t *out, int32_t cap) {
kms_bytes_len = cap;
return mp_kms_keymap_copy(out);
}
-109
View File
@@ -1,109 +0,0 @@
//! The login-session display backend: calls into compositor/kms/kms_stub.c (built by build.rs),
//! the same shim the native compositor uses. One display, one seat, global state.
use crate::chandra::host::display::{KeyState, Modifiers, Output, PointerPos, ScrollDelta, SeatEvent};
extern "C" {
fn mp_kms_open() -> i32;
fn mp_kms_width() -> i32;
fn mp_kms_height() -> i32;
fn mp_kms_quit_requested() -> i32;
fn mp_kms_poll() -> i32;
fn mp_kms_frame_ready() -> i32;
fn mp_kms_set_cursor_shape(shape: i32);
fn mp_kms_next_event() -> i32;
fn mp_kms_arg(i: i32) -> i32;
fn mp_kms_keymap_len() -> i32;
fn mp_kms_close();
fn mp_kms_fd(i: i32) -> i32;
fn mp_kms_set_power(on: i32);
fn hw_kms_present(pixels: *mut u8, w: i32, h: i32) -> i32;
fn hw_kms_keymap_copy(out: *mut u8, cap: i32) -> i32;
}
/// Open the seat, the first connected output and libinput. None (the shim has said why on stderr)
/// when this is not an active login VT.
pub fn open() -> Option<Output> {
unsafe {
if mp_kms_open() != 0 {
mp_kms_close();
return None;
}
let n = mp_kms_keymap_len();
let mut keymap = vec![0u8; n.max(0) as usize];
let got = if n > 0 { hw_kms_keymap_copy(keymap.as_mut_ptr(), n) } else { 0 };
keymap.truncate(got.max(0) as usize);
Some(Output { width: mp_kms_width() as u32, height: mp_kms_height() as u32, keymap })
}
}
/// Service the seat, DRM and input fds. False once Ctrl+Alt+Backspace was pressed.
pub fn poll() -> bool {
unsafe {
mp_kms_poll();
mp_kms_quit_requested() == 0
}
}
/// The seat, DRM and input fds while the display is open (empty otherwise), for an idle wait.
pub fn fds() -> Vec<i32> {
(0..3).map(|i| unsafe { mp_kms_fd(i) }).filter(|&fd| fd >= 0).collect()
}
pub fn frame_ready() -> bool {
unsafe { mp_kms_frame_ready() != 0 }
}
/// Present an RGBA8888 frame; ignored if the buffer is smaller than the stated size.
pub fn present(pixels: &[u8], width: u32, height: u32) {
if pixels.len() < (width as usize) * (height as usize) * 4 {
return;
}
// The shim only reads the pixels; it takes a non-const pointer for the MoonBit byte type.
unsafe { hw_kms_present(pixels.as_ptr() as *mut u8, width as i32, height as i32) };
}
/// Turn the screen on or off (DPMS).
pub fn set_power(on: bool) {
unsafe { mp_kms_set_power(on as i32) };
}
pub fn set_cursor_shape(shape: u32) {
unsafe { mp_kms_set_cursor_shape(shape as i32) };
}
/// Input queued since the last call.
pub fn take_input() -> Vec<SeatEvent> {
let mut out = Vec::new();
unsafe {
loop {
let t = mp_kms_next_event();
if t == 0 {
break;
}
let (a, b) = (mp_kms_arg(1), mp_kms_arg(2));
match t {
1 => out.push(SeatEvent::PointerMove(PointerPos { x: a as f64, y: b as f64 })),
2 => out.push(SeatEvent::PointerButton(KeyState { code: a as u32, pressed: b != 0 })),
3 => out.push(SeatEvent::Key(KeyState { code: a as u32, pressed: b != 0 })),
4 => out.push(SeatEvent::Modifiers(Modifiers {
depressed: a as u32,
latched: b as u32,
locked: mp_kms_arg(3) as u32,
group: mp_kms_arg(4) as u32,
})),
5 => out.push(SeatEvent::Scroll(ScrollDelta {
axis: a as u32,
value: b as f64 / 256.0,
discrete: mp_kms_arg(3),
})),
_ => {}
}
}
}
out
}
pub fn close() {
unsafe { mp_kms_close() };
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+4 -20
View File
@@ -49,11 +49,6 @@ run-x11: compositor-wasm wasmhost modules
rm -f {{socket}} rm -f {{socket}}
build/wasmhost build/compositor.wasm --socket {{socket}} --theme {{theme}} --x11 build/wasmhost build/compositor.wasm --socket {{socket}} --theme {{theme}} --x11
# The same on the Rust host (host-wasm), kept as a fallback while the MoonBit host settles in.
run-rust: compositor-wasm host-wasm modules
rm -f {{socket}}
host-wasm/target/release/chandra-host build/compositor.wasm --socket {{socket}} --theme {{theme}} --window
# Run the native compositor (tcc debug build, with the wasm panel modules) in a window on your current Wayland session. # Run the native compositor (tcc debug build, with the wasm panel modules) in a window on your current Wayland session.
run-native: build modules run-native: build modules
rm -f {{socket}} rm -f {{socket}}
@@ -87,19 +82,13 @@ run-drm: compositor-wasm wasmhost modules
-dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null -dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null
build/wasmhost build/compositor.wasm --drm --socket {{socket}} --theme {{theme}} build/wasmhost build/compositor.wasm --drm --socket {{socket}} --theme {{theme}}
# The same on the Rust host (host-wasm).
run-drm-rust: compositor-wasm host-wasm modules
rm -f {{socket}}
-dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null
host-wasm/target/release/chandra-host build/compositor.wasm --drm --socket {{socket}} --theme {{theme}}
# The same on the native compositor (system-cc release build), for comparison. # The same on the native compositor (system-cc release build), for comparison.
run-drm-native: build-release modules run-drm-native: build-release modules
rm -f {{socket}} rm -f {{socket}}
-dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null -dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null
{{release_exe}} --drm --socket {{socket}} --theme {{theme}} {{release_exe}} --drm --socket {{socket}} --theme {{theme}}
# Install everything (login session, panel modules, KDE colors, portal, face unlock); builds as you, then asks for root once. Flags: --link, --rust, --native, --pam, --no-face (docs/install.md). # Install everything (login session, panel modules, KDE colors, portal, face unlock); builds as you, then asks for root once. Flags: --link, --native, --pam, --no-face (docs/install.md).
install *flags: install *flags:
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
@@ -107,13 +96,11 @@ install *flags:
face=1 face=1
for f in {{flags}}; do for f in {{flags}}; do
case "$f" in case "$f" in
--rust|--native) --native) builds="build-release modules" ;;
[ -z "${host:-}" ] || [ "$host" = "$f" ] || { echo "just install: --rust and --native exclude each other" >&2; exit 2; } --rust) echo "just install: --rust is gone: the Rust host was removed (2026-11-26); the MoonBit host is the only one" >&2; exit 2 ;;
host=$f
if [ "$f" = --rust ]; then builds="compositor-wasm host-wasm modules"; else builds="build-release modules"; fi ;;
--no-face) face=0 ;; --no-face) face=0 ;;
--link|--pam|--no-models) ;; --link|--pam|--no-models) ;;
*) echo "just install: unknown flag $f (--link, --rust, --native, --pam, --no-face, --no-models)" >&2; exit 2 ;; *) echo "just install: unknown flag $f (--link, --native, --pam, --no-face, --no-models)" >&2; exit 2 ;;
esac esac
done done
{{just_executable()}} --justfile "{{justfile()}}" $builds {{just_executable()}} --justfile "{{justfile()}}" $builds
@@ -197,7 +184,4 @@ compositor-wasm:
wasmhost: wasmhost:
scripts/build-wasmhost.sh scripts/build-wasmhost.sh
# Build the Rust host (host-wasm/target/release/chandra-host): the fallback, compiles wasmtime (about 2 minutes cold).
host-wasm:
cd host-wasm && cargo build --release
+1 -1
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build the compositor itself as a wasm component: build/compositor.wasm. # Build the compositor itself as a wasm component: build/compositor.wasm.
# It imports the chandra:host interfaces (wit/host) and exports `run`; the host (wasmhost/, # It imports the chandra:host interfaces (wit/host) and exports `run`; the host (wasmhost/,
# build/wasmhost; or the Rust host-wasm/) provides the imports. Needs moon and wasm-tools. # build/wasmhost) provides the imports. Needs moon and wasm-tools.
# scripts/build-compositor-wasm.sh # scripts/build-compositor-wasm.sh
set -euo pipefail set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
+8 -8
View File
@@ -1,14 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Build on a sprites.dev sprite instead of locally, then pull the artifacts back: # Build on a sprites.dev sprite instead of locally, then pull the artifacts back:
# build/compositor.wasm, build/components/ and host-wasm/target/release/chandra-host. # build/compositor.wasm, build/components/ and build/wasmhost.
# The sprite checks the tree out at the same absolute path as here, because host-wasm/build.rs # The sprite checks the tree out at the same absolute path as here, so paths in the build match
# bakes <checkout>/.pixi/envs/default/lib into the host's rpath. # (build/wasmhost's rpath points at the checkout's .pixi/envs/default/lib, relative to the binary).
# One-off sprite setup (apt dev libs, pixi, moon, wasm-tools, moon update): scripts/sprite-setup.sh. # One-off sprite setup (apt dev libs, pixi, moon, wasm-tools, moon update): scripts/sprite-setup.sh.
# scripts/remote-build.sh [just-target ...] (default: host-wasm compositor-wasm modules) # scripts/remote-build.sh [just-target ...] (default: wasmhost compositor-wasm modules)
set -euo pipefail set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT"
SPRITE="${CHANDRA_SPRITE:-chandra-build}" SPRITE="${CHANDRA_SPRITE:-chandra-build}"
targets=("$@"); [ ${#targets[@]} -gt 0 ] || targets=(host-wasm compositor-wasm modules) targets=("$@"); [ ${#targets[@]} -gt 0 ] || targets=(wasmhost compositor-wasm modules)
sp() { sprite exec -s "$SPRITE" "$@"; } sp() { sprite exec -s "$SPRITE" "$@"; }
echo "== sync source to $SPRITE" echo "== sync source to $SPRITE"
@@ -23,11 +23,11 @@ sp --no-stdin --dir "$ROOT" -- bash -c \
echo "== pull artifacts" echo "== pull artifacts"
# `sprite file pull` rather than a tar stream over exec: a streamed binary can break on reconnect. # `sprite file pull` rather than a tar stream over exec: a streamed binary can break on reconnect.
# -r on a directory fails, so pull build/components/ file by file. # -r on a directory fails, so pull build/components/ file by file.
mkdir -p build/components host-wasm/target/release mkdir -p build/components
pull() { sprite file pull -s "$SPRITE" -p "$@"; } pull() { sprite file pull -s "$SPRITE" -p "$@"; }
pull "$ROOT/build/compositor.wasm" build/ pull "$ROOT/build/compositor.wasm" build/
pull "$ROOT/host-wasm/target/release/chandra-host" host-wasm/target/release/ pull "$ROOT/build/wasmhost" build/
mods=(); while IFS= read -r f; do mods+=("$ROOT/build/components/$f"); done \ mods=(); while IFS= read -r f; do mods+=("$ROOT/build/components/$f"); done \
< <(sp --no-stdin --dir "$ROOT" -- ls build/components | grep -E '\.(wasm|json)$') < <(sp --no-stdin --dir "$ROOT" -- ls build/components | grep -E '\.(wasm|json)$')
pull "${mods[@]}" build/components/ pull "${mods[@]}" build/components/
ls -la build/compositor.wasm host-wasm/target/release/chandra-host ls -la build/compositor.wasm build/wasmhost
+1 -1
View File
@@ -15,4 +15,4 @@ install /tmp/wasm-tools-1.258.0-x86_64-linux/wasm-tools ~/.local/bin/
# moon # moon
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash >/dev/null 2>&1 || true curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash >/dev/null 2>&1 || true
export PATH=$HOME/.pixi/bin:$HOME/.moon/bin:$HOME/.local/bin:$PATH export PATH=$HOME/.pixi/bin:$HOME/.moon/bin:$HOME/.local/bin:$PATH
pixi -V; wasm-tools -V; moon version | head -1; cargo -V; ls /usr/include/libseat.h pixi -V; wasm-tools -V; moon version | head -1; ls /usr/include/libseat.h
+6 -6
View File
@@ -5,7 +5,6 @@ run0 and falls back to sudo, doas or pkexec). Running it is idempotent: it repla
just install # the compositor as a wasm component on the MoonBit host just install # the compositor as a wasm component on the MoonBit host
just install --link # dev: symlink into this checkout (see below) just install --link # dev: symlink into this checkout (see below)
just install --rust # the wasm compositor on the Rust host (host-wasm)
just install --native # the native compositor instead just install --native # the native compositor instead
just install --pam # also turn face unlock on for polkit-1 and sudo just install --pam # also turn face unlock on for polkit-1 and sudo
just install --no-face # leave face unlock out just install --no-face # leave face unlock out
@@ -45,11 +44,12 @@ root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
native = "--native" in sys.argv native = "--native" in sys.argv
linked = "--link" in sys.argv linked = "--link" in sys.argv
exe = os.path.join(root, "_build/native/release/build/compositor/bin/bin.exe") exe = os.path.join(root, "_build/native/release/build/compositor/bin/bin.exe")
rust_host = "--rust" in sys.argv or "--rust-host" in sys.argv if "--rust" in sys.argv or "--rust-host" in sys.argv:
# The host that runs the compositor component: the MoonBit one (just wasmhost), or the Rust sys.exit("install.py: --rust is gone: the Rust host (host-wasm) was removed on 2026-11-26; "
# one (just host-wasm) with --rust. Either is installed as chandra-host. "the MoonBit host (build/wasmhost) is the only one, so drop the flag")
host_build = "just host-wasm" if rust_host else "just wasmhost" # The host that runs the compositor component (just wasmhost), installed as chandra-host.
host = os.path.join(root, "host-wasm/target/release/chandra-host" if rust_host else "build/wasmhost") host_build = "just wasmhost"
host = os.path.join(root, "build/wasmhost")
component = os.path.join(root, "build/compositor.wasm") component = os.path.join(root, "build/compositor.wasm")
share = "/usr/local/share/chandra" share = "/usr/local/share/chandra"
targets = [ targets = [
+8 -11
View File
@@ -1,13 +1,12 @@
# wasmhost # wasmhost
The host that runs the compositor component (`build/compositor.wasm`): `just run`, `just run-drm` The host that runs the compositor component (`build/compositor.wasm`): `just run`, `just run-drm`
and `just install` use it. It replaces the Rust `host-wasm/`, which stays as a fallback and `just install` use it. It is the only host: it replaced the Rust `host-wasm/` (on the wasmtime
(`just run-rust`, `just run-drm-rust`, `just install --rust`). crate), which was removed on 2026-11-26.
It links wasmtime as the prebuilt C API library (`libwasmtime.a` from the upstream It links wasmtime as the prebuilt C API library (`libwasmtime.a` from the upstream
`wasmtime-v$WASMTIME_VERSION-x86_64-linux-c-api` release, fetched by `scripts/setup-toolchain.sh` `wasmtime-v$WASMTIME_VERSION-x86_64-linux-c-api` release, fetched by `scripts/setup-toolchain.sh`
into `.tools/wasmtime-c-api`) instead of compiling wasmtime, so a cold build takes about 4 s into `.tools/wasmtime-c-api`) instead of compiling wasmtime, so a cold build takes about 4 s.
instead of about 2 minutes.
``` ```
scripts/build-wasmhost.sh # or: just wasmhost -> build/wasmhost scripts/build-wasmhost.sh # or: just wasmhost -> build/wasmhost
@@ -23,14 +22,12 @@ build/wasmhost build/compositor.wasm --socket PATH --gfx-out frame.png
(`snapshot-*`, `*-recording-frame`, `write-frame-png` in `wit/host/raster.wit`). (`snapshot-*`, `*-recording-frame`, `write-frame-png` in `wit/host/raster.wit`).
- `bin/`: the interfaces of `wit/host`. Most of it is the native compositor's own packages: - `bin/`: the interfaces of `wit/host`. Most of it is the native compositor's own packages:
`sys` is compositor/sys, glyphs come from compositor/font (stb_truetype). The rasteriser `sys` is compositor/sys, glyphs come from compositor/font (stb_truetype). The rasteriser
(`raster.mbt`, pixel work in `raster_stub.c`) is a port of `host-wasm/src/raster.rs`; SVG icons (`raster.mbt`, pixel work in `raster_stub.c`) is a port of compositor/renderer; SVG icons
use nanosvg (`third_party/nanosvg`, patched for clip paths and masks) where the Rust host used use nanosvg (`third_party/nanosvg`, patched for clip paths and masks). `plasmoids.mbt` runs
resvg. `plasmoids.mbt` runs panel modules through compositor/wasm (wasm.h, which libwasmtime panel modules through compositor/wasm (wasm.h, which libwasmtime provides); `display.mbt` is the login session's DRM/KMS output and input (compositor/kms).
provides); `display.mbt` is the login session's DRM/KMS output and input (compositor/kms).
Every interface of `wit/host` is served, so a host change goes in both hosts until host-wasm is Every interface of `wit/host` is served here. CPU in use: about 1 s at start to compile the
removed. `--gfx-out` frames match the Rust host's except for text anti-aliasing (stb_truetype component, then idle.
against ab_glyph). CPU matches it in use: about 1 s at start to compile the component, then idle.
`WASMHOST_TRACE=1` logs every host call; `WASMHOST_PROFILE=1` prints the time spent in each host `WASMHOST_TRACE=1` logs every host call; `WASMHOST_PROFILE=1` prints the time spent in each host
function every 5 s. function every 5 s.
+1 -2
View File
@@ -1,7 +1,6 @@
///| `chandra:host/raster` and `chandra:host/font`: the compositor sends draw operations and window ///| `chandra:host/raster` and `chandra:host/font`: the compositor sends draw operations and window
/// surface ids; the pixels live here (raster_stub.c) and never cross the component boundary. /// surface ids; the pixels live here (raster_stub.c) and never cross the component boundary.
/// What to draw where (layers, the wallpaper cache, damage) is decided here, as in /// What to draw where (layers, the wallpaper cache, damage) is decided here.
/// host-wasm/src/raster.rs.
///| ///|
extern "C" fn rs_resize(w : Int, h : Int) -> Int = "rs_resize" extern "C" fn rs_resize(w : Int, h : Int) -> Int = "rs_resize"
+1 -2
View File
@@ -1,7 +1,6 @@
/* The host's rasteriser (chandra:host/raster), pixel work in C. /* The host's rasteriser (chandra:host/raster), pixel work in C.
* *
* A port of host-wasm/src/raster.rs, itself a port of compositor/renderer, so a frame comes out * A port of compositor/renderer, so a frame comes out pixel for pixel the same. raster.mbt decides what to draw (layers, damage, the wallpaper cache);
* pixel for pixel the same. raster.mbt decides what to draw (layers, damage, the wallpaper cache);
* this file owns the framebuffer, the captured client surfaces, the images and the glyph cache, * this file owns the framebuffer, the captured client surfaces, the images and the glyph cache,
* and draws one primitive per call, inside the current clip. * and draws one primitive per call, inside the current clip.
* *
+2 -2
View File
@@ -13,13 +13,13 @@ world clock-widget {
} }
/// The optional `module-config` export on its own. A module of any world may add it to get its own /// The optional `module-config` export on its own. A module of any world may add it to get its own
/// settings in its right-click menu; hosts look it up separately (host-wasm binds it with this world). /// settings in its right-click menu; hosts look it up separately.
world configurable { world configurable {
export module-config; export module-config;
} }
/// The optional `desktop-module` export on its own (wit/desktop.wit): what makes a module a /// The optional `desktop-module` export on its own (wit/desktop.wit): what makes a module a
/// desktop module. Hosts look it up by name like `module-config` (host-wasm binds this world). /// desktop module. Hosts look it up by name like `module-config`.
world desktop-export { world desktop-export {
export desktop-module; export desktop-module;
} }