Atv0.2.11Repositorysigil-ui
Document

macOS drawing adapter

See combined Mac qualification for the reproducible prebuilt font/window/UI fixture, configurable Linux gates and packet procedure.

sigil-ui 0.2.6 draws into sigil-window 0.2.0's SDK-free AppKit host. (sigil ui window) selects the AppKit adapter on Darwin. Existing appkit-* names in (sigil ui appkit) remain available: open/close, geometry, dispatch, clipboard, fullscreen, canvas/UI/overlay presentation and the event loop. The host owns all windows, input, child views, clipboard state and scheduling; this package owns rasterization and UI state.

Sizes and input coordinates are logical pixels. Canvas extents and explicit damage rectangles are device pixels. UI damage is scaled once before host presentation. Empty damage does not submit a frame. Presentation snapshots the host generation, and a UI associated with an older generation or a different window is refused. Recreate the UI after resize/scale changes. The native host copies the pixel and optional A8 alpha planes.

appkit-run! delegates to the host loop. During nested AppKit tracking, its paint callback repaints already realized display items at current geometry. It does not rerun components, update application state or dispatch browser work. The application step runs in the outer event loop. All native host calls stay on the process main thread.

Native embedding adapters include sigil-window's native/appkit-host.h and use sigil_window_appkit_* symbols. Host tokens are numeric identities, not NSWindow/NSView pointers. The old sigil-ui SUI geometry/key records are not binary-compatible with the new SW records; rebuild FFI layouts and callback conversions together. Host ABI and callback ownership are documented by sigil-window in docs/appkit-abi.md.

The UI package contains no Objective-C source or framework link flags. Its Darwin native sources are raster.c, png.c and surface-unavailable.c; AppKit native sources come from sigil-window. Named darwin-arm64 and darwin-amd64 configurations use Zig 0.16.0 and macOS 15.0. A complete demo also depends on its font backend: the currently released CoreText backend still needs a separate SDK-free migration. Do not mistake host/UI object builds for proof that the full demo or an application core cross-builds.

For cross-build dependency resolution with Sigil 0.24.8, supply target features before the manifest is loaded, as well as selecting the named configuration. The manifest uses these features to select sigil-window:

SIGIL_FEATURES=cross,darwin sigil deps install
SIGIL_FEATURES=cross,darwin sigil build -c darwin-arm64
SIGIL_FEATURES=cross,windows sigil build -c windows-amd64

Use the matching features during Windows dependency installation too. Linux builds use the default host features and exclude sigil-window.

The former Objective-C host fixtures have moved to sigil-window's C native host and Sigil conformance fixtures. Use its sealed qualify.sgl packet on an arm64 Mac to validate the Linux-built host executables. This replaces the retired services-check/embedding-check/tracking-check/resize-check paths in build-macos-demo.sgl. Active menus, native fullscreen animation, outline text and browser integration need separate behavior qualification.

The drawing adapter's host-boundary checks run on Linux without a display:

sigil -L test/appkit-host-stub test/check-appkit-adapter.sgl

The controlled host verifies buffer/alpha forwarding, damage validation, window ownership and generation refusal. It does not stand in for native AppKit behavior. The legacy (sigil ui appkit wait) module forwards to sigil-window's scheduler implementation.