Add backlight control to the shell and regenerate WIT bindings
CI / test (push) Canceled after 0s

- 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:
nandi committed 2026-11-28 02:16:07 -08:00
1 parent 2e00009c79
commit 74235cb0ca
84 files changed
+1525 -864

No files matched your search

@@ -11,8 +11,8 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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) =
#|(func (param i32) local.get 0 call $moonbit.decref)
///|
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)
///|
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)
+20 -20
View File
@@ -3,26 +3,6 @@
///|
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 =
#|(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 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 =
#|(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)
+8 -8
View File
@@ -4,12 +4,8 @@
fn wasmImportRead(p0 : Int) = "chandra:desktop/battery@0.1.0" "read"
///|
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_load32(offset : Int) -> Int =
#|(func (param i32) (result i32) local.get 0 i32.load)
///|
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)
///|
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 =
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
+4 -4
View File
@@ -3,14 +3,14 @@
///|
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 =
#|(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 =
#|(func (param i32) (result i32) (local i32)
+13 -13
View File
@@ -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"
///|
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 =
#|(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 =
#|(func (param i32) (result i32) (local i32)
@@ -32,9 +31,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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_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)
+12 -12
View File
@@ -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"
///|
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 =
#|(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.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 =
#|(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 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)
+10 -10
View File
@@ -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"
///|
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)
///|
#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 =
#|(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 =
#|(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.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)
+4 -4
View File
@@ -3,12 +3,12 @@
///|
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)
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)
@@ -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"
///|
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 =
#|(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 =
@@ -25,9 +28,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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_load32(offset : Int) -> Int =
#|(func (param i32) (result i32) local.get 0 i32.load)
+9 -9
View File
@@ -19,25 +19,25 @@ fn wasmImportMoveInstance(p0 : Int, p1 : Int, p2 : Int) = "chandra:desktop/modu
fn wasmImportBrowse() = "chandra:desktop/modules@0.1.0" "browse"
///|
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 =
#|(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)
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 =
#|(func (param i32) (param i32) (result i32)
#| local.get 0
#| local.get 1 call $moonbit.init_array16
#| local.get 0)
///|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#|(func (param i32) (result i32) (local i32)
+8 -8
View File
@@ -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"
///|
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_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 =
@@ -40,10 +44,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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_ptr2str(ptr : Int, len : Int) -> String =
#|(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)
///|
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)
+6
View File
@@ -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 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"
+16
View File
@@ -28,6 +28,22 @@ pub fn set_suspend_minutes(minutes : UInt) -> Unit {
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.
@@ -17,17 +17,17 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
#| local.get 0)
///|
extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#|(func (param i32) (result i32) (local i32)
#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc
#| local.tee 1 i32.const 0 call $moonbit.init_array8
#| local.get 1)
extern "wasm" fn mbt_ffi_free(position : Int) =
#|(func (param i32) local.get 0 call $moonbit.decref)
///|
extern "wasm" fn mbt_ffi_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)
+10 -10
View File
@@ -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"
///|
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)
@@ -22,14 +30,6 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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)
///|
extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
#|(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)
///|
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)
+10 -10
View File
@@ -3,6 +3,14 @@
///|
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 =
#|(func (param i32) (result i32) (local i32)
@@ -11,18 +19,10 @@ extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int =
#| 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) =
#|(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_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 -7
View File
@@ -7,13 +7,6 @@ fn wasmImportGetTokens(p0 : Int) = "chandra:desktop/theme@0.1.0" "get-tokens"
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 =
#|(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.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 =
#|(func (param i32) (result i32) local.get 0 i32.load8_u)
+11 -11
View File
@@ -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"
///|
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 =
#|(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 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)
+11 -11
View File
@@ -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"
///|
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 =
#|(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 =
@@ -23,22 +26,19 @@ extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String =
#| 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)
///|
extern "wasm" fn mbt_ffi_load64(offset : Int) -> Int64 =
#|(func (param i32) (result i64) local.get 0 i64.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_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)
+3
View File
@@ -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 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"
@@ -85,6 +85,11 @@ fn wasmImportPublishPower(p0 : Int, p1 : Int) -> Unit {
abort("wasm-only host import")
}
///|
fn wasmImportPublishBrightness(p0 : Int) -> Unit {
abort("wasm-only host import")
}
///|
fn wasmImportPublishBattery(p0 : Int, p1 : Int, p2 : Int) -> Unit {
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_brightness(Int) -> Unit
pub fn publish_screenshot(UInt32) -> Unit
pub fn publish_session_settings(UInt32) -> Unit
@@ -130,6 +132,7 @@ pub(all) enum Request {
SetDesktop(Int32)
FaceUnlock(Int32)
GameLibrary(GameRequest)
SetBrightness(Int32)
}
pub(all) struct SettingChange {
+12
View File
@@ -69,6 +69,7 @@ pub(all) enum Request {
SetDesktop(Int)
FaceUnlock(Int)
GameLibrary(GameRequest)
SetBrightness(Int)
}
///|
/// 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());
}
///|
/// 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)
@@ -647,6 +655,10 @@ pub fn next_request() -> Request? {
Request::GameLibrary(GameRequest::{action : mbt_ffi_load32((return_area) + 8), game : result5, mode : result6})
}
22 => {
Request::SetBrightness(mbt_ffi_load32((return_area) + 8))
}
_ => panic()
}