Expand description
Secondary windows (docs/windows.md): the app-facing open_window API, the per-window
registry, and the fallback that presents window content as a fullscreen cover where the
toolkit cannot open windows (Cap::MultiWindow = Unsupported).
Windows live in the ONE thread-local tree as additional boundary roots (the same
“wrap an externally-owned handle” record as the primary root and the list cell
anchors), so bindings, find_by_id, and dayscript work across windows unchanged.
Close is asynchronous everywhere: the platform (or the cover’s hide transition)
confirms, and teardown runs THEN — one path for native and programmatic closes.
Structs§
- Window
Handle - A live secondary window (docs/windows.md). Cheap to clone; inert after close.
Constants§
- PREFERENCES_
KEY - The singleton key every preferences window opens under.
Functions§
- finish_
window_ open - Backend-facing: complete a
Pendingwindow open (docs/windows.md).idis the node the backend’sopen_windowreceived;rawis the new window’s CONTENT container;sizeits content size in points.false⇒ the window was closed before completion — the backend should drop the native window it just created. - focused_
window - The most recently focused open secondary window, if any.
None⇒ the primary window is key (or no secondary window exists). - new_
window_ action_ id - The dispatch id of the New Window action (0 = unregistered) —
MenuRole::NewWindowlowering and the backends’ tab-bar “+” wiring. - open_
new_ window - Open a window through the registered new-window builder (the
newWindowForTab:/ File ▸ New Window path).None= no builder registered. - open_
preferences - Open-or-focus the preferences surface (docs/windows.md): a
WindowKind::Preferencessingleton window on desktop, the cover fallback elsewhere — one call for menu items and toolbar gears alike.false= no preferences piece is registered (logged). - open_
window - Open a secondary window (docs/windows.md).
keynames the LOGICAL window: when a window with this key is already open it is focused and returned instead of duplicated (the preferences pattern);Nonealways opens a new one. Where the toolkit cannot open windows (Cap::MultiWindow=Unsupported— probe it to adapt chrome) the content presents as a fullscreen cover in the primary window instead, closable the same way. - open_
window_ count - Test/diagnostic surface: the number of open secondary windows.
- preferences_
action_ id - The dispatch id of the auto Preferences menu action (0 = unregistered). Backends use it
to wire their default-menu Settings item; the injection pass uses it for
app_menu. - register_
new_ window - Register the builder behind File ▸ New Window and the macOS tab-bar “+” (docs/windows.md):
each call opens another
WindowKind::Normalwindow. Amenu_role(MenuRole::NewWindow)item lowers to this action; without a registration it lowers disabled. - register_
preferences - Declare the app’s preferences piece (docs/windows.md) — once, in
root(), ideally beforeapp_menu. Enables the desktop Preferences window (singleton, primary+,), the auto Settings…/Preferences menu item, andopen_preferenceseverywhere (cover fallback where the toolkit cannot open windows). The window titles itself withoptions.title; useregister_preferences_withto localize it or change the size. - register_
preferences_ with register_preferenceswith explicit window options (localized title, size).- reset_
windows - Reset the registry + registrations (tests — pairs with
uninstall_tree). - window_
by_ key - The open window registered under
key, if any (the dayscriptscreenshotstep’swindow:target resolves here). - window_
kind_ of - The
WindowKindof the open window atroot, for backends and tests. - window_
node_ id - The window root’s spec-boundary id (backends key their per-window maps by it).
- window_
root_ by_ key - The tree root of the window registered under
key— day-script’s snapshot target.