feat(gfx): integrate wasi-gfx for loading and presenting GUI
CI / test (push) Successful in 24s

This commit is contained in:
Antigravity committed 2026-11-25 02:54:03 +00:00
1 parent ccb809bdc3
commit 7caadb3f7f
59 files changed
+7495 -16

No files matched your search

+47
View File
@@ -274,3 +274,50 @@ pub fn MoonPlasmaCompositor::compose_frame(
ignore(self.damage.take_damage(self.output_w, self.output_h))
@renderer.render_scene(scene)
}
///|
/// Compose the current desktop GUI frame and present it onto a wasi-gfx
/// `SurfaceFrameBufferContext`.
pub fn MoonPlasmaCompositor::present_to_gfx(
self : MoonPlasmaCompositor,
ctx : @gfx.SurfaceFrameBufferContext,
) -> @renderer.Pixmap {
let pixmap = self.compose_frame()
@gfx.present_pixmap(ctx, pixmap)
pixmap
}
///|
/// Process pending wasi-gfx surface input events (pointer clicks for focus).
pub fn MoonPlasmaCompositor::handle_gfx_events(
self : MoonPlasmaCompositor,
surface : @gfx.Surface,
) -> Unit {
let downs = surface.drain_pointer_down()
for ev in downs {
let px = ev.x.to_int()
let py = ev.y.to_int()
let order = self.wm.stacking_order()
// Top-most window hit-test (iterate reverse Z-order).
let mut i = order.length() - 1
while i >= 0 {
let wid = order[i]
match self.windows.get(wid) {
Some(win) =>
if px >= win.geometry.x &&
px < win.geometry.x + win.geometry.w &&
py >= win.geometry.y - 32 &&
py < win.geometry.y + win.geometry.h {
self.apply_actions([
@wm.WmAction::Focus(wid),
@wm.WmAction::Raise(wid),
])
break
}
None => ()
}
i = i - 1
}
}
}
+1
View File
@@ -6,6 +6,7 @@ import {
"moonplasma/desktop/compositor/shell" @shell,
"moonplasma/desktop/compositor/renderer" @renderer,
"moonplasma/desktop/compositor/wayland" @wayland,
"moonplasma/desktop/compositor/gfx" @gfx,
}
supported_targets = "-all+native"