Vixen
02b45cc4
csharp
public sealed class DesktopWindow

An SDL window.

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

Remarks

Properties read SDL rather than a cached copy, because a window manager is entitled to ignore what it was asked for: a tiling compositor decides the size, Wayland decides the position and will not say what it chose, and a fullscreen transition changes both. Code that must know what happened listens for WindowResized.

Disposing destroys the window; the title-bar close button does not, and arrives as WindowCloseRequested instead.

Fields and properties (16)

  • public uint Id

    This window's id, as it appears in WindowId.

  • public string Title

    The title bar text.

  • public Int2 ClientSize

    The client area's size in logical points.

  • public Int2 FramebufferSize

    The framebuffer's size in physical pixels — ClientSize times DpiScale, subject to the platform's rounding.

  • public Int2 Position

    The top-left corner in desktop coordinates.

  • public float DpiScale

    Physical pixels per logical point, derived from the two sizes SDL reports rather than from its DPI query.

  • public WindowMode Mode

    How the window relates to its display.

  • public bool IsResizable

    Whether the user may resize it.

  • public bool IsVisible

    Whether it is currently on screen.

  • public bool IsFocused

    Whether it has keyboard focus.

  • public bool IsMinimised

    Whether it is minimised, and therefore not worth rendering to.

  • public bool IsClosed

    Whether it has been disposed. Every other member throws once this is true.

  • public int DisplayIndex

    Which display it is mostly on.

  • public CursorMode CursorMode

    What the cursor does over it.

  • public CursorShape CursorShape

    Which stock cursor to draw over it.

  • public ISurface Surface

    The thing a graphics backend presents to.

Methods (8)

  • 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()

    Centres the window on its display.

  • 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 Dispose()

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

  • public bool TryCreateGlContext(in GlContextRequest request, out IGlContext? context, out string? reason)

Used by (5)

  • DesktopDialogsVixen.Platform.Desktop
  • DesktopDisplaysVixen.Platform.Desktop
  • DesktopPlatformVixen.Platform.Desktop
  • DesktopSurfaceVixen.Platform.Desktop
  • DesktopTextInputVixen.Platform.Desktop