DesktopWindowPlacement record

Namespace Runic.Desktop in Runic.Desktop 0.23.0

public sealed record DesktopWindowPlacement : IEquatable<DesktopWindowPlacement>

Inherits or implements IEquatable.

The size, position, maximized and full-screen state to save for a window and restore the next time it opens.

Remarks

Take it from DesktopWindowState.Placement when the window closes, store it with the application's settings, and pass it back as DesktopWindowOptions.Placement. The values use the units that DesktopWindow.MoveAsync and DesktopWindow.ResizeAsync take on the platform that saved them (see DesktopWindowState), so a placement belongs to one machine and one operating system: restoring it elsewhere still opens a visible window, but not necessarily at the same place or size. It is a plain record that System.Text.Json serializes as is. DesktopWindowPlacement.Origin tells a placement saved on macOS by Runic 0.11 or earlier, whose position was measured from the bottom of the screen, from a current one.

Constructors

DesktopWindowPlacement

public DesktopWindowPlacement()

No documentation.

Properties

FullScreen

public bool FullScreen { get; init; }

Gets whether the window was full-screen; it then opens full-screen on the monitor of the other values and leaves full screen to them.

Remarks

Set while the window was full-screen when the placement was taken, not for a DesktopWindowOptions.Kiosk window, which opens full-screen anyway. A placement saved by an earlier release has no such value and opens as before. A window host without DesktopWindowCapabilities.FullScreen ignores it.

Height

public int Height { get; init; }

Gets the height of the restored (not maximized) window, or zero (or less) for DesktopWindowOptions.Height.

Maximized

public bool Maximized { get; init; }

Gets whether the window was maximized; it then opens maximized and restores to the other values.

Origin

public DesktopCoordinateOrigin? Origin { get; init; }

Gets where DesktopWindowPlacement.X and DesktopWindowPlacement.Y are measured from, or null for a placement saved before Runic 0.12.

Remarks

The built-in window hosts report DesktopCoordinateOrigin.TopLeft. Only macOS reads it: there a placement with null or DesktopCoordinateOrigin.BottomLeft is one that Runic 0.11 or earlier saved in AppKit's screen coordinates, the bottom-left corner of the frame measured up from the bottom of the primary screen. The window opens at the same place on the screen, and the placement it then reports is measured from the top-left, so the conversion happens once. Windows and Linux always measured from the top-left and ignore it. A custom window host defines its own units and may ignore it.

Width

public int Width { get; init; }

Gets the width of the restored (not maximized) window, or zero (or less) for DesktopWindowOptions.Width.

X

public int? X { get; init; }

Gets the horizontal position of the restored (not maximized) window, or null to let the platform choose.

Remarks

Applies only together with DesktopWindowPlacement.Y.

Y

public int? Y { get; init; }

Gets the vertical position of the restored (not maximized) window, or null to let the platform choose.

Remarks

Applies only together with DesktopWindowPlacement.X.