Wasm panel modules, widget host, merged plasmoid host design, and shell/UI work
Panel and wasm host - The panel is built from wasm plasmoid modules (compositor/wasm: wasmer-backed host). Modules get capabilities by importing host interfaces; the host publishes data tables and serves a request queue (launch, focus window, set layout, inspector, load/unload modules). New WIT: windows, layout-control, inspector, modules, system. - Merged two competing host designs: generic tables + requests are the base; the `system` snapshot and the id-stable `windows.all/focus` (Desktop Pulse) run on top of it. - Panel widgets: load a .wasm from a path or file chooser, reorder by dragging, right-click replace/remove/add, saved to panel.edn. - Desktop widget, system sampler (sysinfo), app catalog/humanised names, Interface Explorer (inspector), real font rendering (compositor/font, assets/fonts). Compositor - Drag the divider between tiled windows; lower tiled rows leave room for the title bar. - Title-bar buttons, 12-hour clock, truncated titles, task-list/layout menus. - DRM/KMS session, tcc debug builds (vendored tinycc incl. conftest.c), justfile recipes (modules, run, test), pixi.toml. Known gaps - The sources for the pulse, tasks, layout, inspector, module-manager, moon-* and clock-digital12 modules are not in the tree yet, so `just modules` stops at pulse and the host tests that load those modules fail until they land. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
080377fd79
commit
0145981c6a
57 files changed
+11461
-221
No files matched your search
@@ -0,0 +1,58 @@
|
||||
///| Interface Explorer: toggle from the panel, hover components, see their WIT.
|
||||
|
||||
///|
|
||||
test "inspector shows the WIT interface of the hovered component" {
|
||||
let socket_path = "/tmp/wayland-moon-inspect-" +
|
||||
@sys.getpid().to_string() +
|
||||
".sock"
|
||||
let theme = @scene.ThemeTokens::moon_night()
|
||||
let comp = @host.MoonPlasmaCompositor::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)
|
||||
ignore(comp.compose_frame()) // lays out the panel
|
||||
assert_false(comp.shell.inspecting())
|
||||
|
||||
// Open the apps popup first; turning the explorer on must not close it.
|
||||
let (lx, ly) = center_of(comp, "launcher")
|
||||
click_at(comp, lx.to_int(), ly.to_int(), 0U)
|
||||
assert_true(comp.shell.popup_open())
|
||||
|
||||
// Click the Interface Explorer button to turn inspect mode on.
|
||||
let (bx, by) = center_of(comp, "inspector")
|
||||
click_at(comp, bx.to_int(), by.to_int(), 1U)
|
||||
assert_true(comp.shell.inspecting())
|
||||
assert_true(comp.shell.popup_open())
|
||||
assert_eq(comp.desired_cursor(), 4U)
|
||||
|
||||
// Hover the launcher.
|
||||
let (lx, ly) = center_of(comp, "launcher")
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(lx, ly), 4U)
|
||||
let lslot = comp.shell.slot_of("launcher")
|
||||
assert_eq(comp.shell.hover_id, lslot)
|
||||
assert_eq(comp.desired_cursor(), 3U)
|
||||
// The explorer describes the module's real binary: what it exports and which capabilities it imports.
|
||||
let lines = comp.shell.inspector_lines_for(lslot)
|
||||
assert_true(lines.iter().any(l => l.has_prefix("# plasmoid")))
|
||||
assert_true(lines.iter().any(l => l.has_prefix("# app launch")))
|
||||
assert_true(lines.iter().any(l => l.has_prefix("# app catalog")))
|
||||
let frame = comp.compose_frame()
|
||||
let png = @renderer.encode_png(frame)
|
||||
ignore(@sys.write_file_bytes("_build/inspector_launcher.png", png))
|
||||
|
||||
// Clock, panel, window title bar and desktop resolve to their own components.
|
||||
let (cx, cy) = center_of(comp, "clock-digital12")
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(cx, cy), 5U)
|
||||
assert_eq(comp.shell.hover_id, comp.shell.slot_of("clock-digital12"))
|
||||
comp.handle_input(@nested.InputEvent::PointerMove(1270.0, 5.0), 6U)
|
||||
assert_eq(comp.shell.hover_id, "desktop")
|
||||
|
||||
// Clicks are swallowed while inspecting; Escape leaves the mode.
|
||||
comp.handle_input(@nested.InputEvent::PointerButton(0x110U, true), 7U)
|
||||
assert_true(comp.shell.popup_open()) // unchanged: the click was swallowed
|
||||
comp.handle_input(@nested.InputEvent::Key(1U, true), 8U)
|
||||
assert_false(comp.shell.inspecting())
|
||||
comp.close()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user