Rename the project to Chandra
CI / test (push) Failing after 16s

moon-plasma / moonplasma / MoonPlasma / Moon Plasma become chandra / Chandra
everywhere: the WIT package (chandra:desktop, chandra:host, chandra:wm), the
MoonBit module (chandra/desktop) and generated bindings, the Rust host,
identifiers (ChandraCompositor), the session script (chandra-session) and
desktop entry (chandra.desktop), config and data paths
($XDG_CONFIG_HOME/chandra, share/chandra/modules), env vars (CHANDRA_*),
UI strings, docs and tests. The test fixture components are rebuilt against
the renamed WIT.

Saved panel.edn and state.edn are still read from the old
$XDG_CONFIG_HOME/moon-plasma until the first save writes the new copy.

The remote repository keeps its experiments/moon-plasma name for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hi3L9oVBoRd373Qr4n
This commit is contained in:
VandClaude Opus 5.5 committed 2026-11-25 17:12:57 +00:00
1 parent 5dfe34027b
commit af774d76fe
323 files changed
+1055 -1013

No files matched your search

+3 -3
View File
@@ -123,7 +123,7 @@ pub fn run(args : Array[String]) -> Int {
let gfx_surface = @gfx.Surface::new({ width: Some(width), height: Some(height) })
match @host.MoonPlasmaCompositor::new(socket_path, theme, width, height) {
match @host.ChandraCompositor::new(socket_path, theme, width, height) {
None => {
match kms {
Some(k) => k.close()
@@ -155,7 +155,7 @@ pub fn run(args : Array[String]) -> Int {
"" => "/tmp"
d => d
}
match @nested.NestedWindow::open(display, rt, "moon-plasma", "moon-plasma", width, height) {
match @nested.NestedWindow::open(display, rt, "chandra", "chandra", width, height) {
Some(n) => Some(n)
None => {
@sys.log("failed to open a window on the host Wayland display")
@@ -170,7 +170,7 @@ pub fn run(args : Array[String]) -> Int {
Some(k) => comp.server.set_keymap(k.keymap)
None => ()
}
@sys.log("moon-plasma compositor listening on " + socket_path)
@sys.log("chandra compositor listening on " + socket_path)
let mut frames = 0
// A changed frame waits here until the display can take it (no page flip in flight).
let mut need_present = true
+8 -8
View File
@@ -1,13 +1,13 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/scene" @scene,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/gfx" @gfx,
"moonplasma/desktop/compositor/host" @host,
"moonplasma/desktop/compositor/nested" @nested,
"moonplasma/desktop/compositor/kms" @kms,
"moonplasma/desktop/compositor/raster" @raster,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/gfx" @gfx,
"chandra/desktop/compositor/host" @host,
"chandra/desktop/compositor/nested" @nested,
"chandra/desktop/compositor/kms" @kms,
"chandra/desktop/compositor/raster" @raster,
}
supported_targets = "+native+wasm"
+1 -1
View File
@@ -1,5 +1,5 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/compositor/app"
package "chandra/desktop/compositor/app"
// Values
pub fn run(Array[String]) -> Int32
+3 -3
View File
@@ -73,7 +73,7 @@ fn main {
})
let gfx_ctx = @gfx.SurfaceFrameBufferContext::new(gfx_surface)
match @host.MoonPlasmaCompositor::new(socket_path, theme, width, height) {
match @host.ChandraCompositor::new(socket_path, theme, width, height) {
Some(comp) => {
comp.shell.persist = true // remember which modules are loaded in the panel
comp.restore_state() // and the layout mode and recent apps from the last session
@@ -101,7 +101,7 @@ fn main {
Some(d) => d
None => "/tmp"
}
match @nested.NestedWindow::open(display, rt, "moon-plasma", "moon-plasma", width, height) {
match @nested.NestedWindow::open(display, rt, "chandra", "chandra", width, height) {
Some(n) => Some(n)
None => {
println("failed to open a window on the host Wayland display")
@@ -116,7 +116,7 @@ fn main {
Some(k) => comp.server.set_keymap(k.keymap)
None => ()
}
println("moon-plasma compositor listening on " + socket_path + " (wasi-gfx surface active)")
println("chandra compositor listening on " + socket_path + " (wasi-gfx surface active)")
while true {
comp.step()
if comp.quit_requested {
+7 -7
View File
@@ -1,13 +1,13 @@
import {
"moonbitlang/core/builtin",
"moonbitlang/core/env",
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/scene" @scene,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/gfx" @gfx,
"moonplasma/desktop/compositor/host" @host,
"moonplasma/desktop/compositor/nested" @nested,
"moonplasma/desktop/compositor/kms" @kms,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/gfx" @gfx,
"chandra/desktop/compositor/host" @host,
"chandra/desktop/compositor/nested" @nested,
"chandra/desktop/compositor/kms" @kms,
}
supported_targets = "-all+native"
+1 -1
View File
@@ -1,7 +1,7 @@
///| Real text rendering: Allo Variable (UI text, falling back to Adwaita Sans) and Adwaita Mono
/// (code), rasterised and plugged into the renderer's glyph hook. The pure-MoonBit renderer keeps its
/// bitmap font when no hook is set. Two backends supply the glyphs: font_native.mbt (stb_truetype
/// through a C shim) and font_wasm.mbt (the host's `moonplasma:host/font` import).
/// through a C shim) and font_wasm.mbt (the host's `chandra:host/font` import).
///| A rasterised glyph as a backend returns it: 8-bit coverage `w` x `h` whose top-left is at
/// (`xoff`, `yoff`) from the pen on the baseline, and the pen `advance`.
+1 -1
View File
@@ -1,5 +1,5 @@
///| Wasm font backend: the component has no C rasteriser, so glyphs come from the host's
/// `moonplasma:host/font` import (the host draws them from the TTF files it loads).
/// `chandra:host/font` import (the host draws them from the TTF files it loads).
///| Load a TTF file into `slot`.
fn b_load(slot : Int, path : String) -> Bool {
+2 -2
View File
@@ -1,7 +1,7 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/interface/moonplasma/host/font" @hostfont,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/interface/chandra/host/font" @hostfont,
}
supported_targets = "+native+wasm"
+2 -2
View File
@@ -1,5 +1,5 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/scene" @scene,
"moonplasma/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/renderer" @renderer,
}
+3 -3
View File
@@ -1,9 +1,9 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/compositor/gfx"
package "chandra/desktop/compositor/gfx"
import {
"moonplasma/desktop/compositor/renderer",
"moonplasma/desktop/compositor/scene",
"chandra/desktop/compositor/renderer",
"chandra/desktop/compositor/scene",
}
// Values
+46 -46
View File
@@ -27,7 +27,7 @@ pub(all) struct HostPopup {
}
///|
pub(all) struct MoonPlasmaCompositor {
pub(all) struct ChandraCompositor {
/// Open popups, oldest first (the last is topmost).
popups : Array[HostPopup]
server : @wayland.WaylandServer
@@ -74,12 +74,12 @@ pub(all) struct MoonPlasmaCompositor {
}
///|
pub fn MoonPlasmaCompositor::new(
pub fn ChandraCompositor::new(
socket_path : String,
theme : @scene.ThemeTokens,
output_w : Int,
output_h : Int,
) -> MoonPlasmaCompositor? {
) -> ChandraCompositor? {
ignore(@font.install()) // Adwaita Mono; keeps the bitmap font if it's missing
let server = match @wayland.WaylandServer::listen(socket_path, output_w, output_h) {
Some(s) => s
@@ -141,7 +141,7 @@ fn work_area_for(w : Int, h : Int, theme : @scene.ThemeTokens) -> @wm.Rect {
///| The output changed size (the nested window was resized, maximized or made fullscreen):
/// lay the desktop out for the new size, so nothing is drawn past the edge and cropped away.
pub fn MoonPlasmaCompositor::resize(self : MoonPlasmaCompositor, w : Int, h : Int) -> Unit {
pub fn ChandraCompositor::resize(self : ChandraCompositor, w : Int, h : Int) -> Unit {
if w <= 0 || h <= 0 || (w == self.output_w && h == self.output_h) {
return
}
@@ -158,7 +158,7 @@ pub fn MoonPlasmaCompositor::resize(self : MoonPlasmaCompositor, w : Int, h : In
}
///|
pub fn MoonPlasmaCompositor::close(self : MoonPlasmaCompositor) -> Unit {
pub fn ChandraCompositor::close(self : ChandraCompositor) -> Unit {
for _, win in self.windows {
release_snapshot(win.surface)
}
@@ -184,8 +184,8 @@ pub(all) struct FrameSig {
}
///|
fn MoonPlasmaCompositor::apply_actions(
self : MoonPlasmaCompositor,
fn ChandraCompositor::apply_actions(
self : ChandraCompositor,
actions : Array[@wm.WmAction],
) -> Unit {
for act in actions {
@@ -236,7 +236,7 @@ fn MoonPlasmaCompositor::apply_actions(
}
///| Send the size changes coalesced during a divider drag.
fn MoonPlasmaCompositor::flush_configures(self : MoonPlasmaCompositor) -> Unit {
fn ChandraCompositor::flush_configures(self : ChandraCompositor) -> Unit {
for wid, win in self.windows {
if win.cfg_dirty {
win.cfg_dirty = false
@@ -253,7 +253,7 @@ fn MoonPlasmaCompositor::flush_configures(self : MoonPlasmaCompositor) -> Unit {
}
///|
pub fn MoonPlasmaCompositor::step(self : MoonPlasmaCompositor) -> Unit {
pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
self.flush_configures()
let events = self.server.poll_events()
for ev in events {
@@ -398,8 +398,8 @@ pub fn MoonPlasmaCompositor::step(self : MoonPlasmaCompositor) -> Unit {
}
///|
pub fn MoonPlasmaCompositor::set_layout_mode(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::set_layout_mode(
self : ChandraCompositor,
mode : @wm.LayoutMode,
) -> Unit {
self.layout_mode = mode
@@ -416,7 +416,7 @@ pub fn MoonPlasmaCompositor::set_layout_mode(
///| Restore what the last session left (layout mode, recent apps) from state.edn. Call once,
/// after turning `shell.persist` on; a no-op without persistence.
pub fn MoonPlasmaCompositor::restore_state(self : MoonPlasmaCompositor) -> Unit {
pub fn ChandraCompositor::restore_state(self : ChandraCompositor) -> Unit {
let st = self.shell.load_state()
self.shell.apply_state(st)
match st.layout {
@@ -428,8 +428,8 @@ pub fn MoonPlasmaCompositor::restore_state(self : MoonPlasmaCompositor) -> Unit
}
///|
fn MoonPlasmaCompositor::build_scene(
self : MoonPlasmaCompositor,
fn ChandraCompositor::build_scene(
self : ChandraCompositor,
) -> (@scene.SceneGraph, Bool) {
self.flush_configures()
let scene = @scene.SceneGraph::new(self.output_w, self.output_h)
@@ -545,8 +545,8 @@ fn MoonPlasmaCompositor::build_scene(
///| Compose the desktop for the host rasteriser (the wasm compositor): the scene to draw, or None
/// when nothing changed since the last one, so an idle desktop costs nothing to draw or present.
pub fn MoonPlasmaCompositor::compose_scene(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::compose_scene(
self : ChandraCompositor,
) -> @scene.SceneGraph? {
let (scene, changed) = self.build_scene()
self.frame_changed = changed
@@ -555,8 +555,8 @@ pub fn MoonPlasmaCompositor::compose_scene(
///| Compose the desktop and draw it with the software renderer (the native build and the tests).
/// An unchanged desktop hands back the previous pixels instead of rasterising them again.
pub fn MoonPlasmaCompositor::compose_frame(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::compose_frame(
self : ChandraCompositor,
) -> @renderer.Pixmap {
let (scene, changed) = self.build_scene()
match self.last_frame {
@@ -578,8 +578,8 @@ pub fn MoonPlasmaCompositor::compose_frame(
///|
/// Compose the current desktop GUI frame and present it onto a wasi-gfx
/// `SurfaceFrameBufferContext`.
pub fn MoonPlasmaCompositor::present_to_gfx(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::present_to_gfx(
self : ChandraCompositor,
ctx : @gfx.SurfaceFrameBufferContext,
) -> @renderer.Pixmap {
let pixmap = self.compose_frame()
@@ -591,8 +591,8 @@ pub fn MoonPlasmaCompositor::present_to_gfx(
///|
/// Process pending wasi-gfx surface input events (pointer clicks for focus).
pub fn MoonPlasmaCompositor::handle_gfx_events(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::handle_gfx_events(
self : ChandraCompositor,
surface : @gfx.Surface,
) -> Unit {
let downs = surface.drain_pointer_down()
@@ -624,7 +624,7 @@ pub fn MoonPlasmaCompositor::handle_gfx_events(
///| Content origin of a window or popup.
fn MoonPlasmaCompositor::origin_of(self : MoonPlasmaCompositor, wid : UInt64) -> (Int, Int) {
fn ChandraCompositor::origin_of(self : ChandraCompositor, wid : UInt64) -> (Int, Int) {
match self.windows.get(wid) {
Some(win) => (win.geometry.x, win.geometry.y)
None => {
@@ -640,7 +640,7 @@ fn MoonPlasmaCompositor::origin_of(self : MoonPlasmaCompositor, wid : UInt64) ->
}
///| Absolute rectangle of a popup, nudged to stay on screen.
fn MoonPlasmaCompositor::popup_rect(self : MoonPlasmaCompositor, p : HostPopup) -> @scene.Rect {
fn ChandraCompositor::popup_rect(self : ChandraCompositor, p : HostPopup) -> @scene.Rect {
let (w, h) = match p.surface {
Some(s) => (s.width, s.height)
None => (p.w, p.h)
@@ -654,7 +654,7 @@ fn MoonPlasmaCompositor::popup_rect(self : MoonPlasmaCompositor, p : HostPopup)
}
///|
fn MoonPlasmaCompositor::origin_of_parent(self : MoonPlasmaCompositor, p : HostPopup) -> (Int, Int) {
fn ChandraCompositor::origin_of_parent(self : ChandraCompositor, p : HostPopup) -> (Int, Int) {
if p.parent == p.id {
(0, 0)
} else {
@@ -663,7 +663,7 @@ fn MoonPlasmaCompositor::origin_of_parent(self : MoonPlasmaCompositor, p : HostP
}
///| Top-most popup under (x, y).
fn MoonPlasmaCompositor::popup_at(self : MoonPlasmaCompositor, x : Int, y : Int) -> HostPopup? {
fn ChandraCompositor::popup_at(self : ChandraCompositor, x : Int, y : Int) -> HostPopup? {
let mut i = self.popups.length() - 1
while i >= 0 {
let p = self.popups[i]
@@ -677,7 +677,7 @@ fn MoonPlasmaCompositor::popup_at(self : MoonPlasmaCompositor, x : Int, y : Int)
}
///| The toplevel a popup chain hangs off (for returning keyboard focus).
fn MoonPlasmaCompositor::popup_root(self : MoonPlasmaCompositor, wid : UInt64) -> UInt64? {
fn ChandraCompositor::popup_root(self : ChandraCompositor, wid : UInt64) -> UInt64? {
let mut cur = wid
let mut n = 0
while n < 16 {
@@ -700,7 +700,7 @@ fn MoonPlasmaCompositor::popup_root(self : MoonPlasmaCompositor, wid : UInt64) -
}
///| Forget a popup (and any popups hanging off it); give keyboard focus back to its window.
fn MoonPlasmaCompositor::close_popup(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
fn ChandraCompositor::close_popup(self : ChandraCompositor, wid : UInt64) -> Unit {
let mut found = false
for p in self.popups {
if p.id == wid {
@@ -735,7 +735,7 @@ fn MoonPlasmaCompositor::close_popup(self : MoonPlasmaCompositor, wid : UInt64)
}
///| Send pointer enter/motion for a popup under the pointer.
fn MoonPlasmaCompositor::pointer_into_popup(self : MoonPlasmaCompositor, p : HostPopup, time_ms : UInt, motion : Bool) -> Unit {
fn ChandraCompositor::pointer_into_popup(self : ChandraCompositor, p : HostPopup, time_ms : UInt, motion : Bool) -> Unit {
let r = self.popup_rect(p)
let lx = self.ptr_x - r.x.to_double()
let ly = self.ptr_y - r.y.to_double()
@@ -750,7 +750,7 @@ fn MoonPlasmaCompositor::pointer_into_popup(self : MoonPlasmaCompositor, p : Hos
}
///| Move keyboard focus (wl_keyboard leave/enter + current modifiers).
fn MoonPlasmaCompositor::set_kbd_focus(self : MoonPlasmaCompositor, wid : UInt64?) -> Unit {
fn ChandraCompositor::set_kbd_focus(self : ChandraCompositor, wid : UInt64?) -> Unit {
if self.kbd_win == wid {
return
}
@@ -769,7 +769,7 @@ fn MoonPlasmaCompositor::set_kbd_focus(self : MoonPlasmaCompositor, wid : UInt64
}
///| Top-most window under (x, y): (id, in client area). The titlebar counts as the window but not the client.
fn MoonPlasmaCompositor::window_at(self : MoonPlasmaCompositor, x : Int, y : Int) -> (UInt64, Bool)? {
fn ChandraCompositor::window_at(self : ChandraCompositor, x : Int, y : Int) -> (UInt64, Bool)? {
let order = self.wm.stacking_order()
let mut i = order.length() - 1
while i >= 0 {
@@ -793,8 +793,8 @@ fn MoonPlasmaCompositor::window_at(self : MoonPlasmaCompositor, x : Int, y : Int
///| Resize zone under (x, y) on a floating window: its corners (12px) and left/right/bottom
/// edges. The first window whose outer box contains the point decides; tiled windows resize
/// through the dividers instead.
fn MoonPlasmaCompositor::resize_at(
self : MoonPlasmaCompositor,
fn ChandraCompositor::resize_at(
self : ChandraCompositor,
x : Int,
y : Int,
) -> (UInt64, @wm.DragMode)? {
@@ -852,8 +852,8 @@ fn MoonPlasmaCompositor::resize_at(
///| Title-bar button under (x, y) for window `wid`: 1 minimize, 2 maximize, 3 close, 0 none.
/// Mirrors the layout in `build_breeze_decoration` (18px buttons, 8px apart, 10px from the right edge).
fn MoonPlasmaCompositor::title_button_at(
self : MoonPlasmaCompositor,
fn ChandraCompositor::title_button_at(
self : ChandraCompositor,
wid : UInt64,
x : Int,
y : Int,
@@ -887,8 +887,8 @@ fn MoonPlasmaCompositor::title_button_at(
}
///| Activate the title-bar button `btn` of window `wid`.
fn MoonPlasmaCompositor::press_title_button(
self : MoonPlasmaCompositor,
fn ChandraCompositor::press_title_button(
self : ChandraCompositor,
wid : UInt64,
btn : Int,
) -> Unit {
@@ -920,14 +920,14 @@ fn MoonPlasmaCompositor::press_title_button(
///| Focus a window and bring it to the front through the window manager, so its stacking
/// order (not just the drawing) changes.
fn MoonPlasmaCompositor::activate_window(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
fn ChandraCompositor::activate_window(self : ChandraCompositor, wid : UInt64) -> Unit {
self.apply_actions(
self.wm.handle_request(wid, @wm.WindowRequest::Activate, self.work_area),
)
}
///| Restore a minimized window (or focus a visible one) from its task-bar pill.
fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64) -> Unit {
fn ChandraCompositor::activate_task(self : ChandraCompositor, wid : UInt64) -> Unit {
let minimized = match self.wm.windows.get(wid) {
Some(r) => r.minimized
None => return
@@ -943,7 +943,7 @@ fn MoonPlasmaCompositor::activate_task(self : MoonPlasmaCompositor, wid : UInt64
}
///| Carry out what panel modules asked for: focus a window, switch layout.
fn MoonPlasmaCompositor::run_shell_actions(self : MoonPlasmaCompositor) -> Unit {
fn ChandraCompositor::run_shell_actions(self : ChandraCompositor) -> Unit {
for a in self.shell.take_actions() {
match a {
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
@@ -960,8 +960,8 @@ fn MoonPlasmaCompositor::run_shell_actions(self : MoonPlasmaCompositor) -> Unit
}
///| Tiling divider under (x, y), with a few pixels of slack either side.
fn MoonPlasmaCompositor::handle_at(
self : MoonPlasmaCompositor,
fn ChandraCompositor::handle_at(
self : ChandraCompositor,
x : Int,
y : Int,
) -> @wm.SplitHandle? {
@@ -982,7 +982,7 @@ fn MoonPlasmaCompositor::handle_at(
}
///|
fn MoonPlasmaCompositor::leave_pointer(self : MoonPlasmaCompositor) -> Unit {
fn ChandraCompositor::leave_pointer(self : ChandraCompositor) -> Unit {
match self.ptr_win {
Some(w) => {
self.server.pointer_leave(w)
@@ -1025,8 +1025,8 @@ fn key_name(code : UInt, shift : Bool) -> String {
///| Route host input: shell (launcher) first, then the window under the pointer
/// / the keyboard-focused window.
pub fn MoonPlasmaCompositor::handle_input(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::handle_input(
self : ChandraCompositor,
ev : @nested.InputEvent,
time_ms : UInt,
) -> Unit {
@@ -1307,7 +1307,7 @@ pub fn MoonPlasmaCompositor::handle_input(
///| Cursor shape (wp_cursor_shape_v1 value) for the current pointer position: shell UI
/// decides over the launcher; a client window decides inside its client area; otherwise default.
pub fn MoonPlasmaCompositor::desired_cursor(self : MoonPlasmaCompositor) -> UInt {
pub fn ChandraCompositor::desired_cursor(self : ChandraCompositor) -> UInt {
let shell_shape = self.shell.cursor_at(self.ptr_x.to_int(), self.ptr_y.to_int())
if shell_shape != 0U {
return shell_shape
+6 -6
View File
@@ -139,7 +139,7 @@ fn bind_global(
///|
fn open_and_configure_client(
comp : @host.MoonPlasmaCompositor,
comp : @host.ChandraCompositor,
socket_path : String,
title : String,
app_id : String,
@@ -217,7 +217,7 @@ fn open_and_configure_client(
///|
fn commit_shm_frame(
comp : @host.MoonPlasmaCompositor,
comp : @host.ChandraCompositor,
c : TestWaylandClient,
shm_id : UInt,
surf_id : UInt,
@@ -317,11 +317,11 @@ test "e2e pure-moonbit wayland compositor with lib/wm, ssd decorations, and shm
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
// Client 1: MoonTerm
let (c1, shm1, surf1, xdg1, _tl1, _deco1) = open_and_configure_client(
comp, socket_path, "MoonTerm", "org.moonplasma.term",
comp, socket_path, "MoonTerm", "org.chandra.term",
)
assert_eq(c1.deco_mode, Some(2U)) // ServerSide
assert_true(c1.configured_w > 1200 && c1.configured_h > 600)
@@ -347,7 +347,7 @@ test "e2e pure-moonbit wayland compositor with lib/wm, ssd decorations, and shm
// Client 2: Files -> verify BSP tiling splits the screen!
let (c2, shm2, surf2, xdg2, _tl2, _deco2) = open_and_configure_client(
comp, socket_path, "Files", "org.moonplasma.files",
comp, socket_path, "Files", "org.chandra.files",
)
assert_true(c2.configured_w > 0 && c2.configured_w < 700)
commit_shm_frame(comp, c2, shm2, surf2, xdg2, 2UL)
@@ -369,7 +369,7 @@ test "a buffer stays valid after its wl_shm_pool is destroyed" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
comp, socket_path, "Kwi", "org.kde.kwi",
)
+58 -32
View File
@@ -3,19 +3,19 @@
/// Needs the modules: run scripts/build-modules.sh (just test does).
///| Rectangle of the panel module `id` (file stem), as last drawn.
fn rect_of(comp : @host.MoonPlasmaCompositor, id : String) -> @scene.Rect {
fn rect_of(comp : @host.ChandraCompositor, id : String) -> @scene.Rect {
comp.shell.slot_rect(comp.shell.slot_of(id))
}
///| Centre of the panel module `id`.
fn center_of(comp : @host.MoonPlasmaCompositor, id : String) -> (Double, Double) raise {
fn center_of(comp : @host.ChandraCompositor, id : String) -> (Double, Double) raise {
let r = rect_of(comp, id)
assert_true(r.w > 0)
((r.x + r.w / 2).to_double(), (r.y + r.h / 2).to_double())
}
///| Move to (x, y), press and release `btn`, then draw a frame.
fn click_at(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt, btn? : UInt = 272U) -> Unit {
fn click_at(comp : @host.ChandraCompositor, x : Int, y : Int, t : UInt, btn? : UInt = 272U) -> Unit {
comp.handle_input(@nested.InputEvent::PointerMove(x.to_double(), y.to_double()), t)
comp.handle_input(@nested.InputEvent::PointerButton(btn, true), t + 1U)
comp.handle_input(@nested.InputEvent::PointerButton(btn, false), t + 2U)
@@ -23,16 +23,16 @@ fn click_at(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt, btn?
}
///| Click the centre of panel module `id`.
fn click_module(comp : @host.MoonPlasmaCompositor, id : String, t : UInt) -> Unit raise {
fn click_module(comp : @host.ChandraCompositor, id : String, t : UInt) -> Unit raise {
let (x, y) = center_of(comp, id)
click_at(comp, x.to_int(), y.to_int(), t)
}
///| A fresh compositor with the default panel and a first frame drawn.
fn new_comp(tag : String) -> @host.MoonPlasmaCompositor {
fn new_comp(tag : String) -> @host.ChandraCompositor {
let socket_path = "/tmp/wayland-moon-" + tag + "-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(comp.compose_frame())
comp
}
@@ -80,7 +80,7 @@ test "host input reaches the focused client and the launcher popup opens" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
comp, socket_path, "T", "t",
)
@@ -169,7 +169,7 @@ test "dragging the divider between two tiled windows resizes them" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
let left = comp.windows.get(1UL).unwrap().geometry
@@ -196,7 +196,7 @@ test "the layout module opens a popup to pick Tiling, Monocle or Floating" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame())
@@ -237,7 +237,7 @@ test "title-bar buttons minimize, maximize and close windows" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, _shm, _surf, _xdg, tl, _deco) = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame())
@@ -282,7 +282,7 @@ test "the task list module focuses the window whose pill is clicked" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame())
@@ -376,7 +376,7 @@ test "tapping Super toggles the launcher; Super+key does not" {
///|
test "the panel is saved to panel.edn and restored" {
// Never touch the user's real config: only run when a scratch dir is provided.
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
let theme = @scene.ThemeTokens::moon_night()
let a = @shell.DesktopShell::new("x")
a.persist = true
@@ -510,7 +510,7 @@ test "Desktop Pulse reads live machine and window state through its granted inte
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame())
@@ -548,7 +548,7 @@ test "Desktop Pulse reads live machine and window state through its granted inte
test "the desktop card can be dragged across the wallpaper" {
let socket_path = "/tmp/wayland-moon-desk-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(comp.compose_frame())
// Default: top-right, 24px in. Grab it by its body.
let gx = 1280 - 260 - 24 + 40
@@ -570,7 +570,7 @@ test "the desktop card can be dragged across the wallpaper" {
test "an xdg_popup (right-click menu) is placed, drawn, clickable and dismissed from outside" {
let socket_path = "/tmp/wayland-moon-popup-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(comp, socket_path, "T", "t")
commit_shm_frame(comp, c, shm, surf, xdg, 1UL)
let win = comp.windows.get(1UL).unwrap().geometry
@@ -726,7 +726,7 @@ fn data_device_for(c : TestWaylandClient) -> (UInt, UInt) {
test "copy in one client, paste in another" {
let socket_path = "/tmp/wayland-moon-clip-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (a, _, _, _, _, _) = open_and_configure_client(comp, socket_path, "A", "a")
let (b, _, _, _, _, _) = open_and_configure_client(comp, socket_path, "B", "b")
let (mgr_a, dev_a) = data_device_for(a)
@@ -782,7 +782,7 @@ test "dragging a title bar moves the window and floats it" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
let g0 = comp.windows.get(2UL).unwrap().geometry
@@ -806,7 +806,7 @@ test "dragging a floating window's corner resizes it" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b")
// Float window 2 by dragging its title bar a little.
@@ -861,7 +861,7 @@ fn read_state_edn() -> String {
"" => @sys.getenv("HOME") + "/.config"
c => c
}
let raw = @sys.read_file_bytes(dir + "/moon-plasma/state.edn")
let raw = @sys.read_file_bytes(dir + "/chandra/state.edn")
let sb = StringBuilder::new()
for i = 0; i < raw.length(); i = i + 1 {
sb.write_char(Int::unsafe_to_char(raw[i].to_int())) // the file is ASCII
@@ -875,14 +875,14 @@ fn write_state_edn(text : String) -> Unit {
"" => @sys.getenv("HOME") + "/.config"
c => c
}
ignore(@sys.mkdir_p(dir + "/moon-plasma"))
ignore(@sys.write_file_bytes(dir + "/moon-plasma/state.edn", @sys.str_to_utf8_bytes(text)))
ignore(@sys.mkdir_p(dir + "/chandra"))
ignore(@sys.write_file_bytes(dir + "/chandra/state.edn", @sys.str_to_utf8_bytes(text)))
}
///|
test "the layout mode and recent apps are saved to state.edn and restored; other keys survive" {
// Never touch the user's real config: only run when the test runner gave us a scratch dir.
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
write_state_edn(";; hand-written\n{:note \"keep me\" :layout :tiling}\n")
let a = new_comp("state-a")
a.shell.persist = true
@@ -915,7 +915,7 @@ test "the layout mode and recent apps are saved to state.edn and restored; other
///|
test "the desktop card position is saved when dropped and restored" {
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
write_state_edn("{:note \"keep\"}\n")
let a = new_comp("card-a")
a.shell.persist = true
@@ -939,7 +939,7 @@ test "the desktop card position is saved when dropped and restored" {
test "clicking a floating window brings it in front of the others" {
let socket_path = "/tmp/wayland-moon-z-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
comp.set_layout_mode(@wm.LayoutMode::Floating)
@@ -958,11 +958,11 @@ test "clicking a floating window brings it in front of the others" {
///|
test "a window dragged somewhere reopens there, saved per app in state.edn" {
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
write_state_edn("{:note \"keep\"}\n")
let sock1 = "/tmp/wayland-moon-wp1-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let a = @host.MoonPlasmaCompositor::new(sock1, theme, 1280, 720).unwrap()
let a = @host.ChandraCompositor::new(sock1, theme, 1280, 720).unwrap()
a.shell.persist = true
a.set_layout_mode(@wm.LayoutMode::Floating)
ignore(open_and_configure_client(a, sock1, "T", "org.test.app"))
@@ -980,7 +980,7 @@ test "a window dragged somewhere reopens there, saved per app in state.edn" {
assert_true(text.contains(":note \"keep\""))
// A new session: the same app opens where it was left.
let sock2 = "/tmp/wayland-moon-wp2-" + @sys.getpid().to_string() + ".sock"
let b = @host.MoonPlasmaCompositor::new(sock2, theme, 1280, 720).unwrap()
let b = @host.ChandraCompositor::new(sock2, theme, 1280, 720).unwrap()
b.shell.persist = true
b.restore_state()
ignore(open_and_configure_client(b, sock2, "T", "org.test.app"))
@@ -995,7 +995,7 @@ test "a window dragged somewhere reopens there, saved per app in state.edn" {
test "alt-tab switches to the previous window, tab again goes further back, escape cancels" {
let socket_path = "/tmp/wayland-moon-alt-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
ignore(open_and_configure_client(comp, socket_path, "C", "c"))
@@ -1047,7 +1047,7 @@ test "alt-tab switches to the previous window, tab again goes further back, esca
test "compose_scene hands the host a scene only when something changed" {
let socket_path = "/tmp/wayland-moon-scene-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
// The first scene is always drawn; the wallpaper and the desktop card are split out of it.
match comp.compose_scene() {
Some(sg) => {
@@ -1079,7 +1079,7 @@ test "compose_scene hands the host a scene only when something changed" {
test "super+d minimizes every window to show the desktop, and again brings them back" {
let socket_path = "/tmp/wayland-moon-supd-" + @sys.getpid().to_string() + ".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
ignore(open_and_configure_client(comp, socket_path, "A", "a"))
ignore(open_and_configure_client(comp, socket_path, "B", "b"))
ignore(comp.compose_frame())
@@ -1123,7 +1123,7 @@ test "super+d minimizes every window to show the desktop, and again brings them
}
///| Click (x, y) without drawing, then return the next scene's wallpaper op count (0: no new scene).
fn click_wallpaper_ops(comp : @host.MoonPlasmaCompositor, x : Int, y : Int, t : UInt) -> Int {
fn click_wallpaper_ops(comp : @host.ChandraCompositor, x : Int, y : Int, t : UInt) -> Int {
comp.handle_input(@nested.InputEvent::PointerMove(x.to_double(), y.to_double()), t)
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), t + 1U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), t + 2U)
@@ -1162,7 +1162,7 @@ test "the wallpaper module lists the wallpapers and switches the desktop to the
///|
test "the chosen wallpaper is saved to state.edn and restored" {
if @sys.getenv("MOON_PLASMA_TEST_CONFIG") == "1" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
write_state_edn("{:note \"keep\"}\n")
let a = new_comp("wall-a")
a.shell.persist = true
@@ -1184,3 +1184,29 @@ test "the chosen wallpaper is saved to state.edn and restored" {
assert_eq(c.shell.wallpaper_sel, 0)
}
}
///|
test "state saved by a build from before the rename to Chandra is still read" {
if @sys.getenv("CHANDRA_TEST_CONFIG") == "1" {
let dir = match @sys.getenv("XDG_CONFIG_HOME") {
"" => @sys.getenv("HOME") + "/.config"
c => c
}
@sys.unlink(dir + "/chandra/state.edn")
ignore(@sys.mkdir_p(dir + "/moon-plasma"))
ignore(
@sys.write_file_bytes(
dir + "/moon-plasma/state.edn",
@sys.str_to_utf8_bytes("{:layout :monocle}\n"),
),
)
let c = new_comp("state-legacy")
c.shell.persist = true
c.restore_state()
assert_eq(c.layout_mode, @wm.LayoutMode::Monocle)
// The next save goes to the new place.
c.shell.save_state()
assert_true(read_state_edn().contains(":layout :monocle"))
@sys.unlink(dir + "/moon-plasma/state.edn")
}
}
+1 -1
View File
@@ -6,7 +6,7 @@ test "inspector shows the WIT interface of the hovered component" {
@sys.getpid().to_string() +
".sock"
let theme = @scene.ThemeTokens::moon_night()
let comp = @host.MoonPlasmaCompositor::new(socket_path, theme, 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, theme, 1280, 720).unwrap()
let (c, shm, surf, xdg, _tl, _deco) = open_and_configure_client(
comp, socket_path, "T", "t",
)
+10 -10
View File
@@ -1,15 +1,15 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/lib/wm" @wm,
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/scene" @scene,
"moonplasma/desktop/compositor/shell" @shell,
"moonplasma/desktop/compositor/wasm" @wasm,
"moonplasma/desktop/compositor/nested" @nested,
"moonplasma/desktop/compositor/font" @font,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/wayland" @wayland,
"moonplasma/desktop/compositor/gfx" @gfx,
"chandra/desktop/lib/wm" @wm,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/shell" @shell,
"chandra/desktop/compositor/wasm" @wasm,
"chandra/desktop/compositor/nested" @nested,
"chandra/desktop/compositor/font" @font,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/wayland" @wayland,
"chandra/desktop/compositor/gfx" @gfx,
}
supported_targets = "+native+wasm"
+1 -1
View File
@@ -3,7 +3,7 @@
///|
test "resize redraws the desktop at the new output size" {
let socket_path = "/tmp/wayland-moon-resize-" + @sys.getpid().to_string() + ".sock"
let comp = @host.MoonPlasmaCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
let comp = @host.ChandraCompositor::new(socket_path, @scene.ThemeTokens::moon_night(), 1280, 720).unwrap()
let before = comp.compose_frame()
assert_eq((before.width, before.height), (1280, 720))
comp.resize(900, 560)
+5 -5
View File
@@ -17,8 +17,8 @@ let key_rsuper : UInt32 = 126
///|
/// Handle a key for Super+D. Returns true when the key is consumed (not for clients).
fn MoonPlasmaCompositor::show_desktop_key(
self : MoonPlasmaCompositor,
fn ChandraCompositor::show_desktop_key(
self : ChandraCompositor,
code : UInt32,
pressed : Bool,
) -> Bool {
@@ -45,8 +45,8 @@ fn MoonPlasmaCompositor::show_desktop_key(
///|
/// Minimize all visible windows of the active workspace, or restore the ones Super+D hid.
pub fn MoonPlasmaCompositor::toggle_show_desktop(
self : MoonPlasmaCompositor,
pub fn ChandraCompositor::toggle_show_desktop(
self : ChandraCompositor,
) -> Unit {
let visible = self.wm.stacking_order()
if visible.length() == 0 {
@@ -92,6 +92,6 @@ pub fn MoonPlasmaCompositor::toggle_show_desktop(
///|
/// True while Super+D has windows hidden that another Super+D would bring back.
pub fn MoonPlasmaCompositor::desktop_shown(self : MoonPlasmaCompositor) -> Bool {
pub fn ChandraCompositor::desktop_shown(self : ChandraCompositor) -> Bool {
self.desktop_hidden.length() > 0 && self.wm.stacking_order().length() == 0
}
+5 -5
View File
@@ -31,7 +31,7 @@ let key_left : UInt = 105
let key_right : UInt = 106
///| Windows of the active workspace, most recently used first (minimized ones included).
fn MoonPlasmaCompositor::switcher_candidates(self : MoonPlasmaCompositor) -> Array[UInt64] {
fn ChandraCompositor::switcher_candidates(self : ChandraCompositor) -> Array[UInt64] {
let out : Array[UInt64] = []
for ws in self.wm.workspaces {
if ws.id == self.wm.active_workspace {
@@ -52,12 +52,12 @@ fn MoonPlasmaCompositor::switcher_candidates(self : MoonPlasmaCompositor) -> Arr
}
///| True while the switcher is on screen.
pub fn MoonPlasmaCompositor::switcher_open(self : MoonPlasmaCompositor) -> Bool {
pub fn ChandraCompositor::switcher_open(self : ChandraCompositor) -> Bool {
self.switcher_on
}
///| Close the switcher; with `commit`, switch to the selected window.
fn MoonPlasmaCompositor::switcher_close(self : MoonPlasmaCompositor, commit : Bool) -> Unit {
fn ChandraCompositor::switcher_close(self : ChandraCompositor, commit : Bool) -> Unit {
if !self.switcher_on {
return
}
@@ -70,7 +70,7 @@ fn MoonPlasmaCompositor::switcher_close(self : MoonPlasmaCompositor, commit : Bo
}
///| Handle a key for the switcher. Returns true when the key is consumed (not for clients).
fn MoonPlasmaCompositor::switcher_key(self : MoonPlasmaCompositor, code : UInt, pressed : Bool, time_ms : UInt) -> Bool {
fn ChandraCompositor::switcher_key(self : ChandraCompositor, code : UInt, pressed : Bool, time_ms : UInt) -> Bool {
if code == key_lalt || code == key_ralt {
self.alt_down = pressed
if !pressed && self.switcher_on {
@@ -124,7 +124,7 @@ fn MoonPlasmaCompositor::switcher_key(self : MoonPlasmaCompositor, code : UInt,
}
///| The switcher's draw ops: a centred list, the selected row lit. Empty when closed.
fn MoonPlasmaCompositor::switcher_ops(self : MoonPlasmaCompositor) -> Array[@scene.DrawOp] {
fn ChandraCompositor::switcher_ops(self : ChandraCompositor) -> Array[@scene.DrawOp] {
let ops : Array[@scene.DrawOp] = []
if !self.switcher_on {
return ops
+1 -1
View File
@@ -1,4 +1,4 @@
///| Native display backend for running moon-plasma as a login session: DRM/KMS
///| Native display backend for running chandra as a login session: DRM/KMS
/// output (dumb buffers, page flips, hardware cursor), libinput keyboard and
/// pointer, xkbcommon keymap, libseat for device access and VT switching.
/// All state lives in the C shim (kms_stub.c); this wrapper exposes it with the
+1 -1
View File
@@ -1,5 +1,5 @@
///| Wasm display backend: the same API as kms_native.mbt, but the host owns the display and the
/// seat (`moonplasma:host/display`). The component sends frames out and reads events in.
/// seat (`chandra:host/display`). The component sends frames out and reads events in.
///|
pub(all) struct Kms {
+3 -3
View File
@@ -1,8 +1,8 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/nested" @nested,
"moonplasma/desktop/interface/moonplasma/host/display" @hostdisplay,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/nested" @nested,
"chandra/desktop/interface/chandra/host/display" @hostdisplay,
}
supported_targets = "+native+wasm"
+3 -3
View File
@@ -1,8 +1,8 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/wayland" @wayland,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/wayland" @wayland,
}
supported_targets = "+native+wasm"
+1 -1
View File
@@ -505,7 +505,7 @@ pub fn NestedWindow::present(self : NestedWindow, pixmap : @renderer.Pixmap) ->
out[o + 2] = pixmap.data[o]
out[o + 3] = b'\xff'
}
let memfd = @sys.memfd_create("moon-plasma-frame", len)
let memfd = @sys.memfd_create("chandra-frame", len)
if memfd < 0 {
return
}
+4 -4
View File
@@ -1,13 +1,13 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/scene" @scene,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/interface/moonplasma/host/raster" @hostraster,
"chandra/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/interface/chandra/host/raster" @hostraster,
}
supported_targets = "+native+wasm"
// The wasm compositor hands its scene to the host to draw (`moonplasma:host/raster`); the native
// The wasm compositor hands its scene to the host to draw (`chandra:host/raster`); the native
// build has the software renderer instead, so this package only stubs the calls there.
options(
targets: {
+1 -1
View File
@@ -1,4 +1,4 @@
///| Send a scene to the host to draw (`moonplasma:host/raster`).
///| Send a scene to the host to draw (`chandra:host/raster`).
///
/// The scene is the same one the software renderer takes (`@scene.SceneGraph`); here it is turned
/// into the interface's records and handed over. The host owns the framebuffer and does the pixel
+1 -1
View File
@@ -1,4 +1,4 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/scene" @scene,
}
+2 -2
View File
@@ -1,8 +1,8 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/compositor/renderer"
package "chandra/desktop/compositor/renderer"
import {
"moonplasma/desktop/compositor/scene",
"chandra/desktop/compositor/scene",
}
// Values
+2 -2
View File
@@ -14,7 +14,7 @@ test "software renderer alpha blending, rounded rect, shm blit, and png encoding
let (insets, deco_ops) = @scene.build_breeze_decoration(
"MoonTerm",
"org.moonplasma.term",
"org.chandra.term",
true,
false,
200,
@@ -32,7 +32,7 @@ test "software renderer alpha blending, rounded rect, shm blit, and png encoding
scene.windows.push({
id: 1UL,
title: "MoonTerm",
app_id: "org.moonplasma.term",
app_id: "org.chandra.term",
focused: true,
fullscreen: false,
geometry: @scene.Rect::new(20, 40, 100, 60),
+1 -1
View File
@@ -1,5 +1,5 @@
// Generated using `moon info`, DON'T EDIT IT
package "moonplasma/desktop/compositor/scene"
package "chandra/desktop/compositor/scene"
import {
"moonbitlang/core/debug",
+2 -2
View File
@@ -317,7 +317,7 @@ fn humanise_interface(name : String, block : Array[String]) -> Array[String] {
out
}
///| "moonplasma:desktop/theme@0.1.0;" -> "theme" (raw WIT identifier, dashes kept)
///| "chandra:desktop/theme@0.1.0;" -> "theme" (raw WIT identifier, dashes kept)
fn ref_name(s : String) -> String {
let mut r = trim(s)
if r.has_suffix(";") {
@@ -334,7 +334,7 @@ fn ref_name(s : String) -> String {
r
}
///| "moonplasma:desktop/app-catalog@0.1.0" -> "app catalog"
///| "chandra:desktop/app-catalog@0.1.0" -> "app catalog"
fn short_ref(s : String) -> String {
dashes(ref_name(s))
}
+13 -13
View File
@@ -1,20 +1,20 @@
import {
"moonbitlang/core/builtin",
"moonbitlang/core/encoding/utf8" @utf8,
"moonplasma/desktop/interface/moonplasma/desktop/types" @types,
"moonplasma/desktop/interface/moonplasma/desktop/theme" @theme,
"moonplasma/desktop/lib/ui" @ui,
"moonplasma/desktop/lib/shell" @libshell,
"moonplasma/desktop/lib/panel" @panel,
"moonplasma/desktop/lib/clock" @clock,
"moonplasma/desktop/lib/moon" @moon,
"moonplasma/desktop/lib/timefmt" @timefmt,
"moonplasma/desktop/lib/launcher" @launcher,
"moonplasma/desktop/compositor/scene" @scene,
"chandra/desktop/interface/chandra/desktop/types" @types,
"chandra/desktop/interface/chandra/desktop/theme" @theme,
"chandra/desktop/lib/ui" @ui,
"chandra/desktop/lib/shell" @libshell,
"chandra/desktop/lib/panel" @panel,
"chandra/desktop/lib/clock" @clock,
"chandra/desktop/lib/moon" @moon,
"chandra/desktop/lib/timefmt" @timefmt,
"chandra/desktop/lib/launcher" @launcher,
"chandra/desktop/compositor/scene" @scene,
"jqlssg/moonedn" @edn,
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/wasm" @wasm,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/renderer" @renderer,
"chandra/desktop/compositor/wasm" @wasm,
}
supported_targets = "+native+wasm"
+1 -1
View File
@@ -349,7 +349,7 @@ let max_recents : Int = 8
fn recents_path() -> String {
let c = @sys.getenv("XDG_CACHE_HOME")
(if c.length() > 0 { c } else { @sys.getenv("HOME") + "/.cache" }) +
"/moon-plasma-recent"
"/chandra-recent"
}
///|
+3 -3
View File
@@ -1,5 +1,5 @@
///| Saved state: what the desktop remembers between sessions, as EDN in
/// $XDG_CONFIG_HOME/moon-plasma/state.edn (next to panel.edn, which holds the module list):
/// $XDG_CONFIG_HOME/chandra/state.edn (next to panel.edn, which holds the module list):
///
/// {:layout :tiling ; the Tile | Float switcher: :tiling, :monocle or :floating
/// :recent ["foot" "dolphin"] ; the launcher's recently started apps, newest first
@@ -40,7 +40,7 @@ let wallpaper_keys : Array[String] = ["plasma-glow", "aurora", "starfield", "dus
///|
fn read_state_file() -> Array[(@edn.Value, @edn.Value)] {
let text = @utf8.decode_lossy(@sys.read_file_bytes(state_path()))
let text = @utf8.decode_lossy(read_config_file("state.edn"))
if text.length() == 0 {
return []
}
@@ -241,7 +241,7 @@ pub fn DesktopShell::save_state(self : DesktopShell) -> Unit {
Some(b) => {
let dir = panel_config_dir()
if @sys.mkdir_p(dir) {
let text = ";; Moon Plasma state: restored at the next start\n" + b + "\n"
let text = ";; Chandra state: restored at the next start\n" + b + "\n"
ignore(@sys.write_file_bytes(state_path(), @utf8.encode(text)))
}
}
+27 -11
View File
@@ -2,7 +2,7 @@
/// while the compositor runs, the capabilities (host data + requests) they use, the
/// right-click menu, and the saved panel layout.
///
/// A module is a wasm plasmoid component (`moonplasma:desktop/plasmoid`). Its imports
/// A module is a wasm plasmoid component (`chandra:desktop/plasmoid`). Its imports
/// are the capabilities it was granted: `theme` and `clock` always, `app-catalog` /
/// `app-launch` for the application menu, `windows` for the task list, `layout-control`
/// for the layout switcher, `inspector` for the Interface Explorer button and `modules`
@@ -20,7 +20,7 @@ let manager_module : String = "module-manager"
///| Directories searched for `*.wasm` modules, highest priority first.
fn module_dirs() -> Array[String] {
let dirs : Array[String] = []
let env = @sys.getenv("MOON_PLASMA_MODULES")
let env = @sys.getenv("CHANDRA_MODULES")
if env.length() > 0 {
for d in env.split(":") {
if d.length() > 0 {
@@ -32,10 +32,10 @@ fn module_dirs() -> Array[String] {
let x = @sys.getenv("XDG_DATA_HOME")
if x.length() > 0 { x } else { @sys.getenv("HOME") + "/.local/share" }
}
dirs.push(data_home + "/moon-plasma/modules")
dirs.push("/usr/local/share/moon-plasma/modules")
dirs.push("/usr/share/moon-plasma/modules")
dirs.push("modules") // the login session runs from /usr/local/share/moon-plasma
dirs.push(data_home + "/chandra/modules")
dirs.push("/usr/local/share/chandra/modules")
dirs.push("/usr/share/chandra/modules")
dirs.push("modules") // the login session runs from /usr/local/share/chandra
// In a source checkout (and from a package directory when running its tests).
dirs.push("build/components")
dirs.push("../build/components")
@@ -693,11 +693,27 @@ fn clamp_menu(v : Int, lo : Int, hi : Int) -> Int {
// ---------------------------------------------------------------- saved panel
///| Panel config lives in $XDG_CONFIG_HOME/moon-plasma/panel.edn (default ~/.config).
///| Panel config lives in $XDG_CONFIG_HOME/chandra/panel.edn (default ~/.config).
fn panel_config_dir() -> String {
config_base() + "/chandra"
}
///|
fn config_base() -> String {
let c = @sys.getenv("XDG_CONFIG_HOME")
(if c.length() > 0 { c } else { @sys.getenv("HOME") + "/.config" }) +
"/moon-plasma"
if c.length() > 0 { c } else { @sys.getenv("HOME") + "/.config" }
}
///| Read a saved config file. Before the rename to Chandra it lived under
/// $XDG_CONFIG_HOME/moon-plasma; fall back to that when there is no new copy yet
/// (the next save writes it to the new place).
fn read_config_file(name : String) -> Bytes {
let b = @sys.read_file_bytes(panel_config_dir() + "/" + name)
if b.length() > 0 {
b
} else {
@sys.read_file_bytes(config_base() + "/moon-plasma/" + name)
}
}
///| Write the loaded modules, in panel order, as EDN:
@@ -708,7 +724,7 @@ pub fn DesktopShell::save_panel_config(self : DesktopShell) -> Unit {
return
}
let sb = StringBuilder::new()
sb.write_string(";; Moon Plasma panel: the wasm modules loaded into it, in order\n")
sb.write_string(";; Chandra panel: the wasm modules loaded into it, in order\n")
sb.write_string("{:panel [")
let mut first = true
for w in self.widgets {
@@ -730,7 +746,7 @@ fn DesktopShell::load_panel_config(self : DesktopShell) -> Array[String]? {
if !self.persist {
return None
}
let text = @utf8.decode_lossy(@sys.read_file_bytes(panel_config_dir() + "/panel.edn"))
let text = @utf8.decode_lossy(read_config_file("panel.edn"))
let lines : Array[String] = []
for l in text.split("\n") {
if !l.trim(chars=" \t\r").to_string().has_prefix(";") {
+3 -3
View File
@@ -1,14 +1,14 @@
import {
"moonbitlang/core/builtin",
"moonbitlang/core/env" @env,
"moonplasma/desktop/interface/moonplasma/host/sys" @hostsys,
"moonplasma/desktop/interface/moonplasma/host/raster" @hostraster,
"chandra/desktop/interface/chandra/host/sys" @hostsys,
"chandra/desktop/interface/chandra/host/raster" @hostraster,
}
supported_targets = "+native+wasm"
// Native: POSIX through a C shim. Wasm (the compositor as a component): the same API over the
// moonplasma:host/sys imports, implemented by the native host.
// chandra:host/sys imports, implemented by the native host.
options(
targets: {
"sys_native.mbt": ["native"],
+1 -1
View File
@@ -1,5 +1,5 @@
///| The compositor as a wasm component: the same API as sys_native.mbt, with every operation
/// forwarded to the host through the `moonplasma:host/sys` imports. The component holds only
/// forwarded to the host through the `chandra:host/sys` imports. The component holds only
/// integer handles (fds) and bytes; the host owns the real descriptors.
///| Encode a String into UTF-8 Bytes.
+3 -3
View File
@@ -1,8 +1,8 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/interface/moonplasma/desktop/types" @types,
"moonplasma/desktop/interface/moonplasma/desktop/theme" @theme,
"moonplasma/desktop/interface/moonplasma/host/plasmoids" @hostpl,
"chandra/desktop/interface/chandra/desktop/types" @types,
"chandra/desktop/interface/chandra/desktop/theme" @theme,
"chandra/desktop/interface/chandra/host/plasmoids" @hostpl,
}
supported_targets = "+native+wasm"
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -1,7 +1,7 @@
///| Plasmoid host for the compositor-as-a-wasm-component build.
///
/// The native build runs panel modules itself through wasmer. A component can't embed a second
/// wasm runtime, so here the same API is a thin client of the `moonplasma:host/plasmoids` import:
/// wasm runtime, so here the same API is a thin client of the `chandra:host/plasmoids` import:
/// the host (wasmtime) instantiates the modules, serves their capability imports from the data
/// published below, and hands back draw ops and requests.
+2 -2
View File
@@ -233,7 +233,7 @@ pub fn load(path : String, tokens : @theme.Tokens) -> Result[Plasmoid, String] {
match h {
-1 => "not a wasm file"
-2 => "cannot read file"
-3 | -4 => "no plasmoid (moonplasma:desktop/plasmoid) in this module"
-3 | -4 => "no plasmoid (chandra:desktop/plasmoid) in this module"
_ => "wasm runtime error"
},
)
@@ -266,7 +266,7 @@ pub fn load(path : String, tokens : @theme.Tokens) -> Result[Plasmoid, String] {
}
}
///| Names of the moonplasma interfaces (besides types/theme) the widget at `h` imports.
///| Names of the chandra interfaces (besides types/theme) the widget at `h` imports.
fn read_imports(h : Int) -> Array[String] {
let buf = Bytes::make(512, b'\x00')
let n = c_wasm_imports(h, buf)
+10 -10
View File
@@ -1,4 +1,4 @@
/* Wasm plasmoid host: runs the core module of a moonplasma plasmoid component
/* Wasm plasmoid host: runs the core module of a chandra plasmoid component
* (or a bare core module) with wasmer's C API. Canonical-ABI marshalling stays in
* MoonBit; this file instantiates, provides the host imports (theme, clock) and
* exposes raw calls plus guest-memory reads. */
@@ -18,13 +18,13 @@
#define MAX_INST 512
enum { EX_INFO, EX_RENDER, EX_ONEVENT, EX_POPUP, EX_POST_INFO, EX_POST_RENDER, EX_POST_POPUP, EX_REALLOC, EX_N };
static const char *ex_names[EX_N] = {
"moonplasma:desktop/plasmoid@0.1.0#info",
"moonplasma:desktop/plasmoid@0.1.0#render",
"moonplasma:desktop/plasmoid@0.1.0#on-event",
"moonplasma:desktop/plasmoid@0.1.0#popup",
"cabi_post_moonplasma:desktop/plasmoid@0.1.0#info",
"cabi_post_moonplasma:desktop/plasmoid@0.1.0#render",
"cabi_post_moonplasma:desktop/plasmoid@0.1.0#popup",
"chandra:desktop/plasmoid@0.1.0#info",
"chandra:desktop/plasmoid@0.1.0#render",
"chandra:desktop/plasmoid@0.1.0#on-event",
"chandra:desktop/plasmoid@0.1.0#popup",
"cabi_post_chandra:desktop/plasmoid@0.1.0#info",
"cabi_post_chandra:desktop/plasmoid@0.1.0#render",
"cabi_post_chandra:desktop/plasmoid@0.1.0#popup",
"cabi_realloc",
};
@@ -381,9 +381,9 @@ static int load_bytes(Inst *in, const uint8_t *d, size_t n) {
}
/* "moonplasma:desktop/<iface>@<ver>" -> <iface> (copied, NUL-terminated); "" for anything else. */
/* "chandra:desktop/<iface>@<ver>" -> <iface> (copied, NUL-terminated); "" for anything else. */
static void iface_of(const wasm_name_t *m, char *out, size_t cap) {
const char *pre = "moonplasma:desktop/";
const char *pre = "chandra:desktop/";
size_t pl = strlen(pre);
out[0] = 0;
if (m->size <= pl || memcmp(m->data, pre, pl) != 0) return;
+2 -2
View File
@@ -33,7 +33,7 @@ fn load_fixture(name : String) -> Result[Plasmoid, String] {
///|
test "a plasmoid component loads and renders through wasmer" {
let p = load_fixture("clock-digital.component.wasm").unwrap()
assert_eq(p.id, "org.moonplasma.clock.digital")
assert_eq(p.id, "org.chandra.clock.digital")
assert_true(p.pref_w > 0 && p.pref_h > 0)
let ops = p.render(p.pref_w, p.pref_h, test_tokens())
assert_true(ops.length() > 0)
@@ -56,7 +56,7 @@ test "a plasmoid component loads and renders through wasmer" {
///|
test "a bare core module loads too, and junk is rejected" {
let p = load_fixture("clock-digital.core.wasm").unwrap()
assert_eq(p.id, "org.moonplasma.clock.digital")
assert_eq(p.id, "org.chandra.clock.digital")
p.unload()
assert_true(load("/nonexistent.wasm", test_tokens()) is Err(_))
}
+2 -2
View File
@@ -1,7 +1,7 @@
import {
"moonbitlang/core/builtin",
"moonplasma/desktop/compositor/sys" @sys,
"moonplasma/desktop/compositor/scene" @scene,
"chandra/desktop/compositor/sys" @sys,
"chandra/desktop/compositor/scene" @scene,
}
supported_targets = "+native+wasm"
+2 -2
View File
@@ -359,7 +359,7 @@ fn emit_output_info(
g.i32(340)
g.i32(190)
g.i32(0)
g.str("MoonPlasma")
g.str("Chandra")
g.str("Virtual-1")
g.i32(0)
c.send_msg(g.finish_msg(out_id, 0U))
@@ -1216,7 +1216,7 @@ pub fn WaylandServer::set_keymap(self : WaylandServer, keymap : Bytes) -> Unit {
///|
fn WaylandServer::send_keymap(self : WaylandServer, c : ClientConn, kid : UInt) -> Unit {
if self.keymap.length() > 0 {
let fd = @sys.memfd_create("moon-plasma-keymap", self.keymap.length())
let fd = @sys.memfd_create("chandra-keymap", self.keymap.length())
if fd >= 0 {
ignore(@sys.pwrite_bytes(fd, self.keymap, 0))
let w = WireWriter::new()