fix(ui): #1033 — align sheetCreate FFI with dispatch (body, w, h) - #1054
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1033.
sheetCreate(body, width, height)in TS dispatched as[Widget, F64, F64]through perry-dispatch, but every backend'sperry_ui_sheet_createRust 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:
body_handleas the NSPanel content view viasetContentView(get_widget(body_handle)). Title arg removed (the TS surface takes no title).SheetState(the field already existed but was never populated from codegen) →present()now finds the body andDialog.setContentViews it.The companion
Picker/tabbarAddTab/frameSplitCreate/TextAreamismatches 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 matchcargo build --release -p perry-runtime -p perry-stdlib -p perry— full compilercargo test --release -p perry-dispatch— 5 pass (dispatch row unchanged)