Skip to main content

Module window_policy

Module window_policy 

Source
Expand description

Whether this process is allowed to open a window.

A backend stands up its window from deep inside device initialisation, and a process that reaches that point without an operating system to drive it does not fail: it blocks on an event loop that never ends. Under a test harness that is a hang with no failing assertion to read.

The policy is a process-wide latch a caller sets before it runs anything. Default is permissive, so a shipped binary behaves exactly as it did; a headless host forbids windows up front and gets a panic naming the backend instead of a hang.

Functionsยง

allow_windows
Lift the ban set by forbid_windows, restoring the default.
assert_windows_allowed
Panic if windows are forbidden, naming backend as what tried to open one.
forbid_windows
Forbid window creation for the rest of the process, until allow_windows.
windows_forbidden
Whether window creation is currently forbidden.