Logout button for the session, and a dev install that symlinks into the checkout
CI / test (push) Failing after 28s
CI / test (push) Failing after 28s
- New 'session' capability (wit/capabilities.wit) and 'logout' panel module: a button whose popup asks 'Log out | Cancel' (Enter confirms, Escape cancels). Confirming makes the compositor exit, which ends the login session; works in the wasm host and the native build. In the default panel. - session/install.py --link (just install-session-dev): symlink the host, component, modules, fonts and config into this checkout, so after one root install a rebuild is just 'just compositor-wasm host-wasm modules' for the next login. Plain installs still copy. - Tests: host runtime test for the module, native end-to-end test (click, cancel, confirm). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c03d4c6c17
commit
0ba975da67
42 files changed
+1033
-152
No files matched your search
@@ -20,6 +20,13 @@ pub fn wasmExportRun(p0 : Int, p1 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array16
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
@@ -28,10 +35,3 @@ extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|
||||||
#|(func (param i32) (param i32) (result i32)
|
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
|
||||||
#| local.get 0)
|
|
||||||
|
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn mbt_ffi_cabi_realloc(
|
||||||
|
src_offset : Int,
|
||||||
|
src_size : Int,
|
||||||
|
_dst_alignment : Int,
|
||||||
|
dst_size : Int,
|
||||||
|
) -> Int {
|
||||||
|
// malloc
|
||||||
|
if src_offset == 0 && src_size == 0 {
|
||||||
|
return mbt_ffi_malloc(dst_size)
|
||||||
|
}
|
||||||
|
// free
|
||||||
|
if dst_size == 0 {
|
||||||
|
mbt_ffi_free(src_offset)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
// realloc
|
||||||
|
let dst = mbt_ffi_malloc(dst_size)
|
||||||
|
mbt_ffi_copy(dst, src_offset, if src_size < dst_size { src_size } else { dst_size })
|
||||||
|
mbt_ffi_free(src_offset)
|
||||||
|
dst
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_copy(dest : Int, src : Int, len : Int) =
|
||||||
|
#|(func (param i32) (param i32) (param i32) local.get 0 local.get 1 local.get 2 memory.copy)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) (local i32)
|
||||||
|
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
||||||
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
@plasmoid.wasmExportPopup()
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfo() -> Int {
|
||||||
|
@plasmoid.wasmExportInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
The widget (plasmoid) contract.
|
||||||
@@ -0,0 +1,409 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfo() -> Int {
|
||||||
|
|
||||||
|
let (result) : (PlasmoidInfo) = info();
|
||||||
|
let return_area = mbt_ffi_malloc(32)
|
||||||
|
|
||||||
|
let ptr = mbt_ffi_str2ptr((result).id)
|
||||||
|
mbt_ffi_store32((return_area) + 4, (result).id.length())
|
||||||
|
mbt_ffi_store32((return_area) + 0, ptr)
|
||||||
|
|
||||||
|
let ptr0 = mbt_ffi_str2ptr((result).name)
|
||||||
|
mbt_ffi_store32((return_area) + 12, (result).name.length())
|
||||||
|
mbt_ffi_store32((return_area) + 8, ptr0)
|
||||||
|
mbt_ffi_store32((return_area) + 16, (((result).preferred).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((return_area) + 20, (((result).preferred).h).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((return_area) + 24, ((result).min_width).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((return_area) + 28, (if (result).stretch { 1 } else { 0 }))
|
||||||
|
let ret = return_area
|
||||||
|
return ret
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((p0) + 0))
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((p0) + 8))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
|
|
||||||
|
let (result) : (Array[@types.DrawOp]) = render(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()});
|
||||||
|
let return_area = mbt_ffi_malloc(8)
|
||||||
|
|
||||||
|
let address = mbt_ffi_malloc((result).length() * 32);
|
||||||
|
for index = 0; index < (result).length(); index = index + 1 {
|
||||||
|
let iter_elem : @types.DrawOp = (result)[(index)]
|
||||||
|
let iter_base = address + (index * 32);
|
||||||
|
|
||||||
|
match iter_elem {
|
||||||
|
FillRect(payload) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (0))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload).rect).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload).rect).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
StrokeRect(payload0) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (1))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Line(payload1) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (2))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload1).start).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload1).start).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload1).end).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 16, ((payload1).end).y)
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Circle(payload2) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (3))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload2).center).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload2).center).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 }))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Text(payload3) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (4))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y)
|
||||||
|
|
||||||
|
let ptr = mbt_ffi_str2ptr((payload3).text)
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (payload3).text.length())
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ptr)
|
||||||
|
mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal())
|
||||||
|
mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 }))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
PushClip(payload4) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (5))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, (payload4).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, (payload4).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
PopClip => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (6))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mbt_ffi_store32((return_area) + 4, (result).length())
|
||||||
|
mbt_ffi_store32((return_area) + 0, address)
|
||||||
|
let ret = return_area
|
||||||
|
return ret
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
|
||||||
|
for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 {
|
||||||
|
let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32)
|
||||||
|
|
||||||
|
match (mbt_ffi_load8_u((iter_base) + 0)) {
|
||||||
|
0 => ()
|
||||||
|
1 => ()
|
||||||
|
2 => ()
|
||||||
|
3 => ()
|
||||||
|
4 => {
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 12))
|
||||||
|
|
||||||
|
}
|
||||||
|
5 => ()
|
||||||
|
6 => ()
|
||||||
|
_ => panic()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((p0) + 0))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
|
||||||
|
let (result) : (PopupSurface?) = popup();
|
||||||
|
let return_area = mbt_ffi_malloc(20)
|
||||||
|
|
||||||
|
match (result) {
|
||||||
|
None => {
|
||||||
|
mbt_ffi_store8((return_area) + 0, (0))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Some(payload0) => {
|
||||||
|
mbt_ffi_store8((return_area) + 0, (1))
|
||||||
|
mbt_ffi_store32((return_area) + 4, (((payload0).size).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((return_area) + 8, (((payload0).size).h).reinterpret_as_int())
|
||||||
|
|
||||||
|
let address = mbt_ffi_malloc(((payload0).ops).length() * 32);
|
||||||
|
for index = 0; index < ((payload0).ops).length(); index = index + 1 {
|
||||||
|
let iter_elem : @types.DrawOp = ((payload0).ops)[(index)]
|
||||||
|
let iter_base = address + (index * 32);
|
||||||
|
|
||||||
|
match iter_elem {
|
||||||
|
FillRect(payload1) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (0))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload1).rect).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload1).rect).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, (((payload1).rect).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (((payload1).rect).h).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload1).radius).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
StrokeRect(payload2) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (1))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload2).rect).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload2).rect).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, (((payload2).rect).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (((payload2).rect).h).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload2).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload2).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload2).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload2).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload2).width).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 28, ((payload2).radius).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Line(payload3) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (2))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload3).start).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload3).start).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload3).end).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 16, ((payload3).end).y)
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (((payload3).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 21, (((payload3).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 22, (((payload3).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 23, (((payload3).color).a).to_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 24, ((payload3).width).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Circle(payload4) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (3))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload4).center).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload4).center).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload4).radius).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 16, (((payload4).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 17, (((payload4).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 18, (((payload4).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 19, (((payload4).color).a).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 20, (if (payload4).filled { 1 } else { 0 }))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
Text(payload5) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (4))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, ((payload5).origin).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, ((payload5).origin).y)
|
||||||
|
|
||||||
|
let ptr = mbt_ffi_str2ptr((payload5).text)
|
||||||
|
mbt_ffi_store32((iter_base) + 16, (payload5).text.length())
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ptr)
|
||||||
|
mbt_ffi_store32((iter_base) + 20, (((payload5).style).size).reinterpret_as_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 24, ((((payload5).style).color).r).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 25, ((((payload5).style).color).g).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 26, ((((payload5).style).color).b).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 27, ((((payload5).style).color).a).to_int())
|
||||||
|
mbt_ffi_store8((iter_base) + 28, ((payload5).style).align.ordinal())
|
||||||
|
mbt_ffi_store8((iter_base) + 29, (if ((payload5).style).bold { 1 } else { 0 }))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
PushClip(payload6) => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (5))
|
||||||
|
mbt_ffi_store32((iter_base) + 4, (payload6).x)
|
||||||
|
mbt_ffi_store32((iter_base) + 8, (payload6).y)
|
||||||
|
mbt_ffi_store32((iter_base) + 12, ((payload6).w).reinterpret_as_int())
|
||||||
|
mbt_ffi_store32((iter_base) + 16, ((payload6).h).reinterpret_as_int())
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
PopClip => {
|
||||||
|
mbt_ffi_store8((iter_base) + 0, (6))
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mbt_ffi_store32((return_area) + 16, ((payload0).ops).length())
|
||||||
|
mbt_ffi_store32((return_area) + 12, address)
|
||||||
|
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let ret = return_area
|
||||||
|
return ret
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
|
||||||
|
match (mbt_ffi_load8_u((p0) + 0)) {
|
||||||
|
0 => ()
|
||||||
|
1 => {
|
||||||
|
|
||||||
|
for index = 0; index < (mbt_ffi_load32((p0) + 16)); index = index + 1 {
|
||||||
|
let iter_base = (mbt_ffi_load32((p0) + 12)) + (index * 32)
|
||||||
|
|
||||||
|
match (mbt_ffi_load8_u((iter_base) + 0)) {
|
||||||
|
0 => ()
|
||||||
|
1 => ()
|
||||||
|
2 => ()
|
||||||
|
3 => ()
|
||||||
|
4 => {
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((iter_base) + 12))
|
||||||
|
|
||||||
|
}
|
||||||
|
5 => ()
|
||||||
|
6 => ()
|
||||||
|
_ => panic()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
mbt_ffi_free(mbt_ffi_load32((p0) + 12))
|
||||||
|
|
||||||
|
}
|
||||||
|
_ => panic()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
|
||||||
|
let lifted = match (p1) {
|
||||||
|
0 => {
|
||||||
|
|
||||||
|
@types.InputEvent::PointerMove(@types.Point::{x : p2, y : p3})
|
||||||
|
}
|
||||||
|
1 => {
|
||||||
|
|
||||||
|
@types.InputEvent::PointerDown(@types.Point::{x : p2, y : p3})
|
||||||
|
}
|
||||||
|
2 => {
|
||||||
|
|
||||||
|
@types.InputEvent::PointerUp(@types.Point::{x : p2, y : p3})
|
||||||
|
}
|
||||||
|
3 => {
|
||||||
|
|
||||||
|
@types.InputEvent::PointerLeave
|
||||||
|
}
|
||||||
|
4 => {
|
||||||
|
|
||||||
|
@types.InputEvent::FocusLost
|
||||||
|
}
|
||||||
|
5 => {
|
||||||
|
|
||||||
|
let result = mbt_ffi_ptr2str(p2, p3)
|
||||||
|
|
||||||
|
@types.InputEvent::KeyDown(result)
|
||||||
|
}
|
||||||
|
_ => panic()
|
||||||
|
}
|
||||||
|
|
||||||
|
let (result0) : (Bool) = on_event(Surface::from(p0), lifted);
|
||||||
|
let ret = (if result0 { 1 } else { 0 })
|
||||||
|
return ret
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array16
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) (local i32)
|
||||||
|
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
||||||
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import {
|
||||||
|
"moonplasma/desktop/interface/moonplasma/desktop/types" @types,
|
||||||
|
"moonplasma/desktop/interface/moonplasma/desktop/theme" @theme,
|
||||||
|
"moonplasma/desktop/interface/moonplasma/desktop/session" @session,
|
||||||
|
"moonplasma/desktop/lib/ui" @ui,
|
||||||
|
}
|
||||||
|
|
||||||
|
warnings = "-44"
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
///| Implementation of `moonplasma:desktop/plasmoid` for the logout button. A click on the panel
|
||||||
|
/// button opens a small popup, "Log out | Cancel", so a stray click can't end the session; Enter
|
||||||
|
/// confirms and Escape (or a click elsewhere) cancels. Confirming calls `session.logout`, which
|
||||||
|
/// makes the host stop the compositor and hand the screen back to the display manager.
|
||||||
|
|
||||||
|
///| Popup geometry: a column of two rows with a margin around them.
|
||||||
|
let popup_w : Int = 150
|
||||||
|
|
||||||
|
///|
|
||||||
|
let row_h : Int = 30
|
||||||
|
|
||||||
|
///|
|
||||||
|
let margin : Int = 6
|
||||||
|
|
||||||
|
///|
|
||||||
|
let rows : Array[String] = ["Log out", "Cancel"]
|
||||||
|
|
||||||
|
///| Whether the popup is open, and which row the pointer is over (-1: none).
|
||||||
|
let open_ : Ref[Bool] = { val: false }
|
||||||
|
|
||||||
|
///|
|
||||||
|
let hover : Ref[Int] = { val: -1 }
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn popup_h() -> Int {
|
||||||
|
margin * 2 + rows.length() * row_h
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Row under a popup-local y, or -1.
|
||||||
|
fn row_at(x : Int, y : Int) -> Int {
|
||||||
|
if x < margin || x >= popup_w - margin || y < margin {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
let i = (y - margin) / row_h
|
||||||
|
if i < rows.length() { i } else { -1 }
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn close() -> Unit {
|
||||||
|
open_.val = false
|
||||||
|
hover.val = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn info() -> PlasmoidInfo {
|
||||||
|
{
|
||||||
|
id: "org.moonplasma.logout",
|
||||||
|
name: "Log out",
|
||||||
|
preferred: { w: 84, h: 34 },
|
||||||
|
min_width: 70,
|
||||||
|
stretch: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn render(size : @types.Size) -> Array[@types.DrawOp] {
|
||||||
|
let t = @theme.get_tokens()
|
||||||
|
let w = size.w.reinterpret_as_int()
|
||||||
|
let h = size.h.reinterpret_as_int()
|
||||||
|
let r = t.radius.reinterpret_as_int()
|
||||||
|
let fs = t.font_size.reinterpret_as_int()
|
||||||
|
let bg = if open_.val { t.palette.accent } else { t.palette.surface_hover }
|
||||||
|
let fg = if open_.val { t.palette.accent_foreground } else { t.palette.foreground }
|
||||||
|
[
|
||||||
|
@ui.fill_rect(@ui.rect(0, 0, w, h), bg, radius=r),
|
||||||
|
@ui.text(w / 2, h / 2, "Log out", fs - 2, fg, align=CENTER),
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn popup() -> PopupSurface? {
|
||||||
|
if !open_.val {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
let t = @theme.get_tokens()
|
||||||
|
let w = popup_w
|
||||||
|
let h = popup_h()
|
||||||
|
let r = t.radius.reinterpret_as_int()
|
||||||
|
let fs = t.font_size.reinterpret_as_int()
|
||||||
|
let ops : Array[@types.DrawOp] = [
|
||||||
|
@ui.fill_rect(@ui.rect(0, 0, w, h), t.palette.surface_popup, radius=r),
|
||||||
|
@ui.stroke_rect(@ui.rect(0, 0, w, h), t.palette.border, width=1, radius=r),
|
||||||
|
]
|
||||||
|
for i = 0; i < rows.length(); i = i + 1 {
|
||||||
|
let y = margin + i * row_h
|
||||||
|
let hot = i == hover.val
|
||||||
|
if hot {
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(margin, y, w - 2 * margin, row_h - 2), t.palette.accent, radius=r))
|
||||||
|
}
|
||||||
|
let fg = if hot { t.palette.accent_foreground } else { t.palette.foreground }
|
||||||
|
ops.push(@ui.text(margin + 12, y + (row_h - 2) / 2, rows[i], fs - 1, fg, bold=i == 0))
|
||||||
|
}
|
||||||
|
Some({ size: { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() }, ops })
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool {
|
||||||
|
match (target, event) {
|
||||||
|
(WIDGET, PointerDown(_)) => {
|
||||||
|
if open_.val {
|
||||||
|
close()
|
||||||
|
} else {
|
||||||
|
open_.val = true
|
||||||
|
hover.val = -1
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
(POPUP, PointerMove(p)) => {
|
||||||
|
let i = row_at(p.x, p.y)
|
||||||
|
if i != hover.val {
|
||||||
|
hover.val = i
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(POPUP, PointerLeave) =>
|
||||||
|
if hover.val != -1 {
|
||||||
|
hover.val = -1
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
(POPUP, PointerDown(p)) => {
|
||||||
|
let i = row_at(p.x, p.y)
|
||||||
|
close()
|
||||||
|
if i == 0 {
|
||||||
|
@session.logout()
|
||||||
|
}
|
||||||
|
true
|
||||||
|
}
|
||||||
|
(_, FocusLost) =>
|
||||||
|
if open_.val {
|
||||||
|
close()
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
(_, KeyDown(k)) =>
|
||||||
|
if !open_.val {
|
||||||
|
false
|
||||||
|
} else if k == "Escape" {
|
||||||
|
close()
|
||||||
|
true
|
||||||
|
} else if k == "Enter" {
|
||||||
|
close()
|
||||||
|
@session.logout()
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
_ => false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
///|
|
||||||
|
pub(all) struct PlasmoidInfo {
|
||||||
|
id : String; name : String; preferred : @types.Size; min_width : UInt; stretch : Bool
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
pub(all) struct PopupSurface {
|
||||||
|
size : @types.Size; ops : Array[@types.DrawOp]
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
pub(all) enum Surface {
|
||||||
|
WIDGET; POPUP
|
||||||
|
} derive()
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn Surface::ordinal(self : Surface) -> Int {
|
||||||
|
match self {
|
||||||
|
WIDGET => 0
|
||||||
|
POPUP => 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
pub fn Surface::from(self : Int) -> Surface {
|
||||||
|
match self {
|
||||||
|
0 => WIDGET
|
||||||
|
1 => POPUP
|
||||||
|
_ => panic()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
declare pub fn info() -> PlasmoidInfo
|
||||||
|
///|
|
||||||
|
/// Draw the widget into a `size` box (local coordinates).
|
||||||
|
declare pub fn render(size : @types.Size) -> Array[@types.DrawOp]
|
||||||
|
///|
|
||||||
|
/// Present when the widget wants a popup surface (e.g. a launcher menu).
|
||||||
|
declare pub fn popup() -> PopupSurface?
|
||||||
|
///|
|
||||||
|
/// Returns true when the widget's visuals changed and a redraw is needed.
|
||||||
|
declare pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import {
|
||||||
|
"moonplasma/desktop/components/logout/gen/interface/moonplasma/desktop/plasmoid" @plasmoid,
|
||||||
|
}
|
||||||
|
|
||||||
|
warnings = "-44"
|
||||||
|
|
||||||
|
pkgtype(kind: "foreign_library")
|
||||||
|
|
||||||
|
options(
|
||||||
|
link: {
|
||||||
|
"wasm": {
|
||||||
|
"export-memory-name": "memory",
|
||||||
|
"heap-start-address": 16,
|
||||||
|
"exports": [
|
||||||
|
"mbt_ffi_cabi_realloc:cabi_realloc",
|
||||||
|
"wasmExportInfo:moonplasma:desktop/plasmoid@0.1.0#info",
|
||||||
|
"wasmExportInfoPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#info",
|
||||||
|
"wasmExportOnEvent:moonplasma:desktop/plasmoid@0.1.0#on-event",
|
||||||
|
"wasmExportPopup:moonplasma:desktop/plasmoid@0.1.0#popup",
|
||||||
|
"wasmExportPopupPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#popup",
|
||||||
|
"wasmExportRender:moonplasma:desktop/plasmoid@0.1.0#render",
|
||||||
|
"wasmExportRenderPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#render"
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -169,7 +169,7 @@ pub fn run(args : Array[String]) -> Int {
|
|||||||
frames = frames + 1
|
frames = frames + 1
|
||||||
match kms {
|
match kms {
|
||||||
Some(k) => {
|
Some(k) => {
|
||||||
if !k.poll() {
|
if !k.poll() || comp.quit_requested {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
let now_ms = @sys.monotonic_ms().to_uint()
|
let now_ms = @sys.monotonic_ms().to_uint()
|
||||||
@@ -187,6 +187,9 @@ pub fn run(args : Array[String]) -> Int {
|
|||||||
None => ()
|
None => ()
|
||||||
}
|
}
|
||||||
comp.step()
|
comp.step()
|
||||||
|
if comp.quit_requested {
|
||||||
|
break
|
||||||
|
}
|
||||||
match nested {
|
match nested {
|
||||||
Some(n) => {
|
Some(n) => {
|
||||||
if !n.poll() {
|
if !n.poll() {
|
||||||
|
|||||||
@@ -118,6 +118,9 @@ fn main {
|
|||||||
println("moon-plasma compositor listening on " + socket_path + " (wasi-gfx surface active)")
|
println("moon-plasma compositor listening on " + socket_path + " (wasi-gfx surface active)")
|
||||||
while true {
|
while true {
|
||||||
comp.step()
|
comp.step()
|
||||||
|
if comp.quit_requested {
|
||||||
|
break
|
||||||
|
}
|
||||||
match kms {
|
match kms {
|
||||||
Some(k) => {
|
Some(k) => {
|
||||||
if !k.poll() {
|
if !k.poll() {
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ pub(all) struct MoonPlasmaCompositor {
|
|||||||
/// A Super key is down and nothing else was pressed since: releasing it opens the launcher.
|
/// A Super key is down and nothing else was pressed since: releasing it opens the launcher.
|
||||||
mut super_solo : Bool
|
mut super_solo : Bool
|
||||||
mut layout_mode : @wm.LayoutMode
|
mut layout_mode : @wm.LayoutMode
|
||||||
|
/// Set when the user asked to end the session (the logout button); the main loop then exits.
|
||||||
|
mut quit_requested : Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -99,6 +101,7 @@ pub fn MoonPlasmaCompositor::new(
|
|||||||
mods: 0U,
|
mods: 0U,
|
||||||
super_solo: false,
|
super_solo: false,
|
||||||
layout_mode: @wm.LayoutMode::Tiling,
|
layout_mode: @wm.LayoutMode::Tiling,
|
||||||
|
quit_requested: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -762,6 +765,7 @@ fn MoonPlasmaCompositor::run_shell_actions(self : MoonPlasmaCompositor) -> Unit
|
|||||||
for a in self.shell.take_actions() {
|
for a in self.shell.take_actions() {
|
||||||
match a {
|
match a {
|
||||||
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
|
@shell.ShellAction::FocusWindow(wid) => self.activate_task(wid)
|
||||||
|
@shell.ShellAction::Logout => self.quit_requested = true
|
||||||
@shell.ShellAction::SetLayout(m) =>
|
@shell.ShellAction::SetLayout(m) =>
|
||||||
match m {
|
match m {
|
||||||
0 => self.set_layout_mode(@wm.LayoutMode::Tiling)
|
0 => self.set_layout_mode(@wm.LayoutMode::Tiling)
|
||||||
|
|||||||
@@ -817,3 +817,28 @@ test "dragging a floating window's corner resizes it" {
|
|||||||
assert_eq(g1.w, g0.w - 50)
|
assert_eq(g1.w, g0.w - 50)
|
||||||
assert_eq(g1.h, g0.h - 40)
|
assert_eq(g1.h, g0.h - 40)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
test "the logout button asks first, then ends the session" {
|
||||||
|
let comp = new_comp("logout")
|
||||||
|
let slot = comp.shell.slot_of("logout")
|
||||||
|
assert_true(comp.shell.slot_rect(slot).w > 0) // it is in the default panel
|
||||||
|
assert_false(comp.quit_requested)
|
||||||
|
// A click opens the popup; nothing is requested yet.
|
||||||
|
click_module(comp, "logout", 1U)
|
||||||
|
let pr = comp.shell.slot_popup_rect(slot)
|
||||||
|
assert_true(pr.w > 0)
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
assert_false(comp.quit_requested)
|
||||||
|
// Cancel (second row) closes it without logging out.
|
||||||
|
click_at(comp, pr.x + 20, pr.y + 6 + 30 + 5, 5U)
|
||||||
|
assert_eq(comp.shell.slot_popup_rect(slot).w, 0)
|
||||||
|
assert_false(comp.quit_requested)
|
||||||
|
// Open again and choose Log out (first row).
|
||||||
|
click_module(comp, "logout", 10U)
|
||||||
|
let pr2 = comp.shell.slot_popup_rect(slot)
|
||||||
|
assert_true(pr2.w > 0)
|
||||||
|
click_at(comp, pr2.x + 20, pr2.y + 6 + 5, 15U)
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
assert_true(comp.quit_requested)
|
||||||
|
}
|
||||||
@@ -137,6 +137,8 @@ pub(all) struct WinInfo {
|
|||||||
pub(all) enum ShellAction {
|
pub(all) enum ShellAction {
|
||||||
SetLayout(Int)
|
SetLayout(Int)
|
||||||
FocusWindow(UInt64)
|
FocusWindow(UInt64)
|
||||||
|
/// A module (the logout button) asked to end the session.
|
||||||
|
Logout
|
||||||
} derive(Eq, Debug)
|
} derive(Eq, Debug)
|
||||||
|
|
||||||
///| One wasm module loaded into the panel.
|
///| One wasm module loaded into the panel.
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
///| Modules loaded into a fresh panel, in order. `tasks` stretches, so what follows it packs right.
|
///| Modules loaded into a fresh panel, in order. `tasks` stretches, so what follows it packs right.
|
||||||
let default_panel : Array[String] = [
|
let default_panel : Array[String] = [
|
||||||
"launcher", "inspector", "layout", "tasks", "moon-disc", "clock-digital12",
|
"launcher", "inspector", "layout", "tasks", "moon-disc", "clock-digital12", "logout",
|
||||||
]
|
]
|
||||||
|
|
||||||
///| The module whose popup is the wasm picker.
|
///| The module whose popup is the wasm picker.
|
||||||
@@ -435,6 +435,7 @@ fn DesktopShell::process_requests(self : DesktopShell) -> Unit {
|
|||||||
}
|
}
|
||||||
Some(FocusWindow(n)) => self.actions.push(FocusWindow(n.to_int64().to_uint64()))
|
Some(FocusWindow(n)) => self.actions.push(FocusWindow(n.to_int64().to_uint64()))
|
||||||
Some(SetLayout(m)) => self.actions.push(SetLayout(m))
|
Some(SetLayout(m)) => self.actions.push(SetLayout(m))
|
||||||
|
Some(Logout) => self.actions.push(Logout)
|
||||||
Some(SetInspector(on)) => self.set_inspecting(on)
|
Some(SetInspector(on)) => self.set_inspecting(on)
|
||||||
Some(LoadModule(path)) => {
|
Some(LoadModule(path)) => {
|
||||||
match self.load_path(path) {
|
match self.load_path(path) {
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ pub(all) enum HostRequest {
|
|||||||
LoadModule(String)
|
LoadModule(String)
|
||||||
UnloadInstance(String)
|
UnloadInstance(String)
|
||||||
Browse
|
Browse
|
||||||
|
Logout
|
||||||
} derive(Eq, Debug)
|
} derive(Eq, Debug)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -281,6 +282,7 @@ pub fn next_request() -> HostRequest? {
|
|||||||
Some(LoadModule(p)) => Some(LoadModule(p))
|
Some(LoadModule(p)) => Some(LoadModule(p))
|
||||||
Some(UnloadInstance(s)) => Some(UnloadInstance(s))
|
Some(UnloadInstance(s)) => Some(UnloadInstance(s))
|
||||||
Some(Browse) => Some(Browse)
|
Some(Browse) => Some(Browse)
|
||||||
|
Some(Logout) => Some(Logout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -643,6 +643,7 @@ pub(all) enum HostRequest {
|
|||||||
LoadModule(String)
|
LoadModule(String)
|
||||||
UnloadInstance(String)
|
UnloadInstance(String)
|
||||||
Browse
|
Browse
|
||||||
|
Logout
|
||||||
} derive(Eq, Debug)
|
} derive(Eq, Debug)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -662,6 +663,7 @@ pub fn next_request() -> HostRequest? {
|
|||||||
5 => Some(LoadModule(req_str()))
|
5 => Some(LoadModule(req_str()))
|
||||||
6 => Some(UnloadInstance(req_str()))
|
6 => Some(UnloadInstance(req_str()))
|
||||||
7 => Some(Browse)
|
7 => Some(Browse)
|
||||||
|
8 => Some(Logout)
|
||||||
_ => None
|
_ => None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ static Inst insts[MAX_INST];
|
|||||||
enum {
|
enum {
|
||||||
K_OTHER, K_TOKENS, K_CLOCK, K_APPS, K_LAUNCH, K_WINDOWS, K_FOCUS, K_LAYOUTS, K_LAYOUT_CUR, K_SET_LAYOUT,
|
K_OTHER, K_TOKENS, K_CLOCK, K_APPS, K_LAUNCH, K_WINDOWS, K_FOCUS, K_LAYOUTS, K_LAYOUT_CUR, K_SET_LAYOUT,
|
||||||
K_INSPECT_IS_ON, K_INSPECT_SET, K_MOD_AVAILABLE, K_MOD_LOADED, K_MOD_LOAD, K_MOD_UNLOAD, K_MOD_BROWSE,
|
K_INSPECT_IS_ON, K_INSPECT_SET, K_MOD_AVAILABLE, K_MOD_LOADED, K_MOD_LOAD, K_MOD_UNLOAD, K_MOD_BROWSE,
|
||||||
K_SYSTEM_READ, K_WIN_ALL, K_WIN_FOCUS_ID
|
K_SYSTEM_READ, K_WIN_ALL, K_WIN_FOCUS_ID, K_LOGOUT
|
||||||
};
|
};
|
||||||
typedef struct Env { Inst *inst; int kind; } Env;
|
typedef struct Env { Inst *inst; int kind; } Env;
|
||||||
|
|
||||||
@@ -274,6 +274,7 @@ static wasm_trap_t *host_import(void *env, const wasm_val_vec_t *args, wasm_val_
|
|||||||
break;
|
break;
|
||||||
case K_SET_LAYOUT: push_req(3, a0, NULL); break;
|
case K_SET_LAYOUT: push_req(3, a0, NULL); break;
|
||||||
case K_FOCUS: push_req(2, a0, NULL); break;
|
case K_FOCUS: push_req(2, a0, NULL); break;
|
||||||
|
case K_LOGOUT: push_req(8, 0, NULL); break;
|
||||||
case K_INSPECT_SET: push_req(4, a0, NULL); break;
|
case K_INSPECT_SET: push_req(4, a0, NULL); break;
|
||||||
case K_MOD_BROWSE: push_req(7, 0, NULL); break;
|
case K_MOD_BROWSE: push_req(7, 0, NULL); break;
|
||||||
case K_MOD_LOAD: { char *s = guest_str(in, a0, a1); push_req(5, 0, s); free(s); break; }
|
case K_MOD_LOAD: { char *s = guest_str(in, a0, a1); push_req(5, 0, s); free(s); break; }
|
||||||
@@ -401,6 +402,7 @@ static int classify_import(const wasm_name_t *m, const wasm_name_t *f) {
|
|||||||
if (!strcmp(iface, "windows") && !strcmp(fn, "all")) return K_WIN_ALL;
|
if (!strcmp(iface, "windows") && !strcmp(fn, "all")) return K_WIN_ALL;
|
||||||
if (!strcmp(iface, "windows") && !strcmp(fn, "focus")) return K_WIN_FOCUS_ID;
|
if (!strcmp(iface, "windows") && !strcmp(fn, "focus")) return K_WIN_FOCUS_ID;
|
||||||
if (!strcmp(iface, "system") && !strcmp(fn, "read")) return K_SYSTEM_READ;
|
if (!strcmp(iface, "system") && !strcmp(fn, "read")) return K_SYSTEM_READ;
|
||||||
|
if (!strcmp(iface, "session") && !strcmp(fn, "logout")) return K_LOGOUT;
|
||||||
if (!strcmp(iface, "layout-control") && !strcmp(fn, "layout-modes")) return K_LAYOUTS;
|
if (!strcmp(iface, "layout-control") && !strcmp(fn, "layout-modes")) return K_LAYOUTS;
|
||||||
if (!strcmp(iface, "layout-control") && !strcmp(fn, "current-layout")) return K_LAYOUT_CUR;
|
if (!strcmp(iface, "layout-control") && !strcmp(fn, "current-layout")) return K_LAYOUT_CUR;
|
||||||
if (!strcmp(iface, "layout-control") && !strcmp(fn, "set-layout")) return K_SET_LAYOUT;
|
if (!strcmp(iface, "layout-control") && !strcmp(fn, "set-layout")) return K_SET_LAYOUT;
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ impl moonplasma::host::plasmoids::Host for State {
|
|||||||
Req::LoadModule(s) => R::LoadModule(s),
|
Req::LoadModule(s) => R::LoadModule(s),
|
||||||
Req::UnloadInstance(s) => R::UnloadInstance(s),
|
Req::UnloadInstance(s) => R::UnloadInstance(s),
|
||||||
Req::Browse => R::Browse,
|
Req::Browse => R::Browse,
|
||||||
|
Req::Logout => R::Logout,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ pub enum Req {
|
|||||||
LoadModule(String),
|
LoadModule(String),
|
||||||
UnloadInstance(String),
|
UnloadInstance(String),
|
||||||
Browse,
|
Browse,
|
||||||
|
Logout,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const T_APPS: usize = 0;
|
pub const T_APPS: usize = 0;
|
||||||
@@ -265,6 +266,12 @@ impl d::modules::Host for PState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl d::session::Host for PState {
|
||||||
|
fn logout(&mut self) {
|
||||||
|
self.shared.borrow_mut().requests.push_back(Req::Logout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl d::system::Host for PState {
|
impl d::system::Host for PState {
|
||||||
fn read(&mut self) -> d::system::Snapshot {
|
fn read(&mut self) -> d::system::Snapshot {
|
||||||
self.shared.borrow().system.clone().unwrap_or(d::system::Snapshot {
|
self.shared.borrow().system.clone().unwrap_or(d::system::Snapshot {
|
||||||
@@ -521,4 +528,37 @@ mod tests {
|
|||||||
assert!(!texts(&ops).is_empty());
|
assert!(!texts(&ops).is_empty());
|
||||||
rt.unload(l.handle);
|
rt.unload(l.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn logout_asks_for_confirmation_then_requests_it() {
|
||||||
|
let mut rt = runtime();
|
||||||
|
let l = rt.load(&module("logout")).expect("logout loads");
|
||||||
|
assert!(l.imports.contains(&"session".to_string()));
|
||||||
|
let h = l.handle;
|
||||||
|
assert!(!rt.render(h, Size { w: 84, h: 34 }).is_empty());
|
||||||
|
// Closed: no popup. A click opens it; nothing is requested yet.
|
||||||
|
assert!(rt.popup(h).is_none());
|
||||||
|
assert!(rt.on_event(h, false, InputEvent::PointerDown(Point { x: 5, y: 5 })));
|
||||||
|
let p = rt.popup(h).expect("popup open");
|
||||||
|
assert!(texts(&p.ops).contains(&"Log out".to_string()) && texts(&p.ops).contains(&"Cancel".to_string()));
|
||||||
|
assert!(rt.shared.borrow().requests.is_empty());
|
||||||
|
// Cancel row (second): closes without logging out.
|
||||||
|
assert!(rt.on_event(h, true, InputEvent::PointerDown(Point { x: 20, y: 6 + 30 + 5 })));
|
||||||
|
assert!(rt.popup(h).is_none());
|
||||||
|
assert!(rt.shared.borrow().requests.is_empty());
|
||||||
|
// Escape also cancels.
|
||||||
|
rt.on_event(h, false, InputEvent::PointerDown(Point { x: 5, y: 5 }));
|
||||||
|
assert!(rt.on_event(h, true, InputEvent::KeyDown("Escape".to_string())));
|
||||||
|
assert!(rt.shared.borrow().requests.is_empty());
|
||||||
|
// Open again and click the first row: that is the logout request.
|
||||||
|
rt.on_event(h, false, InputEvent::PointerDown(Point { x: 5, y: 5 }));
|
||||||
|
assert!(rt.on_event(h, true, InputEvent::PointerDown(Point { x: 20, y: 6 + 5 })));
|
||||||
|
assert!(matches!(rt.shared.borrow_mut().requests.pop_front(), Some(Req::Logout)));
|
||||||
|
assert!(rt.popup(h).is_none());
|
||||||
|
// Enter confirms too.
|
||||||
|
rt.on_event(h, false, InputEvent::PointerDown(Point { x: 5, y: 5 }));
|
||||||
|
rt.on_event(h, true, InputEvent::KeyDown("Enter".to_string()));
|
||||||
|
assert!(matches!(rt.shared.borrow_mut().requests.pop_front(), Some(Req::Logout)));
|
||||||
|
rt.unload(h);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
Ending the login session. A module with this capability is a logout button: the host stops the
|
||||||
|
compositor, and the display manager takes the screen back.
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn wasmImportLogout() = "moonplasma:desktop/session@0.1.0" "logout"
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
warnings = "-44"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
///|
|
||||||
|
pub fn logout() -> Unit {
|
||||||
|
|
||||||
|
wasmImportLogout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -21,25 +21,10 @@ fn wasmImportTakeInput(p0 : Int) = "moonplasma:host/display@0.1.0" "take-input"
|
|||||||
///|
|
///|
|
||||||
fn wasmImportClose() = "moonplasma:host/display@0.1.0" "close"
|
fn wasmImportClose() = "moonplasma:host/display@0.1.0" "close"
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
|
|
||||||
#|(func (param i32) (param i32) (result i32)
|
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array8
|
|
||||||
#| local.get 0)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double =
|
extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double =
|
||||||
#|(func (param i32) (result f64) local.get 0 f64.load)
|
#|(func (param i32) (result f64) local.get 0 f64.load)
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -48,11 +33,26 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(bytes)
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
|
||||||
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array8
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(bytes)
|
||||||
|
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
@@ -35,33 +35,18 @@ fn wasmImportClose() -> Unit {
|
|||||||
abort("wasm-only host import")
|
abort("wasm-only host import")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_loadf64(offset : Int) -> Double {
|
fn mbt_ffi_loadf64(offset : Int) -> Double {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_free(position : Int) -> Unit {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_malloc(size : Int) -> Int {
|
fn mbt_ffi_malloc(size : Int) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,3 +54,18 @@ fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
|||||||
fn mbt_ffi_load32(offset : Int) -> Int {
|
fn mbt_ffi_load32(offset : Int) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_free(position : Int) -> Unit {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
@@ -7,19 +7,9 @@ fn wasmImportLoad(p0 : Int, p1 : Int, p2 : Int) -> Int = "moonplasma:host/font@0
|
|||||||
fn wasmImportRasterise(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = "moonplasma:host/font@0.1.0" "rasterise"
|
fn wasmImportRasterise(p0 : Int, p1 : Int, p2 : Int, p3 : Int) = "moonplasma:host/font@0.1.0" "rasterise"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
|
#owned(str)
|
||||||
#|(func (param i32) (param i32) (result i32)
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
#| local.get 0
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
#| local.get 1 call $moonbit.init_array8
|
|
||||||
#| local.get 0)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -29,7 +19,17 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
#|(func (param i32) (param i32) (result i32)
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array8
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -11,17 +11,7 @@ fn wasmImportRasterise(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] {
|
fn mbt_ffi_str2ptr(str : String) -> Int {
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_load32(offset : Int) -> Int {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_free(position : Int) -> Unit {
|
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,6 +21,16 @@ fn mbt_ffi_malloc(size : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_str2ptr(str : String) -> Int {
|
fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_free(position : Int) -> Unit {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_load32(offset : Int) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
@@ -45,33 +45,6 @@ fn wasmImportPickerStart() -> Int = "moonplasma:host/plasmoids@0.1.0" "picker-st
|
|||||||
///|
|
///|
|
||||||
fn wasmImportPickerPoll(p0 : Int) = "moonplasma:host/plasmoids@0.1.0" "picker-poll"
|
fn wasmImportPickerPoll(p0 : Int) = "moonplasma:host/plasmoids@0.1.0" "picker-poll"
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
|
||||||
#|(func (param i32) (result i64) local.get 0 i64.load)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) (local i32)
|
|
||||||
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
|
||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
|
||||||
#| local.get 1)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
@@ -80,9 +53,16 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(bytes)
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
||||||
|
#|(func (param i32) (result i64) local.get 0 i64.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
#owned(str)
|
||||||
@@ -93,7 +73,27 @@ extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) =
|
extern "wasm" fn mbt_ffi_store64(offset : Int, value : Int64) =
|
||||||
#|(func (param i32) (param i64) local.get 0 local.get 1 i64.store)
|
#|(func (param i32) (param i64) local.get 0 local.get 1 i64.store)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) (local i32)
|
||||||
|
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
||||||
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(bytes)
|
||||||
|
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
@@ -76,12 +76,7 @@ fn wasmImportPickerPoll(p0 : Int) -> Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_load64(offset : Int) -> Int64 {
|
fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String {
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,27 +86,12 @@ fn mbt_ffi_store8(offset : Int, value : Int) -> Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_free(position : Int) -> Unit {
|
fn mbt_ffi_load64(offset : Int) -> Int64 {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_store32(offset : Int, value : Int) -> Unit {
|
fn mbt_ffi_load8_u(offset : Int) -> Int {
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_malloc(size : Int) -> Int {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +105,27 @@ fn mbt_ffi_load32(offset : Int) -> Int {
|
|||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_free(position : Int) -> Unit {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_store64(offset : Int, value : Int64) -> Unit {
|
fn mbt_ffi_store64(offset : Int, value : Int64) -> Unit {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_malloc(size : Int) -> Int {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_store32(offset : Int, value : Int) -> Unit {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
@@ -27,6 +27,7 @@ pub(all) enum Request {
|
|||||||
LoadModule(String)
|
LoadModule(String)
|
||||||
UnloadInstance(String)
|
UnloadInstance(String)
|
||||||
Browse
|
Browse
|
||||||
|
Logout
|
||||||
}
|
}
|
||||||
///|
|
///|
|
||||||
/// A native file-chooser dialog (zenity on the host session) for "Add widget".
|
/// A native file-chooser dialog (zenity on the host session) for "Add widget".
|
||||||
@@ -395,6 +396,10 @@ pub fn next_request() -> Request? {
|
|||||||
|
|
||||||
Request::Browse
|
Request::Browse
|
||||||
}
|
}
|
||||||
|
7 => {
|
||||||
|
|
||||||
|
Request::Logout
|
||||||
|
}
|
||||||
_ => panic()
|
_ => panic()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,13 @@ fn wasmImportHasExe(p0 : Int, p1 : Int) -> Int = "moonplasma:host/sys@0.1.0" "ha
|
|||||||
///|
|
///|
|
||||||
fn wasmImportSpawn(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int = "moonplasma:host/sys@0.1.0" "spawn"
|
fn wasmImportSpawn(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int = "moonplasma:host/sys@0.1.0" "spawn"
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) (local i32)
|
||||||
|
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
||||||
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
@@ -94,20 +101,13 @@ extern "wasm" fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] =
|
|||||||
#| local.get 1 call $moonbit.init_array8
|
#| local.get 1 call $moonbit.init_array8
|
||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(bytes)
|
|
||||||
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
#owned(str)
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
#owned(bytes)
|
||||||
#|(func (param i32) (result i32) (local i32)
|
extern "wasm" fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int =
|
||||||
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
|
||||||
#| local.get 1)
|
|
||||||
|
|
||||||
@@ -120,6 +120,11 @@ fn wasmImportSpawn(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
abort("wasm-only host import")
|
abort("wasm-only host import")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn mbt_ffi_malloc(size : Int) -> Int {
|
||||||
|
abort("wasm-only")
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String {
|
fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
@@ -140,17 +145,12 @@ fn mbt_ffi_ptr2bytes(ptr : Int, len : Int) -> FixedArray[Byte] {
|
|||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
|
||||||
abort("wasm-only")
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_str2ptr(str : String) -> Int {
|
fn mbt_ffi_str2ptr(str : String) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn mbt_ffi_malloc(size : Int) -> Int {
|
fn mbt_ffi_bytes2ptr(bytes : FixedArray[Byte]) -> Int {
|
||||||
abort("wasm-only")
|
abort("wasm-only")
|
||||||
}
|
}
|
||||||
@@ -84,6 +84,10 @@ run-drm-native: build-release modules
|
|||||||
install-session: compositor-wasm host-wasm modules
|
install-session: compositor-wasm host-wasm modules
|
||||||
run0 python3 session/install.py
|
run0 python3 session/install.py
|
||||||
|
|
||||||
|
# Dev install: symlink the session into this checkout, so after one root install `just compositor-wasm host-wasm modules` is all a rebuild needs.
|
||||||
|
install-session-dev: compositor-wasm host-wasm modules
|
||||||
|
run0 python3 session/install.py --link
|
||||||
|
|
||||||
# Install the login session with the native compositor instead.
|
# Install the login session with the native compositor instead.
|
||||||
install-session-native: build-release modules
|
install-session-native: build-release modules
|
||||||
run0 python3 session/install.py --native
|
run0 python3 session/install.py --native
|
||||||
|
|||||||
@@ -12,3 +12,4 @@ tasks taskbar-widget
|
|||||||
layout layout-widget
|
layout layout-widget
|
||||||
inspector inspector-widget
|
inspector inspector-widget
|
||||||
module-manager module-manager-widget
|
module-manager module-manager-widget
|
||||||
|
logout logout-widget
|
||||||
+37
-11
@@ -2,9 +2,14 @@
|
|||||||
"""Install (or remove) the Moon Plasma login session. Run as root, once:
|
"""Install (or remove) the Moon Plasma login session. Run as root, once:
|
||||||
|
|
||||||
run0 python3 session/install.py # install: the compositor as a wasm component
|
run0 python3 session/install.py # install: the compositor as a wasm component
|
||||||
|
run0 python3 session/install.py --link # dev: symlink into this checkout (see below)
|
||||||
run0 python3 session/install.py --native # install the native compositor instead
|
run0 python3 session/install.py --native # install the native compositor instead
|
||||||
run0 python3 session/install.py --remove # uninstall
|
run0 python3 session/install.py --remove # uninstall
|
||||||
|
|
||||||
|
With --link nothing is copied: the installed files are symlinks to the build outputs in this
|
||||||
|
checkout, so after one root install, `just compositor-wasm host-wasm modules` is all it takes for the
|
||||||
|
next login to run your latest build (no root, no reinstall). The checkout must stay where it is.
|
||||||
|
|
||||||
Installs:
|
Installs:
|
||||||
/usr/local/bin/moon-plasma-host wasmtime host that runs the compositor component
|
/usr/local/bin/moon-plasma-host wasmtime host that runs the compositor component
|
||||||
/usr/local/share/moon-plasma/compositor.wasm the compositor, as a WebAssembly component
|
/usr/local/share/moon-plasma/compositor.wasm the compositor, as a WebAssembly component
|
||||||
@@ -18,6 +23,7 @@ import os, shutil, sys
|
|||||||
|
|
||||||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
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
|
||||||
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")
|
||||||
host = os.path.join(root, "host-wasm/target/release/moon-plasma-host")
|
host = os.path.join(root, "host-wasm/target/release/moon-plasma-host")
|
||||||
component = os.path.join(root, "build/compositor.wasm")
|
component = os.path.join(root, "build/compositor.wasm")
|
||||||
@@ -31,11 +37,11 @@ targets = [
|
|||||||
|
|
||||||
if "--remove" in sys.argv:
|
if "--remove" in sys.argv:
|
||||||
for t in targets:
|
for t in targets:
|
||||||
if os.path.exists(t):
|
if os.path.lexists(t):
|
||||||
os.remove(t)
|
os.remove(t)
|
||||||
print("removed", t)
|
print("removed", t)
|
||||||
if os.path.isdir(share):
|
if os.path.isdir(share) and not os.path.islink(share):
|
||||||
shutil.rmtree(share)
|
shutil.rmtree(share) # removes symlinks, never what they point at
|
||||||
print("removed", share)
|
print("removed", share)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
@@ -56,34 +62,54 @@ def put(src, dst, mode):
|
|||||||
os.replace(dst + ".new", dst) # atomic: safe to reinstall over a running binary
|
os.replace(dst + ".new", dst) # atomic: safe to reinstall over a running binary
|
||||||
print("installed", dst)
|
print("installed", dst)
|
||||||
|
|
||||||
|
def link(src, dst):
|
||||||
|
"""dst -> src (replacing whatever is there), for --link installs."""
|
||||||
|
os.makedirs(os.path.dirname(dst), exist_ok=True)
|
||||||
|
if os.path.lexists(dst):
|
||||||
|
if os.path.isdir(dst) and not os.path.islink(dst):
|
||||||
|
shutil.rmtree(dst)
|
||||||
|
else:
|
||||||
|
os.remove(dst)
|
||||||
|
os.symlink(src, dst)
|
||||||
|
print("linked", dst, "->", src)
|
||||||
|
|
||||||
def drop(path):
|
def drop(path):
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
print("removed", path)
|
print("removed", path)
|
||||||
|
|
||||||
|
install = link if linked else (lambda src, dst: put(src, dst, 0o755 if "/bin/" in dst else 0o644))
|
||||||
if native:
|
if native:
|
||||||
put(exe, "/usr/local/bin/moon-plasma", 0o755)
|
install(exe, "/usr/local/bin/moon-plasma")
|
||||||
drop("/usr/local/bin/moon-plasma-host") # the launcher falls back to the native binary
|
drop("/usr/local/bin/moon-plasma-host") # the launcher falls back to the native binary
|
||||||
else:
|
else:
|
||||||
put(host, "/usr/local/bin/moon-plasma-host", 0o755)
|
install(host, "/usr/local/bin/moon-plasma-host")
|
||||||
drop("/usr/local/bin/moon-plasma")
|
drop("/usr/local/bin/moon-plasma")
|
||||||
os.makedirs(share, exist_ok=True)
|
os.makedirs(share, exist_ok=True)
|
||||||
if not native:
|
if not native:
|
||||||
put(component, os.path.join(share, "compositor.wasm"), 0o644)
|
install(component, os.path.join(share, "compositor.wasm"))
|
||||||
put(os.path.join(root, "session/moon-plasma-session"), "/usr/local/bin/moon-plasma-session", 0o755)
|
install(os.path.join(root, "session/moon-plasma-session"), "/usr/local/bin/moon-plasma-session")
|
||||||
|
# The display-manager entry stays a real file: some managers don't follow symlinks there.
|
||||||
put(os.path.join(root, "session/moon-plasma.desktop"), "/usr/share/wayland-sessions/moon-plasma.desktop", 0o644)
|
put(os.path.join(root, "session/moon-plasma.desktop"), "/usr/share/wayland-sessions/moon-plasma.desktop", 0o644)
|
||||||
# Read at runtime relative to the working directory (the launcher cd's here): the Interface Explorer
|
# Read at runtime relative to the working directory (the launcher cd's here): the Interface Explorer
|
||||||
# shows wit/, the theme comes from config/, and assets/fonts holds the Allo font.
|
# shows wit/, the theme comes from config/, and assets/fonts holds the Allo font.
|
||||||
for d in ("config", "wit", "assets"):
|
for d in ("config", "wit", "assets"):
|
||||||
dst = os.path.join(share, d)
|
dst = os.path.join(share, d)
|
||||||
if os.path.isdir(dst):
|
if linked:
|
||||||
shutil.rmtree(dst)
|
link(os.path.join(root, d), dst)
|
||||||
|
continue
|
||||||
|
if os.path.lexists(dst):
|
||||||
|
shutil.rmtree(dst) if os.path.isdir(dst) and not os.path.islink(dst) else os.remove(dst)
|
||||||
shutil.copytree(os.path.join(root, d), dst)
|
shutil.copytree(os.path.join(root, d), dst)
|
||||||
print("installed", dst)
|
print("installed", dst)
|
||||||
mods = os.path.join(root, "build/components")
|
mods = os.path.join(root, "build/components")
|
||||||
dst = os.path.join(share, "modules")
|
dst = os.path.join(share, "modules")
|
||||||
if os.path.isdir(dst):
|
if linked:
|
||||||
shutil.rmtree(dst)
|
link(mods, dst)
|
||||||
|
print("done: pick 'Moon Plasma' in the session menu; rebuild with `just compositor-wasm host-wasm modules`")
|
||||||
|
sys.exit(0)
|
||||||
|
if os.path.lexists(dst):
|
||||||
|
shutil.rmtree(dst) if os.path.isdir(dst) and not os.path.islink(dst) else os.remove(dst)
|
||||||
os.makedirs(dst, exist_ok=True)
|
os.makedirs(dst, exist_ok=True)
|
||||||
n = 0
|
n = 0
|
||||||
for f in sorted(os.listdir(mods)) if os.path.isdir(mods) else []:
|
for f in sorted(os.listdir(mods)) if os.path.isdir(mods) else []:
|
||||||
|
|||||||
@@ -110,3 +110,10 @@ interface modules {
|
|||||||
/// Ask the host to show its native file chooser for a .wasm elsewhere on disk.
|
/// Ask the host to show its native file chooser for a .wasm elsewhere on disk.
|
||||||
browse: func();
|
browse: func();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Ending the login session. A module with this capability is a logout button: the host stops the
|
||||||
|
/// compositor, and the display manager takes the screen back.
|
||||||
|
interface session {
|
||||||
|
logout: func();
|
||||||
|
}
|
||||||
|
|
||||||
@@ -76,6 +76,7 @@ interface plasmoids {
|
|||||||
load-module(string),
|
load-module(string),
|
||||||
unload-instance(string),
|
unload-instance(string),
|
||||||
browse,
|
browse,
|
||||||
|
logout,
|
||||||
}
|
}
|
||||||
/// The next pending request, oldest first.
|
/// The next pending request, oldest first.
|
||||||
next-request: func() -> option<request>;
|
next-request: func() -> option<request>;
|
||||||
|
|||||||
@@ -73,5 +73,13 @@ world plasmoid-host {
|
|||||||
import inspector;
|
import inspector;
|
||||||
import modules;
|
import modules;
|
||||||
import system;
|
import system;
|
||||||
|
import session;
|
||||||
export plasmoid;
|
export plasmoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Logout button.
|
||||||
|
world logout-widget {
|
||||||
|
include widget;
|
||||||
|
import session;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
Logout button.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT!
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
warnings = "-44"
|
||||||
Reference in new issue
Block a user