Skip to content

fix(ui): #1033 — align sheetCreate FFI with dispatch (body, w, h) - #1054

Merged
proggeramlug merged 1 commit into
mainfrom
worktree-fix-1033-sheet-create-body-dispatch
May 19, 2026
Merged

fix(ui): #1033 — align sheetCreate FFI with dispatch (body, w, h)#1054
proggeramlug merged 1 commit into
mainfrom
worktree-fix-1033-sheet-create-body-dispatch

Conversation

@proggeramlug

Copy link
Copy Markdown
Contributor

Summary

Fixes #1033. sheetCreate(body, width, height) in TS dispatched as [Widget, F64, F64] through perry-dispatch, but every backend's perry_ui_sheet_create Rust FFI took (width, height, title) — three f64s. On AArch64 the dispatch landed the body handle in X0 and the dimensions in D0/D1, so the dimensions happened to read from the right registers by luck and the body handle was silently dropped, producing a blank sheet at the requested size.

The v0.5.345 CHANGELOG flagged this as one of "the Win64 ABI path won't crash today by luck" mismatches needing tracking, but no follow-up was filed until #1033.

Changes

Aligned the FFI signature across every UI backend:

perry_ui_sheet_create(body_handle: i64, width: f64, height: f64) -> i64
  • macOS: actually installs body_handle as the NSPanel content view via setContentView(get_widget(body_handle)). Title arg removed (the TS surface takes no title).
  • android: stores body_handle in SheetState (the field already existed but was never populated from codegen) → present() now finds the body and Dialog.setContentViews it.
  • gtk4 / windows: signature aligned; body-attach for those backends is tracked separately.
  • iOS / tvOS / visionOS / watchOS stubs: signatures aligned for ABI parity.

The companion Picker / tabbarAddTab / frameSplitCreate / TextArea mismatches called out in the same v0.5.345 paragraph are out of scope for this PR.

Test plan

  • cargo build --release -p perry-ui-macos — clean (real impl)
  • cargo check --release -p perry-ui-ios -p perry-ui-tvos -p perry-ui-visionos -p perry-ui-watchos — stubs match
  • cargo build --release -p perry-runtime -p perry-stdlib -p perry — full compiler
  • cargo test --release -p perry-dispatch — 5 pass (dispatch row unchanged)
  • Issue repro compiles and launches on macOS without ABI shuffle

`sheetCreate(body, width, height)` in TS dispatched through perry-dispatch
as `[Widget, F64, F64]` — body handle as i64, then two f64s. But every
`perry_ui_sheet_create` Rust FFI took `(width: f64, height: f64, title: f64/i64)` —
three f64s. On AArch64 the dispatch landed the body handle in X0 and the
dimensions in D0/D1, so the dimensions happened to read from the right
registers by luck and the body handle was silently dropped, producing
a blank sheet at the requested size. v0.5.345 CHANGELOG explicitly
flagged this as one of "the Win64 ABI path won't crash today by luck"
mismatches that needed tracking — but no follow-up issue was filed
until #1033.

Aligned the FFI signature across every UI backend:
  perry_ui_sheet_create(body_handle: i64, width: f64, height: f64) -> i64

- macOS: installs `body_handle` as the NSPanel content view via
  `super::get_widget(body_handle)` + `panel.setContentView(...)`. Title
  arg removed — sheets in the TS surface take no title.
- android: stores body_handle in SheetState (the field already existed;
  it was set by a separate `set_body` call that no longer fires from
  codegen). Now `present()` finds the body and installs it via
  Dialog.setContentView.
- gtk4 / windows: signature aligned; body-attach for those backends is
  tracked separately, but the ABI now matches dispatch so dimensions
  reach the right registers.
- iOS / tvOS / visionOS / watchOS: stubs — signatures aligned for ABI
  parity (every backend's FFI must match the single dispatch row).

The companion `Picker` / `tabbarAddTab` / `frameSplitCreate` / `TextArea`
mismatches called out in the same v0.5.345 paragraph are out of scope
for this PR — file separately if they surface.
@proggeramlug
proggeramlug merged commit 4014ce8 into main May 19, 2026
9 checks passed
@proggeramlug
proggeramlug deleted the worktree-fix-1033-sheet-create-body-dispatch branch May 19, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sheetCreate renders blank body — dispatch/runtime arg-shape mismatch (flagged in v0.5.345 CHANGELOG, never tracked)

1 participant