Vixen
02b45cc4
csharp
public sealed class HeadlessPlatform

The platform with nothing attached: no window server, no GPU, no audio device, no user.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Two jobs, and they are the same job. It is the head a dedicated server and a batch tool run on (docs/plan/17), and it is the platform every test that needs a platform uses. Because the second happens on every build, the first cannot quietly rot — which is the whole argument for building it in Phase 1 rather than discovering in Phase 9 that four subsystems assume a window exists.

Windows still exist here, with sizes and events and focus; they just show nobody anything, and their surfaces report None so a graphics backend renders offscreen. The frame loop is the desktop's frame loop.

Owned by the thread that constructed it, like every other platform. Nothing here needs that restriction, and it is kept anyway: code first written against the headless platform and then run on a desktop should fail in the test suite rather than at the customer.

Fields and properties (14)

  • public string Name

    A name for logs and crash reports: "Desktop (macOS)", "Headless".

  • public PlatformCapabilities Capabilities

    MultiWindow, and nothing else.

  • public IReadOnlyList<IWindow> Windows

    Every window that exists now, in creation order.

  • public IDisplayInfo Displays

    The displays.

  • public IFileSystemHost FileSystem

    Where this platform keeps files.

  • public IClipboard Clipboard

    The system clipboard.

  • public INativeDialogs Dialogs

    Native pickers and message boxes.

  • public ILifecycle Lifecycle

    The process's lifecycle.

  • public IInputSource Input

    Raw input devices and their state.

  • public ITextInput TextInput

    Text entry and the IME.

  • public IPowerInfo Power

    Battery and thermal state.

  • public IProcessorTopology Processors

    How many processors there are, and whether threads may be pinned to them.

  • public HeadlessLifecycle Simulation

    The lifecycle, typed so a test can suspend and resume it.

  • public HeadlessInputSource SimulatedInput

    The input source, typed so a test can hold keys down.

Methods (8)

  • public HeadlessPlatform()

    Creates the platform.

  • public HeadlessPlatform(HeadlessPlatformOptions options)

    Creates the platform.

  • public IWindow CreateWindow(in WindowOptions options)

    Creates a window.

  • public bool TryGetWindow(uint id, out IWindow? window)

    Finds a window by the id its events carry.

  • public ReadOnlySpan<PlatformEvent> PumpEvents()

    Collects everything the OS has to say and returns it, in the order it happened.

  • public bool Post(in PlatformEvent platformEvent)

    Adds an event to the queue, as the operating system would.

  • public bool TryOpenUrl(string url)

    Always : there is no shell to hand a URL to.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (11)

  • HeadlessLifecycleTestsVixen.Platform.Headless.Tests
  • HeadlessPlatformTestsVixen.Platform.Headless.Tests
  • PlatformExtensionsTestsVixen.Platform.Headless.Tests
  • PlatformWindowHostTestsVixen.Platform.Ui.Tests
  • AppBackendTestsVixen.App.Tests
  • HostedEngineTestsVixen.App.Tests
  • HostedRendererTestsVixen.App.Tests
  • PlatformHostVixen.App
  • RemoteContentMountTestsVixen.App.Tests
  • StartupSceneTestsVixen.App.Tests
  • VixenApplicationTestsVixen.App.Tests