Files
chandra/compositor/scene/pkg.generated.mbti
T
Claude f2e870c251
CI / test (push) Failing after 16s
Task manager: draw each app's real icon from its .desktop file
Each pill now shows the icon the app's .desktop file names (Icon=), looked up in the
freedesktop icon themes, instead of the letter tile. The tile stays as the fallback for
windows with no app id, no desktop file or no icon the host can read.

- WIT: a new `icons` capability (`app-icon(app-id) -> u32`, a handle, never a path or pixels)
  and an `image(image-op)` draw op (appended, so existing modules keep their ABI).
  taskbar-widget and plasmoid-host import `icons`. Host raster gains `load-image(path)` and a
  `draw-image` op; the plasmoids host gets an icons table (6: app id, handle).
- Compositor (shell/icons.mbt): window app id -> desktop file (resolve_app_id, so StartupWMClass
  and last-dotted-part matches work) -> Icon= -> theme lookup (XDG data dirs, ~/.icons,
  flatpak exports; hicolor, Adwaita, breeze; 48/64/32 px PNG first, then scalable SVG when the
  host can draw it, then other sizes, then /usr/share/pixmaps). Absolute Icon= paths are used as
  they are. Results are cached per app id; the table is published only when a module imports
  `icons`.
- wasm host (host-wasm): PNG via the png crate, SVG via resvg (rendered sharp at each size),
  PNGs area-averaged to the drawn size; loads cached by path.
- Native build: a small PNG decoder (compositor/renderer/png.mbt: inflate + filters, 1-16 bit,
  palettes with tRNS) and the Image op in the software renderer. SVG-only icons fall back to the
  tile there. The wasmer stub serves `icons.app-icon` from the same table.
- Tests: PNG decoder fixtures (all filters, fixed/dynamic/stored blocks, palette), image scaling
  and drawing, icon lookup order, Icon= parsing, task module icon-or-tile (native and wasmtime),
  host raster PNG+SVG loading and drawing. Checked end to end with the wasm host: foot's
  hicolor icon shows on its pill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhmtDt52EjaW8jevGU
2026-11-25 18:52:58 +00:00

135 lines
3.0 KiB
Plaintext

// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/compositor/scene"
import {
"moonbitlang/core/debug",
}
// Values
pub fn build_breeze_decoration(String, String, Bool, Bool, Int32, Int32, ThemeTokens) -> ((Int32, Int32, Int32, Int32), Array[DrawOp])
pub fn build_shell_ops(Int32, Int32, ThemeTokens, String, Array[String]) -> (Array[DrawOp], Array[DrawOp])
// Errors
// Types and methods
pub(all) struct DamageTracker {
regions : Array[Rect]
mut full_damage : Bool
}
pub fn DamageTracker::mark_full(Self) -> Unit
pub fn DamageTracker::mark_rect(Self, Rect) -> Unit
pub fn DamageTracker::new() -> Self
pub fn DamageTracker::take_damage(Self, Int32, Int32) -> Array[Rect]
#derive(Eq)
pub(all) enum DrawOp {
FillRect(Rect, Rgba, Int32)
StrokeRect(Rect, Rgba, Int32, Int32)
Line(Int32, Int32, Int32, Int32, Rgba, Int32)
Circle(Int32, Int32, Int32, Rgba, Bool)
Text(Int32, Int32, String, Int32, Rgba, TextAlign, Bool)
MonoText(Int32, Int32, String, Int32, Rgba, TextAlign, Bool)
PushClip(Rect)
PopClip
Image(Rect, UInt32)
}
pub(all) struct PanelWidgetNode {
id : String
rect : Rect
ops : Array[DrawOp]
popup : (Rect, Array[DrawOp])?
}
#derive(Eq, @debug.Debug)
pub(all) struct Rect {
x : Int32
y : Int32
w : Int32
h : Int32
}
pub fn Rect::contains(Self, Int32, Int32) -> Bool
pub fn Rect::new(Int32, Int32, Int32, Int32) -> Self
pub fn Rect::union(Self, Self) -> Self
#derive(Eq, @debug.Debug)
pub(all) struct Rgba {
r : Byte
g : Byte
b : Byte
a : Byte
}
pub fn Rgba::from_hex(String) -> Self
pub fn Rgba::new(Int32, Int32, Int32, Int32) -> Self
pub fn Rgba::with_alpha(Self, Int32) -> Self
pub(all) struct SceneGraph {
output_w : Int32
output_h : Int32
mut wallpaper_ops : Array[DrawOp]
mut background_ops : Array[DrawOp]
mut windows : Array[WindowSceneNode]
mut panel_ops : Array[DrawOp]
mut widgets : Array[PanelWidgetNode]
mut popups : Array[(Rect, ShmBufferSnapshot)]
}
pub fn SceneGraph::new(Int32, Int32) -> Self
pub(all) struct ShmBufferSnapshot {
width : Int32
height : Int32
stride : Int32
format : Int32
bytes : Bytes
host_id : UInt32
}
#derive(Eq, @debug.Debug)
pub(all) enum TextAlign {
Left
Center
Right
}
pub(all) struct ThemePalette {
desktop_top : Rgba
desktop_bottom : Rgba
surface : Rgba
surface_hover : Rgba
surface_popup : Rgba
foreground : Rgba
foreground_muted : Rgba
accent : Rgba
accent_foreground : Rgba
border : Rgba
}
pub(all) struct ThemeTokens {
name : String
palette : ThemePalette
font_size : Int32
radius : Int32
spacing : Int32
panel_height : Int32
}
pub fn ThemeTokens::from_json_string(String) -> Self
pub fn ThemeTokens::moon_day() -> Self
pub fn ThemeTokens::moon_night() -> Self
pub(all) struct WindowSceneNode {
id : UInt64
title : String
app_id : String
focused : Bool
fullscreen : Bool
geometry : Rect
deco_insets : (Int32, Int32, Int32, Int32)
deco_ops : Array[DrawOp]
surface : ShmBufferSnapshot?
}
// Type aliases
// Traits