Atv0.2.1Repositorysigil-ui

docs/window-services.md

Release v0.2.1 · Default-branch version

Document

Portable window services

(sigil ui window) exports the following host services on Wayland and AppKit. They operate on an owned window on its creating thread. Host operations are isolated from drawing so they can move into sigil-window with the host.

CallResult
(window-set-title! window title)Boolean acceptance of a synchronous UTF-8 title update, including an identical title.
(window-clipboard-read window)Current text, including an empty string, or #f for unavailable/non-text/closed.
(window-clipboard-set! window text)Boolean acceptance of text ownership/publication by the host protocol.
(window-fullscreen? window)Actual acknowledged fullscreen state.
(window-set-fullscreen! window enabled?)Boolean acceptance of a queued enter/exit request.
(window-fullscreen-status window)idle, pending, granted, or refused for the latest request.

Closed or unsupported windows refuse mutations and clipboard reads; fullscreen state is false and status is refused. Calls from another thread fail the same way. Invalid argument types raise an error. Titles permit at most 4095 UTF-8 bytes and no NUL; text clipboard transfers permit at most 4 MiB. Clipboard access belongs in ordinary application dispatch, outside key filters and native tracking callbacks. Such callbacks refuse clipboard operations before accessing the host clipboard. Wayland publication also requires a valid input serial.

An accepted fullscreen request starts as pending. Only a host acknowledgment matching the latest request grants it. Intermediate replies to older requests do not grant or restart its deadline. Native refusal, unsupported operation, or five seconds without a matching acknowledgment yields refused. A late matching acknowledgment can still grant the request; an external change away from its granted state makes it refused. A new request supersedes the old one. An identical-state request is also acknowledged asynchronously.

window-dispatch returns (fullscreen configured? status) for actual state changes and request status changes. Each event records state and status at enqueue time. Completion/refusal wakes dispatch, including an indefinite wait; there is no periodic fullscreen poll. Keep application chrome until a grant, and use window-fullscreen? for acknowledged state rather than treating a true request result as success.

The existing (sigil ui wayland) calls retain their behavior, including wayland-set-title! returning false for an identical title and wayland-dispatch emitting (fullscreen configured?) without status-only events. The portable dispatcher adds the service status without changing legacy events.

Qualification uses an isolated Wayland protocol server and an owned headless compositor. AppKit controls use hidden windows, controlled native transition notifications, and a private named pasteboard. They do not activate a window, change Spaces, or access the user's clipboard.