AtlatestRepositorysigil-ui

sigil-ui / tree / docswindow-services.md

Read it rendered

1# Portable window services
2
3`(sigil ui window)` exports the following host services on Wayland and AppKit.
4They operate on an owned window on its creating thread. Host operations are
5isolated from drawing so they can move into sigil-window with the host.
6
7| Call | Result |
8|---|---|
9| `(window-set-title! window title)` | Boolean acceptance of a synchronous UTF-8 title update, including an identical title. |
10| `(window-clipboard-read window)` | Current text, including an empty string, or `#f` for unavailable/non-text/closed. |
11| `(window-clipboard-set! window text)` | Boolean acceptance of text ownership/publication by the host protocol. |
12| `(window-fullscreen? window)` | Actual acknowledged fullscreen state. |
13| `(window-set-fullscreen! window enabled?)` | Boolean acceptance of a queued enter/exit request. |
14| `(window-fullscreen-status window)` | `idle`, `pending`, `granted`, or `refused` for the latest request. |
16Closed or unsupported windows refuse mutations and clipboard reads; fullscreen
17state is false and status is `refused`. Calls from another thread fail the same
18way. Invalid argument types raise an error. Titles permit at most 4095 UTF-8
19bytes and no NUL; text clipboard transfers permit at most 4 MiB. Clipboard
20access belongs in ordinary application dispatch, outside key filters and native
21tracking callbacks. Such callbacks refuse clipboard operations before accessing
22the host clipboard. Wayland publication also requires a valid input serial.
24An accepted fullscreen request starts as `pending`. Only a host acknowledgment
25matching the latest request grants it. Intermediate replies to older requests
26do not grant or restart its deadline. Native refusal, unsupported operation,
27or five seconds without a matching acknowledgment yields `refused`. A late
28matching acknowledgment can still grant the request; an external change away
29from its granted state makes it `refused`. A new request supersedes the old one.
30An identical-state request is also acknowledged asynchronously.
32`window-dispatch` returns `(fullscreen configured? status)` for actual state
33changes and request status changes. Each event records state and status at
34enqueue time. Completion/refusal wakes dispatch, including an indefinite wait;
35there is no periodic fullscreen poll. Keep application chrome until a grant,
36and use `window-fullscreen?` for acknowledged state rather than treating a true
37request result as success.
39The existing `(sigil ui wayland)` calls retain their behavior, including
40`wayland-set-title!` returning false for an identical title and
41`wayland-dispatch` emitting `(fullscreen configured?)` without status-only events.
42The portable dispatcher adds the service status without changing legacy events.
44Qualification uses an isolated Wayland protocol server and an owned headless
45compositor. AppKit host qualification belongs to sigil-window's Linux-built
46native/Sigil/WKWebView packet; its hidden-window controls use controlled
47transitions and a private named pasteboard. Real UI drawing with outline
48fonts requires the SDK-free sigil-font backend and its separate Mac gate.