public sealed class HeadlessWindowA window that nobody can see.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
It has a size, an id, a scale factor, focus, a lifecycle and an event stream — everything a window has except a picture. That is the point: the dedicated server and the golden-image test run the same frame loop the desktop build runs, and the no-window path is exercised on every test run rather than being written once for Phase 9 and found broken there.
Its state is also writable in a way a real window's is not, and deliberately: setting ClientSize here really does resize it and really does raise WindowResized, so a test can drive a swapchain-rebuild path without a display server. A real window would treat the same assignment as a request the window manager may refuse, which is why code that must know listens for the event on both.
Where it is not lenient, and why that matters. Every member but IsClosed throws once the window is closed, exactly as IWindow says and exactly as the desktop window does. IsVisible, IsFocused and IsMinimised used to answer instead. That looked harmless — a closed window is plainly not focused — but this is the stand-in every test uses, so being kinder than the real thing means the suite proves a property the shipped platforms do not have. It cost a crash on the way out of the Hello Triangle sample, which the suite reproduced the moment this was tightened and could not have caught before.
Fields and properties (19)
public uint IdThis window's id, as it appears in WindowId.
public string TitleThe title bar text.
public Int2 ClientSizeThe client area's size in logical points.
public Int2 FramebufferSizeThe framebuffer's size in physical pixels — ClientSize times DpiScale, subject to the platform's rounding.
public Int2 PositionThe top-left corner in desktop coordinates.
public float DpiScaleHow many physical pixels there are per logical point.
public WindowMode ModeHow the window relates to its display.
public bool IsResizableWhether the user may resize it.
public bool IsVisiblepublic bool IsFocusedpublic bool IsMinimisedpublic bool IsClosedWhether it has been disposed. Every other member throws once this is true.
public int DisplayIndexAlways 0: a headless platform has no displays to be on.
public CursorMode CursorModeWhat the cursor does over it.
public CursorShape CursorShapeWhich stock cursor to draw over it.
public ISurface SurfaceThe thing a graphics backend presents to.
public ReadOnlyMemory<byte> IconThe icon the window was last given, so a test can assert that an application set one.
public Int2 IconSizeThe size of Icon.
public int AttentionRequestsHow many times RequestAttention has been called.
Methods (11)
public void Show()Shows the window.
public void Hide()Hides the window without destroying it.
public void Focus()Asks for keyboard focus.
public void Centre()Does nothing: there is no display to be centred on.
public void RequestAttention()Asks the OS to draw attention to the window — a bouncing dock icon, a flashing taskbar button.
public void SetIcon(ReadOnlySpan<byte> pixels, Int2 size)Sets the window and taskbar icon from straight (non-premultiplied) RGBA8 pixels.
public void SetFocused(bool focused)Gives or takes keyboard focus, raising the matching event.
public void SetMinimised(bool minimised)Minimises or restores the window, raising the matching event.
public void SetDpiScale(float scale)Changes the scale factor, raising WindowDpiChanged.
public void RequestClose()Raises WindowCloseRequested without closing anything.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (5)
- HeadlessPlatformVixen.Platform.Headless
- HeadlessPlatformTestsVixen.Platform.Headless.Tests
- HeadlessSurfaceVixen.Platform.Headless
- PlatformExtensionsTestsVixen.Platform.Headless.Tests
- VixenApplicationTestsVixen.App.Tests