- Add compositor/shell/backlight.mbt for backlight control in the shell - Update wit/capabilities.wit and wit/host/plasmoids.wit, then regenerate the component and interface ffi.mbt bindings (mostly export reordering) - Add world/launcher-widget/README.md
This commit is contained in:
1 parent
2e00009c79
commit
74235cb0ca
84 files changed
+1520
-859
No files matched your search
@@ -40,14 +40,26 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopup() -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -64,14 +76,14 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@plasmoid.wasmExportInfo()
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfo() -> Int {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -86,15 +98,3 @@ pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(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)
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -97,14 +97,14 @@ extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
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_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)
|
||||||
|
|||||||
@@ -390,30 +390,14 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
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) =
|
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)
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(str)
|
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
|
||||||
|
|
||||||
///|
|
|
||||||
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_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_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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -421,11 +405,27 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array16
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
@@ -46,14 +46,8 @@ pub fn wasmExportInfo() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopup() -> Int {
|
|
||||||
@plasmoid.wasmExportPopup()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -64,14 +58,20 @@ pub fn wasmExportConfigItems() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -82,8 +82,14 @@ pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -92,9 +98,3 @@ pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -81,23 +81,21 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(str)
|
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
||||||
#|(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_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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -106,9 +104,11 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| local.get 0)
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
@@ -391,23 +391,12 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
|
||||||
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_store8(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -416,16 +405,27 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(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)
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@plasmoid.wasmExportInfo()
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -50,36 +50,18 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfo() -> Int {
|
||||||
|
@plasmoid.wasmExportInfo()
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportConfigItems() -> Int {
|
pub fn wasmExportConfigItems() -> Int {
|
||||||
@module-config.wasmExportConfigItems()
|
@module-config.wasmExportConfigItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopup() -> Int {
|
|
||||||
@plasmoid.wasmExportPopup()
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@@ -88,8 +70,8 @@ pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportPopup() -> Int {
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -98,3 +80,21 @@ pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -82,15 +82,15 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(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 =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
#| 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_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
@@ -101,14 +101,14 @@ extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|||||||
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 =
|
||||||
|
#|(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) =
|
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)
|
|
||||||
|
|
||||||
@@ -390,22 +390,6 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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)
|
|
||||||
|
|
||||||
///|
|
|
||||||
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_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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -413,10 +397,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
@@ -424,8 +404,28 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| 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_store32(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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)
|
||||||
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_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
+20
-20
@@ -38,6 +38,12 @@ extern "wasm" fn mbt_ffi_malloc(size : 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)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportConfigItems() -> Int {
|
pub fn wasmExportConfigItems() -> Int {
|
||||||
@@ -46,20 +52,8 @@ pub fn wasmExportConfigItems() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -76,8 +70,8 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -88,13 +82,19 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,15 +81,6 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#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_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)
|
||||||
@@ -97,10 +88,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| 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_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)
|
||||||
@@ -108,6 +95,19 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#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_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
|
|||||||
@@ -391,41 +391,41 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
|
#| local.get 0
|
||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 1)
|
#| 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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(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)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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 =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
|
||||||
#| local.get 0)
|
|
||||||
|
|
||||||
@@ -44,60 +44,24 @@ pub fn wasmExportInfo() -> Int {
|
|||||||
@plasmoid.wasmExportInfo()
|
@plasmoid.wasmExportInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportTick(p0 : Int) -> Int {
|
|
||||||
@desktop-module.wasmExportTick(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportBackdrop() -> Int {
|
|
||||||
@desktop-module.wasmExportBackdrop()
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#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)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportConfigItems() -> Int {
|
||||||
|
@module-config.wasmExportConfigItems()
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@@ -112,7 +76,43 @@ pub fn wasmExportOnScroll(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportConfigItems() -> Int {
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@module-config.wasmExportConfigItems()
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportBackdrop() -> Int {
|
||||||
|
@desktop-module.wasmExportBackdrop()
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportTick(p0 : Int) -> Int {
|
||||||
|
@desktop-module.wasmExportTick(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
@plasmoid.wasmExportPopup()
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,15 +81,6 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(str)
|
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
||||||
#|(func (param i32) (result i32) 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_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)
|
||||||
@@ -97,6 +88,15 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -104,11 +104,11 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| 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_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(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)
|
|
||||||
|
|
||||||
@@ -391,13 +391,21 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(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_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
@@ -409,23 +417,15 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| 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_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)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
@@ -40,14 +40,14 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInitGui(p0 : Int, p1 : Int) -> Unit {
|
pub fn wasmExportOnKey(p0 : Int, p1 : Int, p2 : Int) -> Unit {
|
||||||
@gui-loader.wasmExportInitGui(p0, p1)
|
@gui-loader.wasmExportOnKey(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnKey(p0 : Int, p1 : Int, p2 : Int) -> Unit {
|
pub fn wasmExportInitGui(p0 : Int, p1 : Int) -> Unit {
|
||||||
@gui-loader.wasmExportOnKey(p0, p1, p2)
|
@gui-loader.wasmExportInitGui(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
|
|||||||
@@ -40,8 +40,20 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportTick(p0 : Int) -> Int {
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@desktop-module.wasmExportTick(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnScroll(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@desktop-module.wasmExportOnScroll(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -52,14 +64,26 @@ pub fn wasmExportInfo() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportTick(p0 : Int) -> Int {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@desktop-module.wasmExportTick(p0)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportConfigItems() -> Int {
|
||||||
|
@module-config.wasmExportConfigItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportBackdrop() -> Int {
|
||||||
|
@desktop-module.wasmExportBackdrop()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -74,45 +98,21 @@ pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportConfigItems() -> Int {
|
|
||||||
@module-config.wasmExportConfigItems()
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|
||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopup() -> Int {
|
pub fn wasmExportPopup() -> Int {
|
||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportBackdrop() -> Int {
|
|
||||||
@desktop-module.wasmExportBackdrop()
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportOnScroll(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@desktop-module.wasmExportOnScroll(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -81,21 +81,10 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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) =
|
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)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -104,11 +93,22 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
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_array16
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -390,13 +390,25 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(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)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -405,27 +417,15 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(str)
|
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
||||||
#|(func (param i32) (result i32) 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_store8(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| 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)
|
||||||
|
|
||||||
@@ -40,14 +40,20 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopup() -> Int {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -62,21 +68,15 @@ pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
|||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopup() -> Int {
|
||||||
|
@plasmoid.wasmExportPopup()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -391,13 +391,27 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
|
#| local.get 1 call $moonbit.init_array16
|
||||||
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_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 =
|
||||||
@@ -407,25 +421,11 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
#owned(str)
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) 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_store32(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
|
||||||
|
|
||||||
///|
|
|
||||||
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)
|
|
||||||
|
|
||||||
@@ -52,14 +52,14 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -76,7 +76,7 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,10 +390,6 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
@@ -402,16 +398,16 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
#owned(str)
|
||||||
@@ -422,6 +418,10 @@ 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_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
|
|||||||
@@ -38,24 +38,12 @@ extern "wasm" fn mbt_ffi_malloc(size : 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)
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportInfo() -> Int {
|
||||||
@@ -64,14 +52,20 @@ pub fn wasmExportInfo() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -80,3 +74,9 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -390,6 +390,11 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -398,14 +403,17 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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_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_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
@@ -417,15 +425,7 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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_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_store8(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
|
||||||
|
|
||||||
@@ -40,14 +40,8 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -56,27 +50,33 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportInfo() -> Int {
|
||||||
@plasmoid.wasmExportInfo()
|
@plasmoid.wasmExportInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#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)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -391,16 +391,20 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
#owned(str)
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(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_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -410,22 +414,18 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
#|(func (param i32) (result i32) 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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| 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)
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -50,6 +50,12 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportInfo() -> Int {
|
||||||
@@ -62,21 +68,15 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
@plasmoid.wasmExportPopup()
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -391,14 +391,21 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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_store32(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
#|(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_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)
|
||||||
@@ -406,14 +413,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
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)
|
||||||
@@ -422,10 +421,11 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
#owned(str)
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -38,24 +38,18 @@ extern "wasm" fn mbt_ffi_malloc(size : 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)
|
||||||
|
|
||||||
///|
|
|
||||||
#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)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
@@ -64,14 +58,14 @@ pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportInfo() -> Int {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@plasmoid.wasmExportInfo()
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportPopup() -> Int {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@plasmoid.wasmExportPopup()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -80,3 +74,9 @@ pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportInfo() -> Int {
|
||||||
|
@plasmoid.wasmExportInfo()
|
||||||
|
}
|
||||||
|
|
||||||
@@ -390,18 +390,25 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_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)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
|
||||||
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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
@@ -412,15 +419,8 @@ 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) =
|
extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ enum Row {
|
|||||||
Browse
|
Browse
|
||||||
/// A line of text (the battery).
|
/// A line of text (the battery).
|
||||||
Info(String)
|
Info(String)
|
||||||
|
/// Display backlight slider (`power.brightness` / `power.set-brightness`).
|
||||||
|
Brightness
|
||||||
/// A timeout that steps through `choices`: 0 screen off, 1 suspend.
|
/// A timeout that steps through `choices`: 0 screen off, 1 suspend.
|
||||||
Timeout(Int, String)
|
Timeout(Int, String)
|
||||||
/// Suspend (0), power off (1) or restart (2) now.
|
/// Suspend (0), power off (1) or restart (2) now.
|
||||||
@@ -232,6 +234,10 @@ fn rows() -> Array[Row] {
|
|||||||
let state = if snap.charging { " (charging)" } else { "" }
|
let state = if snap.charging { " (charging)" } else { "" }
|
||||||
rs.push(Info(snap.battery_percent.to_string() + "%" + state))
|
rs.push(Info(snap.battery_percent.to_string() + "%" + state))
|
||||||
}
|
}
|
||||||
|
if @power.brightness() >= 0 {
|
||||||
|
rs.push(Heading("Brightness"))
|
||||||
|
rs.push(Brightness)
|
||||||
|
}
|
||||||
rs.push(Heading("When idle"))
|
rs.push(Heading("When idle"))
|
||||||
rs.push(Timeout(0, "Turn screen off after"))
|
rs.push(Timeout(0, "Turn screen off after"))
|
||||||
rs.push(Timeout(1, "Suspend after"))
|
rs.push(Timeout(1, "Suspend after"))
|
||||||
@@ -485,6 +491,19 @@ fn on_reset(sc : @shortcuts.Shortcut, x : Int) -> Bool {
|
|||||||
sc.binding != sc.default_binding && !sc.capturing && x >= popup_w - margin - reset_w
|
sc.binding != sc.default_binding && !sc.capturing && x >= popup_w - margin - reset_w
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let bright_btn_w : Int = 26
|
||||||
|
|
||||||
|
///|
|
||||||
|
let bright_bar_x : Int = margin + 8 + bright_btn_w + 8
|
||||||
|
|
||||||
|
///|
|
||||||
|
let bright_bar_w : Int = popup_w - margin - 44 - 8 - bright_btn_w - 8 - bright_bar_x
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn clamp_brightness(v : Int) -> Int {
|
||||||
|
if v < 5 { 5 } else if v > 100 { 100 } else { v }
|
||||||
|
}
|
||||||
|
|
||||||
///| Act on row `i`: flip a setting, show a wallpaper, load a module, or browse. A panel-list row
|
///| Act on row `i`: flip a setting, show a wallpaper, load a module, or browse. A panel-list row
|
||||||
/// acts only through button `btn` (0 move up, 1 move down, 2 remove).
|
/// acts only through button `btn` (0 move up, 1 move down, 2 remove).
|
||||||
fn act(rs : Array[Row], i : Int, btn~ : Int = -1, x~ : Int = 0) -> Unit {
|
fn act(rs : Array[Row], i : Int, btn~ : Int = -1, x~ : Int = 0) -> Unit {
|
||||||
@@ -494,6 +513,24 @@ fn act(rs : Array[Row], i : Int, btn~ : Int = -1, x~ : Int = 0) -> Unit {
|
|||||||
let was_armed = armed.val
|
let was_armed = armed.val
|
||||||
armed.val = -1
|
armed.val = -1
|
||||||
match rs[i] {
|
match rs[i] {
|
||||||
|
Brightness => {
|
||||||
|
let cur = @power.brightness()
|
||||||
|
if cur < 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let next = if x > 0 && x < bright_bar_x {
|
||||||
|
clamp_brightness(cur - 10)
|
||||||
|
} else if x >= bright_bar_x + bright_bar_w + 4 {
|
||||||
|
clamp_brightness(cur + 10)
|
||||||
|
} else if x >= bright_bar_x && x <= bright_bar_x + bright_bar_w {
|
||||||
|
clamp_brightness(((x - bright_bar_x) * 100 + bright_bar_w / 2) / bright_bar_w)
|
||||||
|
} else if cur >= 100 {
|
||||||
|
10
|
||||||
|
} else {
|
||||||
|
clamp_brightness(cur + 10)
|
||||||
|
}
|
||||||
|
@power.set_brightness(next.reinterpret_as_uint())
|
||||||
|
}
|
||||||
Timeout(0, _) => @power.set_screen_off_minutes(next_choice(screen_off_choices, @power.screen_off_minutes().reinterpret_as_int()).reinterpret_as_uint())
|
Timeout(0, _) => @power.set_screen_off_minutes(next_choice(screen_off_choices, @power.screen_off_minutes().reinterpret_as_int()).reinterpret_as_uint())
|
||||||
Timeout(_, _) => @power.set_suspend_minutes(next_choice(suspend_choices, @power.suspend_minutes().reinterpret_as_int()).reinterpret_as_uint())
|
Timeout(_, _) => @power.set_suspend_minutes(next_choice(suspend_choices, @power.suspend_minutes().reinterpret_as_int()).reinterpret_as_uint())
|
||||||
PowerNow(0, _) => @power.suspend()
|
PowerNow(0, _) => @power.suspend()
|
||||||
@@ -659,7 +696,7 @@ pub fn popup() -> PopupSurface? {
|
|||||||
match rs[i] {
|
match rs[i] {
|
||||||
Heading(_) | Category(_) | NothingToAdd | Browse => ()
|
Heading(_) | Category(_) | NothingToAdd | Browse => ()
|
||||||
// Rows with their own buttons get the soft fill, so the buttons stand out.
|
// Rows with their own buttons get the soft fill, so the buttons stand out.
|
||||||
Setting(_, _) | FaceUse | Loaded(_, _, _, _) | Available(_, _, _, _) =>
|
Setting(_, _) | FaceUse | Brightness | Loaded(_, _, _, _) | Available(_, _, _, _) =>
|
||||||
if hot {
|
if hot {
|
||||||
ops.push(@ui.fill_rect(@ui.rect(margin, y, w - 2 * margin, rh - 2), p.surface_hover, radius=r))
|
ops.push(@ui.fill_rect(@ui.rect(margin, y, w - 2 * margin, rh - 2), p.surface_hover, radius=r))
|
||||||
}
|
}
|
||||||
@@ -798,6 +835,32 @@ pub fn popup() -> PopupSurface? {
|
|||||||
} else {
|
} else {
|
||||||
ops.push(@ui.text(margin + 10, mid, text, fs - 1, p.foreground))
|
ops.push(@ui.text(margin + 10, mid, text, fs - 1, p.foreground))
|
||||||
}
|
}
|
||||||
|
Brightness => {
|
||||||
|
let cur = @power.brightness()
|
||||||
|
let pct = if cur < 0 { 0 } else if cur > 100 { 100 } else { cur }
|
||||||
|
let bx0 = margin + 8
|
||||||
|
let bh = 22
|
||||||
|
let by = mid - bh / 2
|
||||||
|
let bx1 = bright_bar_x + bright_bar_w + 8
|
||||||
|
let bbg = if hot { p.surface_popup } else { p.surface_hover }
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(bx0, by, bright_btn_w, bh), bbg, radius=r))
|
||||||
|
ops.push(@ui.stroke_rect(@ui.rect(bx0, by, bright_btn_w, bh), p.border, width=1, radius=r))
|
||||||
|
ops.push(@ui.text(bx0 + bright_btn_w / 2, mid, "-", fs, p.foreground, align=CENTER, bold=true))
|
||||||
|
let track_h = 8
|
||||||
|
let track_y = mid - track_h / 2
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(bright_bar_x, track_y, bright_bar_w, track_h), p.border, radius=track_h / 2))
|
||||||
|
let fill_w = bright_bar_w * pct / 100
|
||||||
|
if fill_w > 0 {
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(bright_bar_x, track_y, fill_w, track_h), p.accent, radius=track_h / 2))
|
||||||
|
}
|
||||||
|
let thumb_x = bright_bar_x + fill_w
|
||||||
|
ops.push(@ui.circle(thumb_x, mid, 6, p.accent))
|
||||||
|
ops.push(@ui.circle(thumb_x, mid, 4, p.accent_foreground))
|
||||||
|
ops.push(@ui.fill_rect(@ui.rect(bx1, by, bright_btn_w, bh), bbg, radius=r))
|
||||||
|
ops.push(@ui.stroke_rect(@ui.rect(bx1, by, bright_btn_w, bh), p.border, width=1, radius=r))
|
||||||
|
ops.push(@ui.text(bx1 + bright_btn_w / 2, mid, "+", fs, p.foreground, align=CENTER, bold=true))
|
||||||
|
ops.push(@ui.text(w - margin - 8, mid, pct.to_string() + "%", fs - 1, p.foreground, align=RIGHT, bold=true))
|
||||||
|
}
|
||||||
Timeout(k, label) => {
|
Timeout(k, label) => {
|
||||||
let m = if k == 0 { @power.screen_off_minutes() } else { @power.suspend_minutes() }
|
let m = if k == 0 { @power.screen_off_minutes() } else { @power.suspend_minutes() }
|
||||||
ops.push(@ui.text(margin + 10, mid, label, fs - 1, list_fg))
|
ops.push(@ui.text(margin + 10, mid, label, fs - 1, list_fg))
|
||||||
@@ -1000,6 +1063,17 @@ pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool {
|
|||||||
} else if k == "1" || k == "2" || k == "3" || k == "4" || k == "5" || k == "6" {
|
} else if k == "1" || k == "2" || k == "3" || k == "4" || k == "5" || k == "6" {
|
||||||
set_tab(k[0].to_int() - '1'.to_int())
|
set_tab(k[0].to_int() - '1'.to_int())
|
||||||
true
|
true
|
||||||
|
} else if k == "-" || k == "_" || k == "+" || k == "=" {
|
||||||
|
let rs = rows()
|
||||||
|
if active(rs, hover.val) && rs[hover.val] is Brightness {
|
||||||
|
let cur = @power.brightness()
|
||||||
|
if cur >= 0 {
|
||||||
|
let delta = if k == "-" || k == "_" { -10 } else { 10 }
|
||||||
|
@power.set_brightness(clamp_brightness(cur + delta).reinterpret_as_uint())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,36 +38,12 @@ extern "wasm" fn mbt_ffi_malloc(size : 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)
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPosition(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int, p6 : Int, p7 : Int, p8 : Int, p9 : Int, p10 : Int, p11 : Int) -> Int {
|
|
||||||
@panel-layout.wasmExportPopupPosition(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderBackgroundPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRenderBackgroundPostReturn(p0 : Int) -> Unit {
|
||||||
@desktop-surface.wasmExportRenderBackgroundPostReturn(p0)
|
@desktop-surface.wasmExportRenderBackgroundPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportRenderPanelPostReturn(p0 : Int) -> Unit {
|
|
||||||
@panel-layout.wasmExportRenderPanelPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportComputeLayoutPostReturn(p0 : Int) -> Unit {
|
|
||||||
@panel-layout.wasmExportComputeLayoutPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportComputeLayout(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@panel-layout.wasmExportComputeLayout(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPanel(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int) -> Int {
|
pub fn wasmExportRenderPanel(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int) -> Int {
|
||||||
@@ -80,3 +56,27 @@ pub fn wasmExportRenderBackground(p0 : Int, p1 : Int) -> Int {
|
|||||||
@desktop-surface.wasmExportRenderBackground(p0, p1)
|
@desktop-surface.wasmExportRenderBackground(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportComputeLayoutPostReturn(p0 : Int) -> Unit {
|
||||||
|
@panel-layout.wasmExportComputeLayoutPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPosition(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int, p6 : Int, p7 : Int, p8 : Int, p9 : Int, p10 : Int, p11 : Int) -> Int {
|
||||||
|
@panel-layout.wasmExportPopupPosition(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPanelPostReturn(p0 : Int) -> Unit {
|
||||||
|
@panel-layout.wasmExportRenderPanelPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportComputeLayout(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@panel-layout.wasmExportComputeLayout(p0, p1, p2, p3)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -149,9 +149,19 @@ pub fn wasmExportRenderBackgroundPostReturn(p0 : Int) -> Unit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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 =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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) =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
@@ -166,17 +176,7 @@ extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
|||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
#owned(str)
|
||||||
#|(func (param i32) (result i32) (local i32)
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> 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)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
|
||||||
|
|
||||||
@@ -218,28 +218,10 @@ pub fn wasmExportPopupPosition(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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_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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
|
||||||
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) =
|
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)
|
||||||
@@ -252,8 +234,26 @@ extern "wasm" fn mbt_ffi_store32(offset : Int, value : 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_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_store8(offset : Int, value : Int) =
|
||||||
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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 =
|
||||||
|
#|(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)
|
||||||
|
|
||||||
@@ -40,20 +40,8 @@ extern "wasm" fn mbt_ffi_free(position : Int) =
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportBackdrop() -> Int {
|
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@desktop-module.wasmExportBackdrop()
|
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
|
||||||
@plasmoid.wasmExportPopupPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportConfigItems() -> Int {
|
|
||||||
@module-config.wasmExportConfigItems()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -62,18 +50,6 @@ pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit {
|
|||||||
@plasmoid.wasmExportInfoPostReturn(p0)
|
@plasmoid.wasmExportInfoPostReturn(p0)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|
||||||
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
|
||||||
#doc(hidden)
|
|
||||||
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
|
||||||
@module-config.wasmExportConfigItemsPostReturn(p0)
|
|
||||||
}
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportPopup() -> Int {
|
pub fn wasmExportPopup() -> Int {
|
||||||
@@ -82,8 +58,8 @@ pub fn wasmExportPopup() -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
pub fn wasmExportConfigItems() -> Int {
|
||||||
@plasmoid.wasmExportRender(p0, p1)
|
@module-config.wasmExportConfigItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -94,14 +70,26 @@ pub fn wasmExportTick(p0 : Int) -> Int {
|
|||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int {
|
||||||
@plasmoid.wasmExportRenderPostReturn(p0)
|
@plasmoid.wasmExportRender(p0, p1)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportConfigItemsPostReturn(p0 : Int) -> Unit {
|
||||||
@module-config.wasmExportSetConfig(p0, p1, p2, p3)
|
@module-config.wasmExportConfigItemsPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportPopupPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
|
@plasmoid.wasmExportOnEvent(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
@@ -110,9 +98,21 @@ pub fn wasmExportInfo() -> Int {
|
|||||||
@plasmoid.wasmExportInfo()
|
@plasmoid.wasmExportInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportBackdrop() -> Int {
|
||||||
|
@desktop-module.wasmExportBackdrop()
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#doc(hidden)
|
#doc(hidden)
|
||||||
pub fn wasmExportOnScroll(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
pub fn wasmExportOnScroll(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
||||||
@desktop-module.wasmExportOnScroll(p0, p1, p2, p3)
|
@desktop-module.wasmExportOnScroll(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#doc(hidden)
|
||||||
|
pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit {
|
||||||
|
@plasmoid.wasmExportRenderPostReturn(p0)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -82,8 +82,8 @@ pub fn wasmExportSetConfig(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
#owned(str)
|
||||||
@@ -91,12 +91,11 @@ 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_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) (param i32) (result i32)
|
||||||
|
#| local.get 0
|
||||||
///|
|
#| local.get 1 call $moonbit.init_array16
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
#| local.get 0)
|
||||||
#|(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 =
|
||||||
@@ -106,9 +105,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| local.get 0)
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -390,6 +390,27 @@ pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) 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_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_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -397,14 +418,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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_store8(offset : Int, value : Int) =
|
|
||||||
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -413,19 +426,6 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#owned(str)
|
extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) =
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store)
|
||||||
#|(func (param i32) (result i32) local.get 0)
|
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
|
||||||
|
|
||||||
@@ -216,6 +216,12 @@ fn main {
|
|||||||
for ev in k.take_input() {
|
for ev in k.take_input() {
|
||||||
comp.handle_input(ev, now_ms)
|
comp.handle_input(ev, now_ms)
|
||||||
}
|
}
|
||||||
|
match comp.power_tick(@sys.monotonic_ms()) {
|
||||||
|
ScreenOff => k.set_power(false)
|
||||||
|
ScreenOn => k.set_power(true)
|
||||||
|
Suspend => comp.system_power(0)
|
||||||
|
NoChange => ()
|
||||||
|
}
|
||||||
match comp.take_pending_rotation() {
|
match comp.take_pending_rotation() {
|
||||||
Some(rot) => {
|
Some(rot) => {
|
||||||
let (nw, nh) = k.set_rotation(rot)
|
let (nw, nh) = k.set_rotation(rot)
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ pub(all) struct ChandraCompositor {
|
|||||||
/// idle, and whether this idle spell already suspended.
|
/// idle, and whether this idle spell already suspended.
|
||||||
mut last_input_ms : UInt64
|
mut last_input_ms : UInt64
|
||||||
mut screen_off : Bool
|
mut screen_off : Bool
|
||||||
|
mut manual_screen_off : Bool
|
||||||
mut idle_suspended : Bool
|
mut idle_suspended : Bool
|
||||||
mut output_w : Int
|
mut output_w : Int
|
||||||
mut output_h : Int
|
mut output_h : Int
|
||||||
@@ -384,6 +385,7 @@ pub fn ChandraCompositor::new(
|
|||||||
login_session: false,
|
login_session: false,
|
||||||
last_input_ms: @sys.monotonic_ms(),
|
last_input_ms: @sys.monotonic_ms(),
|
||||||
screen_off: false,
|
screen_off: false,
|
||||||
|
manual_screen_off: false,
|
||||||
idle_suspended: false,
|
idle_suspended: false,
|
||||||
output_w,
|
output_w,
|
||||||
output_h,
|
output_h,
|
||||||
@@ -2071,6 +2073,27 @@ fn ChandraCompositor::handle_input_inner(
|
|||||||
ev : @nested.InputEvent,
|
ev : @nested.InputEvent,
|
||||||
time_ms : UInt,
|
time_ms : UInt,
|
||||||
) -> Unit {
|
) -> Unit {
|
||||||
|
match ev {
|
||||||
|
Key(116U, pressed) => {
|
||||||
|
if pressed {
|
||||||
|
if self.screen_off || self.manual_screen_off {
|
||||||
|
self.manual_screen_off = false
|
||||||
|
self.note_activity(@sys.monotonic_ms())
|
||||||
|
} else {
|
||||||
|
self.manual_screen_off = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_ => ()
|
||||||
|
}
|
||||||
|
if self.manual_screen_off {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if self.screen_off {
|
||||||
|
self.note_activity(@sys.monotonic_ms())
|
||||||
|
return
|
||||||
|
}
|
||||||
self.note_activity(@sys.monotonic_ms())
|
self.note_activity(@sys.monotonic_ms())
|
||||||
match ev {
|
match ev {
|
||||||
Modifiers(dep, lat, lock, group) => {
|
Modifiers(dep, lat, lock, group) => {
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
|||||||
"windows each window: frame, layout, box, shadow, size limits; and what is under the pointer",
|
"windows each window: frame, layout, box, shadow, size limits; and what is under the pointer",
|
||||||
"screenshot [PATH] save a full-screen PNG directly (without opening the editor)",
|
"screenshot [PATH] save a full-screen PNG directly (without opening the editor)",
|
||||||
"rotate [cw|ccw|flip|0|90|180|270|status] rotate or flip the display",
|
"rotate [cw|ccw|flip|0|90|180|270|status] rotate or flip the display",
|
||||||
|
"screen [on|off|toggle|status] blank or wake the display",
|
||||||
|
"brightness [PCT|status] read or set display backlight percent (5..100)",
|
||||||
"auth-demo [MODE] show the password dialog with a pretend check (password \"demo\"); MODE: " +
|
"auth-demo [MODE] show the password dialog with a pretend check (password \"demo\"); MODE: " +
|
||||||
@polkit.demo_modes.join(", "),
|
@polkit.demo_modes.join(", "),
|
||||||
"auth-status the password dialog's agent: running, registered, or why not",
|
"auth-status the password dialog's agent: running, registered, or why not",
|
||||||
@@ -398,6 +400,64 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
|||||||
_ => (["error usage: rotate [cw|ccw|flip|0|90|180|270|status]"], false)
|
_ => (["error usage: rotate [cw|ccw|flip|0|90|180|270|status]"], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
"screen" => {
|
||||||
|
let arg = if words.length() >= 2 { words[1] } else { "status" }
|
||||||
|
if words.length() > 2 {
|
||||||
|
return (["error usage: screen [on|off|toggle|status]"], false)
|
||||||
|
}
|
||||||
|
match arg {
|
||||||
|
"status" => (["ok " + (if self.screen_off || self.manual_screen_off { "off" } else { "on" })], true)
|
||||||
|
"off" => {
|
||||||
|
self.set_manual_screen_off(true)
|
||||||
|
(["ok off"], true)
|
||||||
|
}
|
||||||
|
"on" => {
|
||||||
|
self.set_manual_screen_off(false)
|
||||||
|
(["ok on"], true)
|
||||||
|
}
|
||||||
|
"toggle" => {
|
||||||
|
let next_off = !(self.screen_off || self.manual_screen_off)
|
||||||
|
self.set_manual_screen_off(next_off)
|
||||||
|
(["ok " + (if next_off { "off" } else { "on" })], true)
|
||||||
|
}
|
||||||
|
_ => (["error usage: screen [on|off|toggle|status]"], false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"brightness" => {
|
||||||
|
let arg = if words.length() >= 2 { words[1] } else { "status" }
|
||||||
|
if words.length() > 2 {
|
||||||
|
return (["error usage: brightness [PCT|status]"], false)
|
||||||
|
}
|
||||||
|
if arg == "status" {
|
||||||
|
let cur = @shell.read_backlight_percent()
|
||||||
|
if cur < 0 {
|
||||||
|
(["error no backlight"], false)
|
||||||
|
} else {
|
||||||
|
(["ok " + cur.to_string()], true)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let mut val = 0
|
||||||
|
let mut valid = arg.length() > 0
|
||||||
|
for ch in arg {
|
||||||
|
let c = ch.to_int()
|
||||||
|
if c >= 48 && c <= 57 {
|
||||||
|
val = val * 10 + (c - 48)
|
||||||
|
} else {
|
||||||
|
valid = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !valid {
|
||||||
|
return (["error usage: brightness [PCT|status]"], false)
|
||||||
|
}
|
||||||
|
let next = self.shell.set_brightness(val)
|
||||||
|
if next < 0 {
|
||||||
|
(["error no backlight"], false)
|
||||||
|
} else {
|
||||||
|
(["ok " + next.to_string()], true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
other => (["error unknown command '" + other + "' (try: help)"], false)
|
other => (["error unknown command '" + other + "' (try: help)"], false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1739,7 +1739,7 @@ test "the settings module's Power tab steps the timeouts and confirms power off"
|
|||||||
// Rows of 28 below the tab bar (40): [Battery heading, battery,] When idle, screen off,
|
// Rows of 28 below the tab bar (40): [Battery heading, battery,] When idle, screen off,
|
||||||
// suspend, Now, Suspend, Restart, Power off.
|
// suspend, Now, Suspend, Restart, Power off.
|
||||||
let n = (pr.h - 40 - 6) / 28
|
let n = (pr.h - 40 - 6) / 28
|
||||||
assert_true(n == 7 || n == 9)
|
assert_true(n == 7 || n == 9 || n == 11)
|
||||||
let first = n - 7
|
let first = n - 7
|
||||||
let row_y = fn(i : Int) { pr.y + 40 + (first + i) * 28 + 13 }
|
let row_y = fn(i : Int) { pr.y + 40 + (first + i) * 28 + 13 }
|
||||||
assert_eq(comp.shell.screen_off_min, 10)
|
assert_eq(comp.shell.screen_off_min, 10)
|
||||||
@@ -1775,3 +1775,61 @@ test "power timeouts are saved to state.edn and restored" {
|
|||||||
assert_false(read_state_edn().contains(":power"))
|
assert_false(read_state_edn().contains(":power"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
test "power key toggles manual screen off and wakes without leaking touches" {
|
||||||
|
let comp = new_comp("powerbtn")
|
||||||
|
comp.note_activity(1000UL)
|
||||||
|
assert_eq(comp.power_tick(1000UL), NoChange)
|
||||||
|
// Pressing KEY_POWER (116) turns screen off; releasing it leaves it off.
|
||||||
|
comp.handle_input(@nested.InputEvent::Key(116U, true), 10U)
|
||||||
|
comp.handle_input(@nested.InputEvent::Key(116U, false), 20U)
|
||||||
|
assert_eq(comp.power_tick(1050UL), ScreenOff)
|
||||||
|
assert_eq(comp.power_tick(1060UL), NoChange)
|
||||||
|
// Stray touch/pointer activity while manually blanked does not wake the screen.
|
||||||
|
comp.handle_input(@nested.InputEvent::PointerMove(50.0, 50.0), 30U)
|
||||||
|
assert_eq(comp.power_tick(1100UL), NoChange)
|
||||||
|
// Second KEY_POWER press wakes the screen and keeps it awake after release.
|
||||||
|
comp.handle_input(@nested.InputEvent::Key(116U, true), 40U)
|
||||||
|
comp.handle_input(@nested.InputEvent::Key(116U, false), 50U)
|
||||||
|
assert_eq(comp.power_tick(1200UL), ScreenOn)
|
||||||
|
assert_eq(comp.power_tick(1300UL), NoChange)
|
||||||
|
// Control socket screen commands work symmetrically.
|
||||||
|
let (r1, ok1) = comp.control_command("screen off")
|
||||||
|
assert_true(ok1 && r1 == ["ok off"])
|
||||||
|
assert_eq(comp.power_tick(1400UL), ScreenOff)
|
||||||
|
let (r2, ok2) = comp.control_command("screen on")
|
||||||
|
assert_true(ok2 && r2 == ["ok on"])
|
||||||
|
assert_eq(comp.power_tick(1500UL), ScreenOn)
|
||||||
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
test "settings Power tab displays and adjusts backlight brightness" {
|
||||||
|
let root = "/tmp/chandra-test-backlight"
|
||||||
|
let dev = root + "/ae94000.dsi.0"
|
||||||
|
ignore(@sys.mkdir_p(dev))
|
||||||
|
assert_eq(@sys.write_file_bytes(dev + "/max_brightness", @utf8.encode("1000\n")), 0)
|
||||||
|
assert_eq(@sys.write_file_bytes(dev + "/brightness", @utf8.encode("500\n")), 0)
|
||||||
|
@shell.set_backlight_root(root)
|
||||||
|
let comp = new_comp("brightness")
|
||||||
|
comp.shell.refresh_brightness()
|
||||||
|
let slot = comp.shell.slot_of("session-settings")
|
||||||
|
assert_true(comp.shell.open_settings(Power))
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
let texts = comp.shell.slot_popup_texts(slot).map(t => t.0)
|
||||||
|
assert_true(texts.contains("Brightness"))
|
||||||
|
assert_true(texts.contains("50%"))
|
||||||
|
let pr = comp.shell.slot_popup_rect(slot)
|
||||||
|
let (_, br) = comp.control_command("brightness 80")
|
||||||
|
assert_true(br)
|
||||||
|
ignore(comp.compose_frame())
|
||||||
|
assert_true(comp.shell.slot_popup_texts(slot).map(t => t.0).contains("80%"))
|
||||||
|
assert_eq(@shell.read_backlight_percent(), 80)
|
||||||
|
// Clicking the '-' button (x inside [margin..47]) steps 80 -> 70%.
|
||||||
|
let n = (pr.h - 40 - 6) / 28
|
||||||
|
let bright_row = n - 8
|
||||||
|
assert_true(bright_row >= 1)
|
||||||
|
click_at(comp, pr.x + 25, pr.y + 40 + bright_row * 28 + 13, 10U)
|
||||||
|
assert_eq(@shell.read_backlight_percent(), 70)
|
||||||
|
@shell.set_backlight_root("/sys/class/backlight")
|
||||||
|
}
|
||||||
@@ -21,8 +21,26 @@ pub fn ChandraCompositor::note_activity(self : ChandraCompositor, now_ms : UInt6
|
|||||||
self.last_input_ms = now_ms
|
self.last_input_ms = now_ms
|
||||||
}
|
}
|
||||||
|
|
||||||
///| Check the idle timeouts at monotonic time `now_ms`.
|
///| Turn the screen off or back on from a manual action (power button or `chandra-ctl screen`).
|
||||||
|
pub fn ChandraCompositor::set_manual_screen_off(
|
||||||
|
self : ChandraCompositor,
|
||||||
|
off : Bool,
|
||||||
|
) -> Unit {
|
||||||
|
self.manual_screen_off = off
|
||||||
|
if !off {
|
||||||
|
self.note_activity(@sys.monotonic_ms())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Check the idle timeouts and manual screen blank state at monotonic time `now_ms`.
|
||||||
pub fn ChandraCompositor::power_tick(self : ChandraCompositor, now_ms : UInt64) -> PowerChange {
|
pub fn ChandraCompositor::power_tick(self : ChandraCompositor, now_ms : UInt64) -> PowerChange {
|
||||||
|
if self.manual_screen_off {
|
||||||
|
if !self.screen_off {
|
||||||
|
self.screen_off = true
|
||||||
|
return ScreenOff
|
||||||
|
}
|
||||||
|
return NoChange
|
||||||
|
}
|
||||||
let idle = if now_ms > self.last_input_ms { now_ms - self.last_input_ms } else { 0UL }
|
let idle = if now_ms > self.last_input_ms { now_ms - self.last_input_ms } else { 0UL }
|
||||||
let minutes = fn(m : Int) { m.to_uint64() * 60000UL }
|
let minutes = fn(m : Int) { m.to_uint64() * 60000UL }
|
||||||
let off = self.shell.screen_off_min
|
let off = self.shell.screen_off_min
|
||||||
|
|||||||
@@ -538,6 +538,7 @@ MOONBIT_FFI_EXPORT
|
|||||||
void mp_kms_set_power(int32_t on) {
|
void mp_kms_set_power(int32_t on) {
|
||||||
if (!g_seat || (on ? !g_blank : g_blank)) return;
|
if (!g_seat || (on ? !g_blank : g_blank)) return;
|
||||||
g_blank = !on;
|
g_blank = !on;
|
||||||
|
if (!on) touch_cancel();
|
||||||
if (!g_seat_enabled || g_suspended) return; /* applied when the VT comes back */
|
if (!g_seat_enabled || g_suspended) return; /* applied when the VT comes back */
|
||||||
if (on) {
|
if (on) {
|
||||||
set_dpms(1);
|
set_dpms(1);
|
||||||
@@ -545,6 +546,7 @@ void mp_kms_set_power(int32_t on) {
|
|||||||
} else {
|
} else {
|
||||||
set_dpms(0);
|
set_dpms(0);
|
||||||
}
|
}
|
||||||
|
fprintf(stderr, "kms: screen %s\n", on ? "on" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,151 @@
|
|||||||
|
///| Linux backlight provider for the `power` capability (sysfs read + logind SetBrightness fallback).
|
||||||
|
|
||||||
|
let backlight_root : Ref[String] = { val: "/sys/class/backlight" }
|
||||||
|
|
||||||
|
let backlight_sample_sec : Ref[Int] = { val: -1 }
|
||||||
|
|
||||||
|
let backlight_cached : Ref[Int] = { val: -1 }
|
||||||
|
|
||||||
|
///| Override /sys/class/backlight root for unit tests.
|
||||||
|
pub fn set_backlight_root(dir : String) -> Unit {
|
||||||
|
backlight_root.val = dir
|
||||||
|
backlight_sample_sec.val = -1
|
||||||
|
backlight_cached.val = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
let backlight_names : Array[String] = [
|
||||||
|
"ae94000.dsi.0",
|
||||||
|
"intel_backlight",
|
||||||
|
"amdgpu_bl0",
|
||||||
|
"amdgpu_bl1",
|
||||||
|
"acpi_video0",
|
||||||
|
"acpi_video1",
|
||||||
|
"nvidia_0",
|
||||||
|
"nvidia_wmi_ec_backlight",
|
||||||
|
"apple-panel-bl",
|
||||||
|
"gmux_backlight",
|
||||||
|
"backlight",
|
||||||
|
"panel_backlight",
|
||||||
|
"pwm-backlight",
|
||||||
|
"qcom-wled",
|
||||||
|
"soc:backlight",
|
||||||
|
"rpi_backlight",
|
||||||
|
]
|
||||||
|
|
||||||
|
priv struct BacklightDev {
|
||||||
|
name : String
|
||||||
|
path : String
|
||||||
|
cur : Int64
|
||||||
|
max : Int64
|
||||||
|
}
|
||||||
|
|
||||||
|
fn safe_backlight_name(s : String) -> Bool {
|
||||||
|
if s.length() == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for ch in s {
|
||||||
|
let ok = (ch >= 'a' && ch <= 'z') ||
|
||||||
|
(ch >= 'A' && ch <= 'Z') ||
|
||||||
|
(ch >= '0' && ch <= '9') ||
|
||||||
|
ch == '.' ||
|
||||||
|
ch == '_' ||
|
||||||
|
ch == ':' ||
|
||||||
|
ch == '-'
|
||||||
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
!s.has_prefix(".")
|
||||||
|
}
|
||||||
|
|
||||||
|
fn try_backlight(root : String, name : String) -> BacklightDev? {
|
||||||
|
if !safe_backlight_name(name) {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
let path = root + "/" + name
|
||||||
|
let max = sysfs_num(path + "/max_brightness")
|
||||||
|
if max <= 0L {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
let cur = sysfs_num(path + "/brightness")
|
||||||
|
if cur < 0L {
|
||||||
|
return None
|
||||||
|
}
|
||||||
|
Some({ name, path, cur, max })
|
||||||
|
}
|
||||||
|
|
||||||
|
fn find_backlight(root : String) -> BacklightDev? {
|
||||||
|
let override_name = @sys.getenv("CHANDRA_BACKLIGHT").trim(chars=" \n\r\t").to_string()
|
||||||
|
match try_backlight(root, override_name) {
|
||||||
|
Some(dev) => return Some(dev)
|
||||||
|
None => ()
|
||||||
|
}
|
||||||
|
for name in backlight_names {
|
||||||
|
match try_backlight(root, name) {
|
||||||
|
Some(dev) => return Some(dev)
|
||||||
|
None => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn clamp_pct(pct : Int, lo : Int, hi : Int) -> Int {
|
||||||
|
if pct < lo { lo } else if pct > hi { hi } else { pct }
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Read backlight brightness percentage in 0..100, or -1 if no backlight exists.
|
||||||
|
pub fn read_backlight_percent(root? : String = backlight_root.val) -> Int {
|
||||||
|
match find_backlight(root) {
|
||||||
|
None => -1
|
||||||
|
Some(dev) => clamp_pct(((dev.cur * 100L + dev.max / 2L) / dev.max).to_int(), 0, 100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Sample backlight at most once per wall-clock second.
|
||||||
|
pub fn read_backlight_polled() -> Int {
|
||||||
|
let now = wall_secs()
|
||||||
|
if now != backlight_sample_sec.val {
|
||||||
|
backlight_sample_sec.val = now
|
||||||
|
backlight_cached.val = read_backlight_percent()
|
||||||
|
}
|
||||||
|
backlight_cached.val
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Write display backlight percentage (clamped to 5..100) via sysfs or systemd-logind SetBrightness.
|
||||||
|
pub fn write_backlight_percent(
|
||||||
|
pct : Int,
|
||||||
|
display : String,
|
||||||
|
root? : String = backlight_root.val,
|
||||||
|
) -> Int {
|
||||||
|
match find_backlight(root) {
|
||||||
|
None => -1
|
||||||
|
Some(dev) => {
|
||||||
|
let clamped = clamp_pct(pct, 5, 100)
|
||||||
|
let raw0 = (clamped.to_int64() * dev.max + 50L) / 100L
|
||||||
|
let raw = if raw0 < 1L { 1L } else if raw0 > dev.max { dev.max } else { raw0 }
|
||||||
|
let data = @utf8.encode(raw.to_string() + "\n")
|
||||||
|
if @sys.write_file_bytes(dev.path + "/brightness", data) < 0 {
|
||||||
|
let sid = @sys.getenv("XDG_SESSION_ID").trim(chars=" \n\r\t").to_string()
|
||||||
|
let sess = if sid.length() > 0 && safe_backlight_name(sid) {
|
||||||
|
"/org/freedesktop/login1/session/" + sid
|
||||||
|
} else {
|
||||||
|
"/org/freedesktop/login1/session/auto"
|
||||||
|
}
|
||||||
|
ignore(
|
||||||
|
@sys.spawn(
|
||||||
|
"busctl call org.freedesktop.login1 " +
|
||||||
|
sess +
|
||||||
|
" org.freedesktop.login1.Session SetBrightness ssu backlight " +
|
||||||
|
dev.name +
|
||||||
|
" " +
|
||||||
|
raw.to_string(),
|
||||||
|
display,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
backlight_sample_sec.val = wall_secs()
|
||||||
|
backlight_cached.val = clamped
|
||||||
|
clamped
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -303,6 +303,7 @@ pub(all) struct DesktopShell {
|
|||||||
/// (0: never). Saved in state.edn as :power {:screen-off 10 :suspend 0} when not the defaults.
|
/// (0: never). Saved in state.edn as :power {:screen-off 10 :suspend 0} when not the defaults.
|
||||||
mut screen_off_min : Int
|
mut screen_off_min : Int
|
||||||
mut suspend_min : Int
|
mut suspend_min : Int
|
||||||
|
mut brightness_pct : Int
|
||||||
/// Keyboard shortcuts (shortcuts.mbt); saved in state.edn as :shortcuts when not the defaults.
|
/// Keyboard shortcuts (shortcuts.mbt); saved in state.edn as :shortcuts when not the defaults.
|
||||||
shortcuts : Shortcuts
|
shortcuts : Shortcuts
|
||||||
/// The shortcut waiting for its new combo from the Shortcuts tab (-1: none).
|
/// The shortcut waiting for its new combo from the Shortcuts tab (-1: none).
|
||||||
@@ -481,6 +482,7 @@ pub fn DesktopShell::new(display : String) -> DesktopShell {
|
|||||||
window_style: @scene.WindowStyle::Flat,
|
window_style: @scene.WindowStyle::Flat,
|
||||||
screen_off_min: default_screen_off_min,
|
screen_off_min: default_screen_off_min,
|
||||||
suspend_min: default_suspend_min,
|
suspend_min: default_suspend_min,
|
||||||
|
brightness_pct: -1,
|
||||||
shortcuts: Shortcuts::defaults(),
|
shortcuts: Shortcuts::defaults(),
|
||||||
shortcut_capture: -1,
|
shortcut_capture: -1,
|
||||||
xdg_dirs: XdgDirs::from_env(),
|
xdg_dirs: XdgDirs::from_env(),
|
||||||
|
|||||||
@@ -782,6 +782,7 @@ fn DesktopShell::publish_host_data(self : DesktopShell) -> Unit {
|
|||||||
}
|
}
|
||||||
if self.any_cap("power") {
|
if self.any_cap("power") {
|
||||||
@wasm.publish_power(self.screen_off_min, self.suspend_min)
|
@wasm.publish_power(self.screen_off_min, self.suspend_min)
|
||||||
|
self.refresh_brightness()
|
||||||
}
|
}
|
||||||
if self.any_cap("shortcuts") {
|
if self.any_cap("shortcuts") {
|
||||||
self.publish_shortcuts()
|
self.publish_shortcuts()
|
||||||
@@ -915,6 +916,21 @@ pub fn DesktopShell::set_power_timeouts(self : DesktopShell, screen_off : Int, s
|
|||||||
self.save_state()
|
self.save_state()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| Refresh cached backlight brightness (0..100, or -1 if absent) and publish to modules.
|
||||||
|
pub fn DesktopShell::refresh_brightness(self : DesktopShell) -> Unit {
|
||||||
|
let pct = read_backlight_polled()
|
||||||
|
self.brightness_pct = pct
|
||||||
|
@wasm.publish_brightness(pct)
|
||||||
|
}
|
||||||
|
|
||||||
|
///| Set display backlight percentage (5..100) and publish the updated value.
|
||||||
|
pub fn DesktopShell::set_brightness(self : DesktopShell, pct : Int) -> Int {
|
||||||
|
let res = write_backlight_percent(pct, self.display)
|
||||||
|
self.brightness_pct = res
|
||||||
|
@wasm.publish_brightness(res)
|
||||||
|
res
|
||||||
|
}
|
||||||
|
|
||||||
///| Start the catalog app `id` (a desktop file id) and remember it as the latest launch.
|
///| Start the catalog app `id` (a desktop file id) and remember it as the latest launch.
|
||||||
fn DesktopShell::launch_catalog_app(self : DesktopShell, id : String) -> Unit {
|
fn DesktopShell::launch_catalog_app(self : DesktopShell, id : String) -> Unit {
|
||||||
match self.command_for(id) {
|
match self.command_for(id) {
|
||||||
@@ -950,6 +966,7 @@ fn DesktopShell::process_requests(self : DesktopShell) -> Unit {
|
|||||||
Some(Screenshot(code)) => self.actions.push(Screenshot(code))
|
Some(Screenshot(code)) => self.actions.push(Screenshot(code))
|
||||||
Some(SetScreenOff(m)) => self.set_power_timeouts(m, self.suspend_min)
|
Some(SetScreenOff(m)) => self.set_power_timeouts(m, self.suspend_min)
|
||||||
Some(SetSuspendAfter(m)) => self.set_power_timeouts(self.screen_off_min, m)
|
Some(SetSuspendAfter(m)) => self.set_power_timeouts(self.screen_off_min, m)
|
||||||
|
Some(SetBrightness(p)) => ignore(self.set_brightness(p))
|
||||||
Some(Shortcut(code)) => self.shortcut_request(code)
|
Some(Shortcut(code)) => self.shortcut_request(code)
|
||||||
Some(DefaultApp(code)) => self.default_app_request(code)
|
Some(DefaultApp(code)) => self.default_app_request(code)
|
||||||
Some(FaceUnlock(code)) => self.face.request(code)
|
Some(FaceUnlock(code)) => self.face.request(code)
|
||||||
|
|||||||
@@ -422,6 +422,11 @@ pub fn publish_power(screen_off : Int, suspend : Int) -> Unit {
|
|||||||
@hostpl.publish_power(screen_off.reinterpret_as_uint(), suspend.reinterpret_as_uint())
|
@hostpl.publish_power(screen_off.reinterpret_as_uint(), suspend.reinterpret_as_uint())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| Display backlight brightness percentage (0..100, or -1 if none).
|
||||||
|
pub fn publish_brightness(percent : Int) -> Unit {
|
||||||
|
@hostpl.publish_brightness(percent)
|
||||||
|
}
|
||||||
|
|
||||||
///| The battery (the `battery` capability): percent (-1: none), charge-state index, seconds left.
|
///| The battery (the `battery` capability): percent (-1: none), charge-state index, seconds left.
|
||||||
pub fn publish_battery(percent : Int, state : Int, secs_left : Int) -> Unit {
|
pub fn publish_battery(percent : Int, state : Int, secs_left : Int) -> Unit {
|
||||||
@hostpl.publish_battery(percent, state.reinterpret_as_uint(), secs_left.reinterpret_as_uint())
|
@hostpl.publish_battery(percent, state.reinterpret_as_uint(), secs_left.reinterpret_as_uint())
|
||||||
@@ -448,6 +453,7 @@ pub(all) enum HostRequest {
|
|||||||
/// 1 power off, 2 restart).
|
/// 1 power off, 2 restart).
|
||||||
SetScreenOff(Int)
|
SetScreenOff(Int)
|
||||||
SetSuspendAfter(Int)
|
SetSuspendAfter(Int)
|
||||||
|
SetBrightness(Int)
|
||||||
PowerAction(Int)
|
PowerAction(Int)
|
||||||
/// A network module's action (0 scan, 1 disconnect, 2/3 Wi-Fi off/on, 4/5 airplane mode
|
/// A network module's action (0 scan, 1 disconnect, 2/3 Wi-Fi off/on, 4/5 airplane mode
|
||||||
/// off/on, 6 connect, 7 forget), with the network name and password where it needs them.
|
/// off/on, 6 connect, 7 forget), with the network name and password where it needs them.
|
||||||
@@ -487,6 +493,7 @@ pub fn next_request() -> HostRequest? {
|
|||||||
Some(Screenshot(code)) => Some(Screenshot(code))
|
Some(Screenshot(code)) => Some(Screenshot(code))
|
||||||
Some(SetScreenOff(m)) => Some(SetScreenOff(m))
|
Some(SetScreenOff(m)) => Some(SetScreenOff(m))
|
||||||
Some(SetSuspendAfter(m)) => Some(SetSuspendAfter(m))
|
Some(SetSuspendAfter(m)) => Some(SetSuspendAfter(m))
|
||||||
|
Some(SetBrightness(p)) => Some(SetBrightness(p))
|
||||||
Some(PowerAction(a)) => Some(PowerAction(a))
|
Some(PowerAction(a)) => Some(PowerAction(a))
|
||||||
Some(Network(r)) => Some(Network(r.action, r.ssid, r.password))
|
Some(Network(r)) => Some(Network(r.action, r.ssid, r.password))
|
||||||
Some(Shortcut(code)) => Some(Shortcut(code))
|
Some(Shortcut(code)) => Some(Shortcut(code))
|
||||||
|
|||||||
@@ -817,6 +817,11 @@ pub fn publish_power(screen_off : Int, suspend : Int) -> Unit {
|
|||||||
c_host_set_int(6, suspend)
|
c_host_set_int(6, suspend)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///| Publish current display backlight brightness percentage (0..100, or -1 if none).
|
||||||
|
pub fn publish_brightness(percent : Int) -> Unit {
|
||||||
|
c_host_set_int(10, percent)
|
||||||
|
}
|
||||||
|
|
||||||
///| Publish the battery (the `battery` capability): percent (-1: none), charge-state index,
|
///| Publish the battery (the `battery` capability): percent (-1: none), charge-state index,
|
||||||
/// seconds left (0: unknown).
|
/// seconds left (0: unknown).
|
||||||
pub fn publish_battery(percent : Int, state : Int, secs_left : Int) -> Unit {
|
pub fn publish_battery(percent : Int, state : Int, secs_left : Int) -> Unit {
|
||||||
@@ -846,6 +851,7 @@ pub(all) enum HostRequest {
|
|||||||
/// 1 power off, 2 restart).
|
/// 1 power off, 2 restart).
|
||||||
SetScreenOff(Int)
|
SetScreenOff(Int)
|
||||||
SetSuspendAfter(Int)
|
SetSuspendAfter(Int)
|
||||||
|
SetBrightness(Int)
|
||||||
PowerAction(Int)
|
PowerAction(Int)
|
||||||
/// A network module's action (0 scan, 1 disconnect, 2/3 Wi-Fi off/on, 4/5 airplane mode
|
/// A network module's action (0 scan, 1 disconnect, 2/3 Wi-Fi off/on, 4/5 airplane mode
|
||||||
/// off/on, 6 connect, 7 forget), with the network name and password where it needs them.
|
/// off/on, 6 connect, 7 forget), with the network name and password where it needs them.
|
||||||
@@ -906,6 +912,7 @@ pub fn next_request() -> HostRequest? {
|
|||||||
}
|
}
|
||||||
18 => Some(Shortcut(c_host_req_int()))
|
18 => Some(Shortcut(c_host_req_int()))
|
||||||
19 => Some(DefaultApp(c_host_req_int()))
|
19 => Some(DefaultApp(c_host_req_int()))
|
||||||
|
20 => Some(SetBrightness(c_host_req_int()))
|
||||||
40 => Some(SetDesktop(c_host_req_int()))
|
40 => Some(SetDesktop(c_host_req_int()))
|
||||||
44 => Some(FaceUnlock(c_host_req_int()))
|
44 => Some(FaceUnlock(c_host_req_int()))
|
||||||
45 => {
|
45 => {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ enum {
|
|||||||
K_SESSION_SETTINGS, K_SESSION_IS_ON, K_SESSION_SET,
|
K_SESSION_SETTINGS, K_SESSION_IS_ON, K_SESSION_SET,
|
||||||
K_APP_ICON,
|
K_APP_ICON,
|
||||||
K_SHOT_TAKE, K_SHOT_RECORD, K_SHOT_STOP, K_SHOT_IS_REC, K_SHOT_PTR, K_SHOT_SET_PTR,
|
K_SHOT_TAKE, K_SHOT_RECORD, K_SHOT_STOP, K_SHOT_IS_REC, K_SHOT_PTR, K_SHOT_SET_PTR,
|
||||||
K_PW_SCREEN, K_PW_SET_SCREEN, K_PW_SUSP, K_PW_SET_SUSP, K_PW_SUSPEND, K_PW_OFF, K_PW_REBOOT,
|
K_PW_SCREEN, K_PW_SET_SCREEN, K_PW_SUSP, K_PW_SET_SUSP, K_PW_BRIGHTNESS, K_PW_SET_BRIGHTNESS, K_PW_SUSPEND, K_PW_OFF, K_PW_REBOOT,
|
||||||
K_BAT_READ,
|
K_BAT_READ,
|
||||||
K_NET_STATUS, K_NET_LIST, K_NET_SCAN, K_NET_CONNECT, K_NET_DISCONNECT, K_NET_FORGET, K_NET_SET_WIFI,
|
K_NET_STATUS, K_NET_LIST, K_NET_SCAN, K_NET_CONNECT, K_NET_DISCONNECT, K_NET_FORGET, K_NET_SET_WIFI,
|
||||||
K_NET_SET_AIRPLANE,
|
K_NET_SET_AIRPLANE,
|
||||||
@@ -81,10 +81,11 @@ enum { T_APPS, T_WINDOWS, T_LAYOUTS, T_MODULES, T_INSTANCES, T_WALLPAPERS, T_SES
|
|||||||
T_GL_STATUS = 26, T_GL_GAMES = 27, T_GL_MODES = 28, T_N = 32 };
|
T_GL_STATUS = 26, T_GL_GAMES = 27, T_GL_MODES = 28, T_N = 32 };
|
||||||
typedef struct { uint8_t *data; size_t len; } Blob;
|
typedef struct { uint8_t *data; size_t len; } Blob;
|
||||||
static Blob tables[T_N];
|
static Blob tables[T_N];
|
||||||
static int32_t host_ints[24] = {[7] = -1}; /* 0 layout mode, 1 inspector on, 2 current wallpaper, 3 session settings on (bit i: row i),
|
static int32_t host_ints[24] = {[7] = -1, [10] = -1}; /* 0 layout mode, 1 inspector on, 2 current wallpaper, 3 session settings on (bit i: row i),
|
||||||
4 screenshot state (bit 0 recording, bit 1 pointer in recordings),
|
4 screenshot state (bit 0 recording, bit 1 pointer in recordings),
|
||||||
5 screen-off minutes, 6 suspend minutes (0: never),
|
5 screen-off minutes, 6 suspend minutes (0: never),
|
||||||
7 battery percent (-1: none), 8 battery charge-state, 9 battery seconds left */
|
7 battery percent (-1: none), 8 battery charge-state, 9 battery seconds left,
|
||||||
|
10 backlight brightness percent (-1: none) */
|
||||||
|
|
||||||
/* ---- requests a guest made of the host (launch, focus, ...) ; drained by the shell after each call ---- */
|
/* ---- requests a guest made of the host (launch, focus, ...) ; drained by the shell after each call ---- */
|
||||||
typedef struct { int kind; int32_t n; char *s; } Req;
|
typedef struct { int kind; int32_t n; char *s; } Req;
|
||||||
@@ -436,6 +437,10 @@ static wasm_trap_t *host_import(void *env, const wasm_val_vec_t *args, wasm_val_
|
|||||||
break;
|
break;
|
||||||
case K_PW_SET_SCREEN: push_req(13, a0, NULL); break;
|
case K_PW_SET_SCREEN: push_req(13, a0, NULL); break;
|
||||||
case K_PW_SET_SUSP: push_req(14, a0, NULL); break;
|
case K_PW_SET_SUSP: push_req(14, a0, NULL); break;
|
||||||
|
case K_PW_BRIGHTNESS:
|
||||||
|
if (results->size >= 1) results->data[0] = (wasm_val_t)WASM_I32_VAL(host_ints[10]);
|
||||||
|
break;
|
||||||
|
case K_PW_SET_BRIGHTNESS: push_req(20, a0, NULL); break;
|
||||||
case K_PW_SUSPEND: push_req(15, 0, NULL); break; /* 15: power action n (0 suspend, 1 off, 2 restart) */
|
case K_PW_SUSPEND: push_req(15, 0, NULL); break; /* 15: power action n (0 suspend, 1 off, 2 restart) */
|
||||||
case K_PW_OFF: push_req(15, 1, NULL); break;
|
case K_PW_OFF: push_req(15, 1, NULL); break;
|
||||||
case K_PW_REBOOT: push_req(15, 2, NULL); break;
|
case K_PW_REBOOT: push_req(15, 2, NULL); break;
|
||||||
@@ -665,6 +670,8 @@ static int classify_import(const wasm_name_t *m, const wasm_name_t *f) {
|
|||||||
if (!strcmp(iface, "power") && !strcmp(fn, "set-screen-off-minutes")) return K_PW_SET_SCREEN;
|
if (!strcmp(iface, "power") && !strcmp(fn, "set-screen-off-minutes")) return K_PW_SET_SCREEN;
|
||||||
if (!strcmp(iface, "power") && !strcmp(fn, "suspend-minutes")) return K_PW_SUSP;
|
if (!strcmp(iface, "power") && !strcmp(fn, "suspend-minutes")) return K_PW_SUSP;
|
||||||
if (!strcmp(iface, "power") && !strcmp(fn, "set-suspend-minutes")) return K_PW_SET_SUSP;
|
if (!strcmp(iface, "power") && !strcmp(fn, "set-suspend-minutes")) return K_PW_SET_SUSP;
|
||||||
|
if (!strcmp(iface, "power") && !strcmp(fn, "brightness")) return K_PW_BRIGHTNESS;
|
||||||
|
if (!strcmp(iface, "power") && !strcmp(fn, "set-brightness")) return K_PW_SET_BRIGHTNESS;
|
||||||
if (!strcmp(iface, "power") && !strcmp(fn, "suspend")) return K_PW_SUSPEND;
|
if (!strcmp(iface, "power") && !strcmp(fn, "suspend")) return K_PW_SUSPEND;
|
||||||
if (!strcmp(iface, "power") && !strcmp(fn, "power-off")) return K_PW_OFF;
|
if (!strcmp(iface, "power") && !strcmp(fn, "power-off")) return K_PW_OFF;
|
||||||
if (!strcmp(iface, "power") && !strcmp(fn, "reboot")) return K_PW_REBOOT;
|
if (!strcmp(iface, "power") && !strcmp(fn, "reboot")) return K_PW_REBOOT;
|
||||||
|
|||||||
@@ -36,3 +36,12 @@ Chandra includes KMS/libinput/compositor adaptations tailored for mainline Linux
|
|||||||
## Keyring Unlock
|
## Keyring Unlock
|
||||||
|
|
||||||
- [`session/chandra-session`](../session/chandra-session) starts `gnome-keyring-daemon --start --components=secrets` and unlocks an unencrypted default `login.keyring` at login over D-Bus (`org.freedesktop.Secret.Service.Unlock`) so apps such as Chromium store credentials without blocking prompts.
|
- [`session/chandra-session`](../session/chandra-session) starts `gnome-keyring-daemon --start --components=secrets` and unlocks an unencrypted default `login.keyring` at login over D-Bus (`org.freedesktop.Secret.Service.Unlock`) so apps such as Chromium store credentials without blocking prompts.
|
||||||
|
|
||||||
|
## Power Button & Brightness
|
||||||
|
|
||||||
|
- **Power key blank/wake:** Pressing `KEY_POWER` (`116`) in [`compositor/host/compositor.mbt`](../compositor/host/compositor.mbt) toggles manual screen blanking (`DPMS` off/on + touch cancellation in [`compositor/kms/kms_stub.c`](../compositor/kms/kms_stub.c)) while ignoring stray touches during blanking. Also controllable via `chandra-ctl screen [on|off|toggle|status]`. (Set `HandlePowerKey=ignore` in `/etc/systemd/logind.conf.d/` so `logind` does not power off immediately.)
|
||||||
|
- **Settings Brightness slider:** [`compositor/shell/backlight.mbt`](../compositor/shell/backlight.mbt) reads `/sys/class/backlight/` (`ae94000.dsi.0`, `CHANDRA_BACKLIGHT` override) and writes changes via sysfs or `org.freedesktop.login1.Session.SetBrightness`. When a backlight device exists, **Settings > Power > Brightness** shows a `-` / slider / `+` control (`5%..100%`), also accessible via `chandra-ctl brightness [PCT|status]`.
|
||||||
|
|
||||||
|
## Face Unlock (`libcamera`)
|
||||||
|
|
||||||
|
- On phones whose MIPI sensors (`imx371`, `imx519`, `imx376`) require `libcamera` SoftISP rather than raw V4L2 nodes, [`face/chandra-face`](../face/chandra-face) supports `libcamera:<camera-id>` entries via `python-libcamera` and applies `libcamera.properties.Rotation`. [`face/install.py`](../face/install.py) supports `--system-python` to run with system `python-opencv` + `python-numpy` on `aarch64`, and [`face/polkit-agent-helper.conf`](../face/polkit-agent-helper.conf) grants `char-video4linux`, `char-media`, and `char-dma_heap` access to polkit's helper sandbox.
|
||||||
+146
-4
@@ -439,10 +439,28 @@ def query_camera(path):
|
|||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
|
||||||
|
|
||||||
|
def list_libcameras():
|
||||||
|
"""[(libcamera:id, label, '')] for cameras exposed through libcamera."""
|
||||||
|
try:
|
||||||
|
import libcamera
|
||||||
|
except ImportError:
|
||||||
|
return []
|
||||||
|
out = []
|
||||||
|
cm = libcamera.CameraManager.singleton()
|
||||||
|
loc_names = {0: "Front", 1: "Back", 2: "External"}
|
||||||
|
for cam in cm.cameras:
|
||||||
|
props = cam.properties
|
||||||
|
loc = loc_names.get(props.get(libcamera.properties.Location), "")
|
||||||
|
model = str(props.get(libcamera.properties.Model) or cam.id)
|
||||||
|
label = "%s camera (%s)" % (loc, model) if loc else model
|
||||||
|
out.append(("libcamera:" + cam.id, label, ""))
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
def list_cameras():
|
def list_cameras():
|
||||||
"""[(path, name, why not or "")]: the /dev/v4l/by-id links, then /dev/video* nodes no link
|
"""[(path, name, why not or '')]: libcamera cameras, /dev/v4l/by-id links, then /dev/video*."""
|
||||||
points at."""
|
out = list_libcameras()
|
||||||
out, seen = [], set()
|
seen = set()
|
||||||
for p in sorted(glob.glob("/dev/v4l/by-id/*")):
|
for p in sorted(glob.glob("/dev/v4l/by-id/*")):
|
||||||
seen.add(os.path.realpath(p))
|
seen.add(os.path.realpath(p))
|
||||||
out.append((p,) + query_camera(p))
|
out.append((p,) + query_camera(p))
|
||||||
@@ -460,9 +478,19 @@ def cameras_text(cams):
|
|||||||
|
|
||||||
|
|
||||||
def camera_problem(device):
|
def camera_problem(device):
|
||||||
"""Why the configured camera can't be used, or "" (only checks the node, not streaming)."""
|
"""Why the configured camera can't be used, or '' (only checks the node, not streaming)."""
|
||||||
if device.startswith("images:"):
|
if device.startswith("images:"):
|
||||||
return ""
|
return ""
|
||||||
|
if device.startswith("libcamera:"):
|
||||||
|
cid = device[len("libcamera:"):]
|
||||||
|
try:
|
||||||
|
import libcamera
|
||||||
|
except ImportError:
|
||||||
|
return "python-libcamera is not installed (cannot open %s)" % device
|
||||||
|
cm = libcamera.CameraManager.singleton()
|
||||||
|
if cm.get(cid) is None:
|
||||||
|
return "no libcamera camera %s; %s" % (cid, cameras_text(list_cameras()))
|
||||||
|
return ""
|
||||||
path = "/dev/video" + device if device.isdigit() else device
|
path = "/dev/video" + device if device.isdigit() else device
|
||||||
if not os.path.exists(path):
|
if not os.path.exists(path):
|
||||||
why = "broken link" if os.path.islink(path) else "not there"
|
why = "broken link" if os.path.islink(path) else "not there"
|
||||||
@@ -475,6 +503,112 @@ def camera_problem(device):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
class LibcameraCamera:
|
||||||
|
"""Capture BGR frames via python-libcamera (MIPI/SoftISP phone cameras)."""
|
||||||
|
|
||||||
|
def __init__(self, device):
|
||||||
|
problem = camera_problem(device)
|
||||||
|
if problem:
|
||||||
|
raise Fail(problem, 2)
|
||||||
|
import cv2
|
||||||
|
import libcamera
|
||||||
|
import mmap
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
self.cv2, self.libcamera, self.mmap, self.np = cv2, libcamera, mmap, np
|
||||||
|
cid = device[len("libcamera:"):]
|
||||||
|
self.cm = libcamera.CameraManager.singleton()
|
||||||
|
self.cam = self.cm.get(cid)
|
||||||
|
if self.cam is None:
|
||||||
|
raise Fail("camera %s disappeared" % device, 2)
|
||||||
|
self.rot = int(self.cam.properties.get(libcamera.properties.Rotation) or 0)
|
||||||
|
try:
|
||||||
|
self.cam.acquire()
|
||||||
|
except Exception as e:
|
||||||
|
raise Fail("couldn't acquire camera %s: %s" % (device, e), 2)
|
||||||
|
try:
|
||||||
|
cfg = self.cam.generate_configuration([libcamera.StreamRole.Viewfinder])
|
||||||
|
self.sc = cfg.at(0)
|
||||||
|
self.sc.size = libcamera.Size(640, 480)
|
||||||
|
cfg.validate()
|
||||||
|
self.cam.configure(cfg)
|
||||||
|
self.alloc = libcamera.FrameBufferAllocator(self.cam)
|
||||||
|
if self.alloc.allocate(self.sc.stream) <= 0:
|
||||||
|
raise Fail("couldn't allocate camera buffers for %s" % device, 2)
|
||||||
|
self.requests = []
|
||||||
|
for buf in self.alloc.buffers(self.sc.stream):
|
||||||
|
r = self.cam.create_request()
|
||||||
|
r.add_buffer(self.sc.stream, buf)
|
||||||
|
self.requests.append(r)
|
||||||
|
self.cam.start()
|
||||||
|
for r in self.requests:
|
||||||
|
self.cam.queue_request(r)
|
||||||
|
except Exception as e:
|
||||||
|
self.close()
|
||||||
|
if isinstance(e, Fail):
|
||||||
|
raise
|
||||||
|
raise Fail("couldn't start libcamera %s: %s" % (device, e), 2)
|
||||||
|
self._first = True
|
||||||
|
|
||||||
|
def _to_bgr(self, buf):
|
||||||
|
p = buf.planes[0]
|
||||||
|
w, h, stride = self.sc.size.width, self.sc.size.height, self.sc.stride
|
||||||
|
fmt = str(self.sc.pixel_format)
|
||||||
|
with self.mmap.mmap(p.fd, p.offset + p.length, self.mmap.MAP_SHARED, self.mmap.PROT_READ) as mm:
|
||||||
|
raw = bytes(mm[p.offset:p.offset + p.length])
|
||||||
|
arr = self.np.frombuffer(raw, dtype=self.np.uint8)
|
||||||
|
if fmt in ("ABGR8888", "XBGR8888", "ARGB8888", "XRGB8888"):
|
||||||
|
img = arr[:h * stride].reshape((h, stride // 4, 4))[:, :w, :3]
|
||||||
|
bgr = self.np.ascontiguousarray(img[:, :, ::-1]) if "BGR" in fmt else self.np.ascontiguousarray(img)
|
||||||
|
elif fmt in ("RGB888", "BGR888"):
|
||||||
|
img = arr[:h * stride].reshape((h, stride // 3, 3))[:, :w, :]
|
||||||
|
bgr = self.np.ascontiguousarray(img[:, :, ::-1]) if fmt == "RGB888" else self.np.ascontiguousarray(img)
|
||||||
|
else:
|
||||||
|
raise Fail("unsupported libcamera pixel format %s" % fmt, 2)
|
||||||
|
if self.rot == 90:
|
||||||
|
return self.cv2.rotate(bgr, self.cv2.ROTATE_90_CLOCKWISE)
|
||||||
|
if self.rot == 180:
|
||||||
|
return self.cv2.rotate(bgr, self.cv2.ROTATE_180)
|
||||||
|
if self.rot == 270:
|
||||||
|
return self.cv2.rotate(bgr, self.cv2.ROTATE_90_COUNTERCLOCKWISE)
|
||||||
|
return bgr
|
||||||
|
|
||||||
|
def read(self):
|
||||||
|
timeout = 3.0 if self._first else 1.5
|
||||||
|
self._first = False
|
||||||
|
deadline = time.monotonic() + timeout
|
||||||
|
while time.monotonic() < deadline:
|
||||||
|
ready = self.cm.get_ready_requests()
|
||||||
|
if ready:
|
||||||
|
for old in ready[:-1]:
|
||||||
|
old.reuse(self.libcamera.Request.ReuseFlag.ReuseBuffers)
|
||||||
|
self.cam.queue_request(old)
|
||||||
|
req = ready[-1]
|
||||||
|
frame = None
|
||||||
|
try:
|
||||||
|
if req.status == self.libcamera.Request.Status.Complete:
|
||||||
|
frame = self._to_bgr(req.buffers[self.sc.stream])
|
||||||
|
finally:
|
||||||
|
req.reuse(self.libcamera.Request.ReuseFlag.ReuseBuffers)
|
||||||
|
self.cam.queue_request(req)
|
||||||
|
if frame is not None:
|
||||||
|
return frame
|
||||||
|
time.sleep(0.01)
|
||||||
|
return None
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
try:
|
||||||
|
self.cam.stop()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
self.requests = []
|
||||||
|
self.alloc = None
|
||||||
|
try:
|
||||||
|
self.cam.release()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class V4L2Camera:
|
class V4L2Camera:
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
problem = camera_problem(device)
|
problem = camera_problem(device)
|
||||||
@@ -502,6 +636,8 @@ class V4L2Camera:
|
|||||||
def open_camera(cfg, loop=False):
|
def open_camera(cfg, loop=False):
|
||||||
if cfg.device.startswith("images:"):
|
if cfg.device.startswith("images:"):
|
||||||
return ImageCamera(cfg.device, cfg, loop)
|
return ImageCamera(cfg.device, cfg, loop)
|
||||||
|
if cfg.device.startswith("libcamera:"):
|
||||||
|
return LibcameraCamera(cfg.device)
|
||||||
return V4L2Camera(cfg.device)
|
return V4L2Camera(cfg.device)
|
||||||
|
|
||||||
|
|
||||||
@@ -1008,6 +1144,12 @@ def cmd_cameras(out):
|
|||||||
|
|
||||||
def cmd_set_camera(cfg, path, out):
|
def cmd_set_camera(cfg, path, out):
|
||||||
"""Point face.conf's `device` at `path` (root), after checking it is a camera."""
|
"""Point face.conf's `device` at `path` (root), after checking it is a camera."""
|
||||||
|
if path.startswith("libcamera:"):
|
||||||
|
why = camera_problem(path)
|
||||||
|
if why:
|
||||||
|
raise Fail(why)
|
||||||
|
name = next((n for p, n, _ in list_libcameras() if p == path), path)
|
||||||
|
else:
|
||||||
if not path.startswith("/dev/") or not os.path.exists(path):
|
if not path.startswith("/dev/") or not os.path.exists(path):
|
||||||
raise Fail("no camera at %s" % path)
|
raise Fail("no camera at %s" % path)
|
||||||
name, why = query_camera(path)
|
name, why = query_camera(path)
|
||||||
|
|||||||
+15
-4
@@ -64,11 +64,22 @@ def find_pixi():
|
|||||||
|
|
||||||
|
|
||||||
def make_env():
|
def make_env():
|
||||||
"""The root-owned pixi environment the helper and the PAM module run; its python3."""
|
"""The Python environment the helper and PAM module run; its python3."""
|
||||||
pixi = find_pixi()
|
sys_py = shutil.which("python3") or "/usr/bin/python3"
|
||||||
|
use_sys = "--system-python" in sys.argv
|
||||||
|
pixi = None if use_sys else find_pixi()
|
||||||
if not pixi:
|
if not pixi:
|
||||||
sys.exit("pixi not found: install it (https://pixi.sh) or pass --pixi PATH; "
|
if os.access(sys_py, os.X_OK) and subprocess.run(
|
||||||
"`just install` passes the one on your PATH")
|
[sys_py, "-I", "-c", "import cv2, numpy"],
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
).returncode == 0:
|
||||||
|
print("using system Python", sys_py, "(OpenCV, numpy)")
|
||||||
|
return sys_py
|
||||||
|
if use_sys:
|
||||||
|
sys.exit("--system-python asked, but %s cannot import cv2, numpy" % sys_py)
|
||||||
|
sys.exit("pixi not found: install it (https://pixi.sh) or pass --pixi PATH, "
|
||||||
|
"or install system python-opencv + python-numpy and pass --system-python")
|
||||||
os.makedirs(env_dir, 0o755, exist_ok=True)
|
os.makedirs(env_dir, 0o755, exist_ok=True)
|
||||||
for f in ("pixi.toml", "pixi.lock"):
|
for f in ("pixi.toml", "pixi.lock"):
|
||||||
shutil.copyfile(os.path.join(here, f), os.path.join(env_dir, f))
|
shutil.copyfile(os.path.join(here, f), os.path.join(env_dir, f))
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
# gives it a /dev with no cameras, so pam_chandra_face.so could never see one there.
|
# gives it a /dev with no cameras, so pam_chandra_face.so could never see one there.
|
||||||
[Service]
|
[Service]
|
||||||
PrivateDevices=no
|
PrivateDevices=no
|
||||||
# Of the real /dev, only the standard pseudo devices and cameras can be opened.
|
# Of the real /dev, only the standard pseudo devices and cameras (V4L2, media, dma_heap) can be opened.
|
||||||
DevicePolicy=closed
|
DevicePolicy=closed
|
||||||
DeviceAllow=char-video4linux rw
|
DeviceAllow=char-video4linux rw
|
||||||
|
DeviceAllow=char-media rw
|
||||||
|
DeviceAllow=char-dma_heap rw
|
||||||
# What PrivateDevices=yes also did, kept.
|
# What PrivateDevices=yes also did, kept.
|
||||||
CapabilityBoundingSet=~CAP_MKNOD CAP_SYS_RAWIO
|
CapabilityBoundingSet=~CAP_MKNOD CAP_SYS_RAWIO
|
||||||
SystemCallFilter=~@raw-io
|
SystemCallFilter=~@raw-io
|
||||||
@@ -11,8 +11,8 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
@@ -22,6 +22,6 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -3,26 +3,6 @@
|
|||||||
///|
|
///|
|
||||||
fn wasmImportLaunch(p0 : Int, p1 : Int, p2 : Int) = "chandra:desktop/app-launch@0.1.0" "launch"
|
fn wasmImportLaunch(p0 : Int, p1 : Int, p2 : Int) = "chandra:desktop/app-launch@0.1.0" "launch"
|
||||||
|
|
||||||
///|
|
|
||||||
#owned(str)
|
|
||||||
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
|
||||||
#|(func (param i32) (result i32) 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 =
|
|
||||||
#|(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)
|
||||||
@@ -30,7 +10,27 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| 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)
|
||||||
|
|
||||||
|
///|
|
||||||
|
#owned(str)
|
||||||
|
extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -4,12 +4,8 @@
|
|||||||
fn wasmImportRead(p0 : Int) = "chandra:desktop/battery@0.1.0" "read"
|
fn wasmImportRead(p0 : Int) = "chandra:desktop/battery@0.1.0" "read"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(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 =
|
||||||
@@ -19,6 +15,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(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)
|
||||||
|
|
||||||
@@ -3,14 +3,14 @@
|
|||||||
///|
|
///|
|
||||||
fn wasmImportNow(p0 : Int) = "chandra:desktop/clock@0.1.0" "now"
|
fn wasmImportNow(p0 : Int) = "chandra:desktop/clock@0.1.0" "now"
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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)
|
||||||
|
|||||||
@@ -12,18 +12,17 @@ fn wasmImportSetDefault(p0 : Int, p1 : Int) = "chandra:desktop/default-apps@0.1
|
|||||||
///|
|
///|
|
||||||
fn wasmImportRefresh() = "chandra:desktop/default-apps@0.1.0" "refresh"
|
fn wasmImportRefresh() = "chandra:desktop/default-apps@0.1.0" "refresh"
|
||||||
|
|
||||||
///|
|
|
||||||
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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -32,9 +31,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| local.get 0)
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
@@ -18,14 +18,6 @@ fn wasmImportSetInUse(p0 : Int) = "chandra:desktop/face-unlock@0.1.0" "set-in-u
|
|||||||
///|
|
///|
|
||||||
fn wasmImportRefresh() = "chandra:desktop/face-unlock@0.1.0" "refresh"
|
fn wasmImportRefresh() = "chandra:desktop/face-unlock@0.1.0" "refresh"
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
@@ -33,10 +25,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
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)
|
||||||
@@ -44,3 +32,15 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| 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)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
@@ -22,22 +22,14 @@ fn wasmImportFocus(p0 : Int, p1 : Int) = "chandra:desktop/game-library@0.1.0" "
|
|||||||
fn wasmImportRefresh() = "chandra:desktop/game-library@0.1.0" "refresh"
|
fn wasmImportRefresh() = "chandra:desktop/game-library@0.1.0" "refresh"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_load8_u(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -52,3 +44,11 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -3,12 +3,12 @@
|
|||||||
///|
|
///|
|
||||||
fn wasmImportAppIcon(p0 : Int, p1 : Int) -> Int = "chandra:desktop/icons@0.1.0" "app-icon"
|
fn wasmImportAppIcon(p0 : Int, p1 : Int) -> Int = "chandra:desktop/icons@0.1.0" "app-icon"
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
@@ -10,12 +10,15 @@ fn wasmImportCurrentLayout() -> Int = "chandra:desktop/layout-control@0.1.0" "cu
|
|||||||
fn wasmImportSetLayout(p0 : Int) = "chandra:desktop/layout-control@0.1.0" "set-layout"
|
fn wasmImportSetLayout(p0 : Int) = "chandra:desktop/layout-control@0.1.0" "set-layout"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(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_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(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 =
|
||||||
@@ -25,9 +28,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
|
||||||
#| local.get 0)
|
|
||||||
|
|
||||||
@@ -19,25 +19,25 @@ fn wasmImportMoveInstance(p0 : Int, p1 : Int, p2 : Int) = "chandra:desktop/modu
|
|||||||
fn wasmImportBrowse() = "chandra:desktop/modules@0.1.0" "browse"
|
fn wasmImportBrowse() = "chandra:desktop/modules@0.1.0" "browse"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(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)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
|
|||||||
@@ -24,14 +24,18 @@ fn wasmImportSetWifiEnabled(p0 : Int) = "chandra:desktop/network@0.1.0" "set-wi
|
|||||||
///|
|
///|
|
||||||
fn wasmImportSetAirplaneMode(p0 : Int) = "chandra:desktop/network@0.1.0" "set-airplane-mode"
|
fn wasmImportSetAirplaneMode(p0 : Int) = "chandra:desktop/network@0.1.0" "set-airplane-mode"
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
#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_free(position : Int) =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -40,10 +44,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
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)
|
||||||
@@ -52,6 +52,6 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
@@ -12,6 +12,12 @@ fn wasmImportSuspendMinutes() -> Int = "chandra:desktop/power@0.1.0" "suspend-mi
|
|||||||
///|
|
///|
|
||||||
fn wasmImportSetSuspendMinutes(p0 : Int) = "chandra:desktop/power@0.1.0" "set-suspend-minutes"
|
fn wasmImportSetSuspendMinutes(p0 : Int) = "chandra:desktop/power@0.1.0" "set-suspend-minutes"
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn wasmImportBrightness() -> Int = "chandra:desktop/power@0.1.0" "brightness"
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn wasmImportSetBrightness(p0 : Int) = "chandra:desktop/power@0.1.0" "set-brightness"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn wasmImportSuspend() = "chandra:desktop/power@0.1.0" "suspend"
|
fn wasmImportSuspend() = "chandra:desktop/power@0.1.0" "suspend"
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,22 @@ pub fn set_suspend_minutes(minutes : UInt) -> Unit {
|
|||||||
|
|
||||||
wasmImportSetSuspendMinutes((minutes).reinterpret_as_int());
|
wasmImportSetSuspendMinutes((minutes).reinterpret_as_int());
|
||||||
|
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
/// Current display backlight brightness in 0..100, or -1 if no backlight exists.
|
||||||
|
pub fn brightness() -> Int {
|
||||||
|
|
||||||
|
let result : Int = wasmImportBrightness();
|
||||||
|
let ret = result
|
||||||
|
return ret
|
||||||
|
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
/// Set display backlight brightness percentage (clamped to 5..100).
|
||||||
|
pub fn set_brightness(percent : UInt) -> Unit {
|
||||||
|
|
||||||
|
wasmImportSetBrightness((percent).reinterpret_as_int());
|
||||||
|
|
||||||
}
|
}
|
||||||
///|
|
///|
|
||||||
/// Suspend, power off or restart now.
|
/// Suspend, power off or restart now.
|
||||||
|
|||||||
@@ -17,17 +17,17 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
#| 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_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) =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(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)
|
||||||
|
|
||||||
@@ -15,6 +15,14 @@ fn wasmImportReset(p0 : Int) = "chandra:desktop/shortcuts@0.1.0" "reset"
|
|||||||
///|
|
///|
|
||||||
fn wasmImportResetAll() = "chandra:desktop/shortcuts@0.1.0" "reset-all"
|
fn wasmImportResetAll() = "chandra:desktop/shortcuts@0.1.0" "reset-all"
|
||||||
|
|
||||||
|
///|
|
||||||
|
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 =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) (local i32)
|
||||||
@@ -22,14 +30,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.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_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)
|
||||||
@@ -38,6 +38,6 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 0)
|
#| local.get 0)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
@@ -3,6 +3,14 @@
|
|||||||
///|
|
///|
|
||||||
fn wasmImportRead(p0 : Int) = "chandra:desktop/system@0.1.0" "read"
|
fn wasmImportRead(p0 : Int) = "chandra:desktop/system@0.1.0" "read"
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
||||||
|
#|(func (param i32) (result i64) local.get 0 i64.load)
|
||||||
|
|
||||||
|
///|
|
||||||
|
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
||||||
|
#|(func (param i32) (result i32) local.get 0 i32.load)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -11,18 +19,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
|
||||||
#|(func (param i32) (result i64) local.get 0 i64.load)
|
|
||||||
|
|
||||||
///|
|
|
||||||
extern "wasm" fn mbt_ffi_free(position : Int) =
|
|
||||||
#|(func (param i32) local.get 0 call $moonbit.decref)
|
|
||||||
|
|
||||||
@@ -7,13 +7,6 @@ fn wasmImportGetTokens(p0 : Int) = "chandra:desktop/theme@0.1.0" "get-tokens"
|
|||||||
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)
|
|
||||||
|
|
||||||
///|
|
///|
|
||||||
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)
|
||||||
@@ -25,6 +18,13 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
#| local.tee 1 i32.const 0 call $moonbit.init_array8
|
||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
|
///|
|
||||||
|
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_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|||||||
@@ -18,17 +18,6 @@ fn wasmImportCurrentDesktop() -> Int = "chandra:desktop/wallpaper@0.1.0" "curren
|
|||||||
///|
|
///|
|
||||||
fn wasmImportSetDesktop(p0 : Int) = "chandra:desktop/wallpaper@0.1.0" "set-desktop"
|
fn wasmImportSetDesktop(p0 : Int) = "chandra:desktop/wallpaper@0.1.0" "set-desktop"
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
@@ -40,3 +29,14 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| 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_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)
|
||||||
|
|
||||||
@@ -13,8 +13,11 @@ fn wasmImportAll(p0 : Int) = "chandra:desktop/windows@0.1.0" "all"
|
|||||||
fn wasmImportFocus(p0 : Int64) = "chandra:desktop/windows@0.1.0" "focus"
|
fn wasmImportFocus(p0 : Int64) = "chandra:desktop/windows@0.1.0" "focus"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(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 =
|
||||||
@@ -23,22 +26,19 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
|||||||
#| local.get 1 call $moonbit.init_array16
|
#| local.get 1 call $moonbit.init_array16
|
||||||
#| local.get 0)
|
#| 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_load64(offset : Int) -> Int64 =
|
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
|
||||||
#|(func (param i32) (result i64) local.get 0 i64.load)
|
#|(func (param i32) (result i64) local.get 0 i64.load)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
||||||
#|(func (param i32) (result i32) (local i32)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
#| 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_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)
|
||||||
|
|
||||||
@@ -51,6 +51,9 @@ fn wasmImportPublishSessionSettings(p0 : Int) = "chandra:host/plasmoids@0.1.0"
|
|||||||
///|
|
///|
|
||||||
fn wasmImportPublishPower(p0 : Int, p1 : Int) = "chandra:host/plasmoids@0.1.0" "publish-power"
|
fn wasmImportPublishPower(p0 : Int, p1 : Int) = "chandra:host/plasmoids@0.1.0" "publish-power"
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn wasmImportPublishBrightness(p0 : Int) = "chandra:host/plasmoids@0.1.0" "publish-brightness"
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn wasmImportPublishBattery(p0 : Int, p1 : Int, p2 : Int) = "chandra:host/plasmoids@0.1.0" "publish-battery"
|
fn wasmImportPublishBattery(p0 : Int, p1 : Int, p2 : Int) = "chandra:host/plasmoids@0.1.0" "publish-battery"
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,11 @@ fn wasmImportPublishPower(p0 : Int, p1 : Int) -> Unit {
|
|||||||
abort("wasm-only host import")
|
abort("wasm-only host import")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///|
|
||||||
|
fn wasmImportPublishBrightness(p0 : Int) -> Unit {
|
||||||
|
abort("wasm-only host import")
|
||||||
|
}
|
||||||
|
|
||||||
///|
|
///|
|
||||||
fn wasmImportPublishBattery(p0 : Int, p1 : Int, p2 : Int) -> Unit {
|
fn wasmImportPublishBattery(p0 : Int, p1 : Int, p2 : Int) -> Unit {
|
||||||
abort("wasm-only host import")
|
abort("wasm-only host import")
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ pub fn publish_desktop(Int32) -> Unit
|
|||||||
|
|
||||||
pub fn publish_power(UInt32, UInt32) -> Unit
|
pub fn publish_power(UInt32, UInt32) -> Unit
|
||||||
|
|
||||||
|
pub fn publish_brightness(Int) -> Unit
|
||||||
|
|
||||||
pub fn publish_screenshot(UInt32) -> Unit
|
pub fn publish_screenshot(UInt32) -> Unit
|
||||||
|
|
||||||
pub fn publish_session_settings(UInt32) -> Unit
|
pub fn publish_session_settings(UInt32) -> Unit
|
||||||
@@ -130,6 +132,7 @@ pub(all) enum Request {
|
|||||||
SetDesktop(Int32)
|
SetDesktop(Int32)
|
||||||
FaceUnlock(Int32)
|
FaceUnlock(Int32)
|
||||||
GameLibrary(GameRequest)
|
GameLibrary(GameRequest)
|
||||||
|
SetBrightness(Int32)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(all) struct SettingChange {
|
pub(all) struct SettingChange {
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ pub(all) enum Request {
|
|||||||
SetDesktop(Int)
|
SetDesktop(Int)
|
||||||
FaceUnlock(Int)
|
FaceUnlock(Int)
|
||||||
GameLibrary(GameRequest)
|
GameLibrary(GameRequest)
|
||||||
|
SetBrightness(Int)
|
||||||
}
|
}
|
||||||
///|
|
///|
|
||||||
/// 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".
|
||||||
@@ -481,6 +482,13 @@ pub fn publish_power(screen_off : UInt, suspend : UInt) -> Unit {
|
|||||||
|
|
||||||
wasmImportPublishPower((screen_off).reinterpret_as_int(), (suspend).reinterpret_as_int());
|
wasmImportPublishPower((screen_off).reinterpret_as_int(), (suspend).reinterpret_as_int());
|
||||||
|
|
||||||
|
}
|
||||||
|
///|
|
||||||
|
/// Current display backlight brightness in 0..100, or -1 if no backlight exists.
|
||||||
|
pub fn publish_brightness(percent : Int) -> Unit {
|
||||||
|
|
||||||
|
wasmImportPublishBrightness(percent);
|
||||||
|
|
||||||
}
|
}
|
||||||
///|
|
///|
|
||||||
/// The battery: percent (-1: none), state (the battery capability's charge-state, as its index)
|
/// The battery: percent (-1: none), state (the battery capability's charge-state, as its index)
|
||||||
@@ -647,6 +655,10 @@ pub fn next_request() -> Request? {
|
|||||||
|
|
||||||
Request::GameLibrary(GameRequest::{action : mbt_ffi_load32((return_area) + 8), game : result5, mode : result6})
|
Request::GameLibrary(GameRequest::{action : mbt_ffi_load32((return_area) + 8), game : result5, mode : result6})
|
||||||
}
|
}
|
||||||
|
22 => {
|
||||||
|
|
||||||
|
Request::SetBrightness(mbt_ffi_load32((return_area) + 8))
|
||||||
|
}
|
||||||
_ => panic()
|
_ => panic()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,6 @@ fn wasmImportMethodBufferGetWithCopy(p0 : Int, p1 : Int) = "wasi-gfx:frame-buff
|
|||||||
///|
|
///|
|
||||||
fn wasmImportMethodBufferSetWithCopy(p0 : Int, p1 : Int, p2 : Int) = "wasi-gfx:frame-buffer/frame-buffer@0.2.0" "[method]buffer.set-with-copy"
|
fn wasmImportMethodBufferSetWithCopy(p0 : Int, p1 : Int, p2 : Int) = "wasi-gfx:frame-buffer/frame-buffer@0.2.0" "[method]buffer.set-with-copy"
|
||||||
|
|
||||||
///|
|
|
||||||
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_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)
|
||||||
@@ -27,6 +20,13 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> 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_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) =
|
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)
|
||||||
|
|||||||
@@ -1812,10 +1812,6 @@ fn wasmWasiGfxSurfaceSurface020MethodSurfaceOnKeyDownStream0StreamLift(handle :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
///|
|
|
||||||
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 =
|
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)
|
||||||
@@ -1825,8 +1821,11 @@ extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int =
|
|||||||
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double =
|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
||||||
#|(func (param i32) (result f64) local.get 0 f64.load)
|
#|(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 =
|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
||||||
@@ -1836,9 +1835,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
|
|||||||
#| local.get 1)
|
#| local.get 1)
|
||||||
|
|
||||||
///|
|
///|
|
||||||
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
|
extern "wasm" fn mbt_ffi_free(position : Int) =
|
||||||
#|(func (param i32) (param i32) (result i32)
|
#|(func (param i32) local.get 0 call $moonbit.decref)
|
||||||
#| local.get 0
|
|
||||||
#| local.get 1 call $moonbit.init_array16
|
///|
|
||||||
#| local.get 0)
|
extern "wasm" fn mbt_ffi_loadf64(offset : Int) -> Double =
|
||||||
|
#|(func (param i32) (result f64) local.get 0 f64.load)
|
||||||
|
|
||||||
+3
-1
@@ -11,6 +11,8 @@
|
|||||||
chandra-ctl windows how Chandra sees each window, and what is under the pointer
|
chandra-ctl windows how Chandra sees each window, and what is under the pointer
|
||||||
chandra-ctl screenshot [PATH] save a full-screen PNG directly without opening the editor
|
chandra-ctl screenshot [PATH] save a full-screen PNG directly without opening the editor
|
||||||
chandra-ctl rotate [ARG] rotate/flip display (cw, ccw, flip, 0, 90, 180, 270, status)
|
chandra-ctl rotate [ARG] rotate/flip display (cw, ccw, flip, 0, 90, 180, 270, status)
|
||||||
|
chandra-ctl screen [ARG] turn display off/on (on, off, toggle, status)
|
||||||
|
chandra-ctl brightness [ARG] get/set backlight brightness percent (5..100, status)
|
||||||
chandra-ctl auth-demo [MODE] show the password dialog with a pretend check (password "demo");
|
chandra-ctl auth-demo [MODE] show the password dialog with a pretend check (password "demo");
|
||||||
MODE: password, face, face-ok, die, slow, users (docs/auth-dialog.md)
|
MODE: password, face, face-ok, die, slow, users (docs/auth-dialog.md)
|
||||||
chandra-ctl auth-status the password dialog's agent: registered with polkit, or why not
|
chandra-ctl auth-status the password dialog's agent: registered with polkit, or why not
|
||||||
@@ -26,7 +28,7 @@ import os
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
USAGE = "usage: chandra-ctl [--socket PATH] [--quiet] {reload [NAME] | list | ping | shortcut ID | kiosk [lock|unlock|status] | launch ID | windows | screenshot [PATH] | rotate [ARG] | auth-demo [MODE] | auth-status | help}"
|
USAGE = "usage: chandra-ctl [--socket PATH] [--quiet] {reload [NAME] | list | ping | shortcut ID | kiosk [lock|unlock|status] | launch ID | windows | screenshot [PATH] | rotate [ARG] | screen [ARG] | brightness [ARG] | auth-demo [MODE] | auth-status | help}"
|
||||||
|
|
||||||
|
|
||||||
def runtime_dir():
|
def runtime_dir():
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ fn request_val(r : @wasm.HostRequest) -> @wt.Val {
|
|||||||
Screenshot(n) => Variant("screenshot", Some(S32(n)))
|
Screenshot(n) => Variant("screenshot", Some(S32(n)))
|
||||||
SetScreenOff(n) => Variant("set-screen-off", Some(S32(n)))
|
SetScreenOff(n) => Variant("set-screen-off", Some(S32(n)))
|
||||||
SetSuspendAfter(n) => Variant("set-suspend-after", Some(S32(n)))
|
SetSuspendAfter(n) => Variant("set-suspend-after", Some(S32(n)))
|
||||||
|
SetBrightness(n) => Variant("set-brightness", Some(S32(n)))
|
||||||
PowerAction(n) => Variant("power-action", Some(S32(n)))
|
PowerAction(n) => Variant("power-action", Some(S32(n)))
|
||||||
Network(action, ssid, password) =>
|
Network(action, ssid, password) =>
|
||||||
Variant(
|
Variant(
|
||||||
@@ -466,6 +467,13 @@ fn plasmoid_funcs() -> Array[(String, (Array[@wt.Val]) -> Array[@wt.Val])] {
|
|||||||
none
|
none
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"publish-brightness",
|
||||||
|
a => {
|
||||||
|
@wasm.publish_brightness(a[0].to_int())
|
||||||
|
none
|
||||||
|
},
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"publish-battery",
|
"publish-battery",
|
||||||
a => {
|
a => {
|
||||||
|
|||||||
@@ -259,6 +259,10 @@ interface power {
|
|||||||
/// Minutes without input before the computer suspends; 0: never.
|
/// Minutes without input before the computer suspends; 0: never.
|
||||||
suspend-minutes: func() -> u32;
|
suspend-minutes: func() -> u32;
|
||||||
set-suspend-minutes: func(minutes: u32);
|
set-suspend-minutes: func(minutes: u32);
|
||||||
|
/// Current display backlight brightness in 0..100, or -1 if no backlight exists.
|
||||||
|
brightness: func() -> s32;
|
||||||
|
/// Set display backlight brightness percentage (clamped to 5..100).
|
||||||
|
set-brightness: func(percent: u32);
|
||||||
/// Suspend, power off or restart now.
|
/// Suspend, power off or restart now.
|
||||||
suspend: func();
|
suspend: func();
|
||||||
power-off: func();
|
power-off: func();
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ interface plasmoids {
|
|||||||
publish-session-settings: func(on: u32);
|
publish-session-settings: func(on: u32);
|
||||||
/// The power timeouts, in minutes (0: never).
|
/// The power timeouts, in minutes (0: never).
|
||||||
publish-power: func(screen-off: u32, suspend: u32);
|
publish-power: func(screen-off: u32, suspend: u32);
|
||||||
|
/// Current display backlight brightness in 0..100, or -1 if no backlight exists.
|
||||||
|
publish-brightness: func(percent: s32);
|
||||||
/// The battery: percent (-1: none), state (the battery capability's charge-state, as its index)
|
/// The battery: percent (-1: none), state (the battery capability's charge-state, as its index)
|
||||||
/// and estimated seconds left (0: unknown).
|
/// and estimated seconds left (0: unknown).
|
||||||
publish-battery: func(percent: s32, state: u32, secs-left: u32);
|
publish-battery: func(percent: s32, state: u32, secs-left: u32);
|
||||||
@@ -177,6 +179,8 @@ interface plasmoids {
|
|||||||
face-unlock(s32),
|
face-unlock(s32),
|
||||||
/// The game-library capability: launch, stop, focus or refresh.
|
/// The game-library capability: launch, stop, focus or refresh.
|
||||||
game-library(game-request),
|
game-library(game-request),
|
||||||
|
/// Power: display backlight brightness percentage (5..100).
|
||||||
|
set-brightness(s32),
|
||||||
}
|
}
|
||||||
/// The next pending request, oldest first.
|
/// The next pending request, oldest first.
|
||||||
next-request: func() -> option<request>;
|
next-request: func() -> option<request>;
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
The application launcher. The launcher's popup
|
||||||
|
also ends in a session row: Reload, Log out, Suspend, Restart, Power off.
|
||||||
Reference in new issue
Block a user