
# tecs.platform.window


## Windows

`tecs.platform.window` creates OS windows and reads the displays around them.
[`Application`](/modules/Application/) creates the usual game window as
`app.window`. Tools and tests that call `newWindow` directly must call
`destroy` when they finish.

```teal
local window <const> = tecs.platform.window.newWindow({
    title = "Starfarer",
    width = 1600,
    height = 900,
    hidden = true,
})

window:center()
window:show()
```

### Screen coordinates and pixels

Window layout and pointer input use screen coordinates. Render targets use
pixels. A high-density display may put several pixels behind one screen
coordinate.

```teal
local width <const>, height <const> = window:getSize()
local pixelWidth <const>, pixelHeight <const> = window:getPixelSize()
local density <const> = window:pixelDensity()

assert(pixelWidth == width * density)
assert(pixelHeight == height * density)
```

`displayScale` reports the desktop's preferred scale for text and interface
metrics. It does not convert between the two sizes.

### Compositor changes

Size, position and fullscreen setters may return before the compositor applies
the request. Most games consume the corresponding event later. Call `sync`
only before an immediate readback.

```teal
window:setSize(1280, 720)
if window:sync() then
    local width <const>, height <const> = window:getSize()
end
```

### Fullscreen modes

Fullscreen uses the desktop resolution when the caller selects no mode.
Exclusive fullscreen accepts only a mode that `fullscreenModes` or
`closestFullscreenMode` returns.

```teal
local mode <const> = tecs.platform.window.Window.closestFullscreenMode(
    savedWidth, savedHeight, savedRefreshRate, true
)

if mode ~= nil then
    window:setFullscreenMode(mode)
    window:setFullscreen(true)
end
```

### Display placement

Desktop positions span every attached display and may contain negative
coordinates. Use usable bounds to keep windows clear of a taskbar, dock or
menu bar.

```teal
for _, displayId in ipairs(tecs.platform.window.Window.displays()) do
    local x <const>, y <const>, width <const>, height <const> = tecs.platform.window.Window.usableBounds(
        displayId
    )
end
```

Display and window events report changes. Getters report current state,
including state that existed before the first event. Use `Window:id` to match a
window event's `which` field.

### Custom window chrome

A borderless window can return selected regions to the desktop for dragging
and edge resizing. `setHitRegions` copies the complete list, so UI layout may
reuse or change its records as soon as the call returns. The first region that
contains a point wins.

```teal
window:setHitRegions({
    {kind = "draggable", x = 0, y = 0, width = 800, height = 40},
    {kind = "resizeBottom", x = 0, y = 596, width = 800, height = 4},
})
```

Hit testing runs inside the native window manager callback. Rust reads the
copied regions there; SDL never calls a Lua function.

### Pointer ownership

The window API owns mouse and keyboard confinement. `tecs.input` owns relative
mouse mode, warping, capture and cursor visibility. The GPU device owns
presentation pacing after it claims a window.

## Module contents

### Constructors

| Constructor | Description |
| --- | --- |
| [`newWindow`](/modules/platform/window/#tecs.platform.window.newWindow) | Opens a window and raises when it cannot create a usable one. |

### Types

| Type | Kind | Description |
| --- | --- | --- |
| [`DisplayMode`](/modules/platform/window/#tecs.platform.window.DisplayMode) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Describes one fullscreen mode a display offers. |
| [`Flash`](/modules/platform/window/#tecs.platform.window.Flash) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Selects how a window asks for attention. |
| [`HitRegion`](/modules/platform/window/#tecs.platform.window.HitRegion) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Describes one custom window region. |
| [`HitRegionKind`](/modules/platform/window/#tecs.platform.window.HitRegionKind) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Selects how the desktop treats a custom window region. |
| [`Options`](/modules/platform/window/#tecs.platform.window.Options) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Describes the caller-writable configuration that newWindow reads. |
| [`Orientation`](/modules/platform/window/#tecs.platform.window.Orientation) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Describes which way up a display is. |
| [`Progress`](/modules/platform/window/#tecs.platform.window.Progress) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Selects what a taskbar progress indicator shows. |
| [`Theme`](/modules/platform/window/#tecs.platform.window.Theme) | <span class="tealdoc-kind-badge tealdoc-kind-type">type</span> | Describes the desktop's light or dark preference. |
| [`Window`](/modules/platform/window/#tecs.platform.window.Window) | <span class="tealdoc-kind-badge tealdoc-kind-record">record</span> | A Window owns one open OS window and reads the displays around it. |

## Constructors

<a id="tecs.platform.window.newWindow"></a>
### tecs.platform.window.newWindow <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Opens a window and raises when it cannot create a usable one.

It validates sizes and the icon before returning. Omitted fields take
the defaults that
[`Options`](/modules/platform/window/#tecs.platform.window.Window.Options) documents.



```teal
function tecs.platform.window.newWindow(options: Window.Options): Window
```

#### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `options` | [`Window.Options`](/modules/platform/window/#tecs.platform.window.Window.Options) | The caller supplies the initial window configuration. |

#### Returns

| Type | Description |
| --- | --- |
| [`Window`](/modules/platform/window/#tecs.platform.window.Window) | Returns the caller-owned window. The caller releases it through `destroy`. |

## Types

<a id="tecs.platform.window.DisplayMode"></a>
### tecs.platform.window.DisplayMode <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Describes one fullscreen mode a display offers.


```teal
type tecs.platform.window.DisplayMode = Window.DisplayMode
```

<a id="tecs.platform.window.Flash"></a>
### tecs.platform.window.Flash <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Selects how a window asks for attention.


```teal
type tecs.platform.window.Flash = Window.Flash
```

<a id="tecs.platform.window.HitRegion"></a>
### tecs.platform.window.HitRegion <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Describes one custom window region.


```teal
type tecs.platform.window.HitRegion = Window.HitRegion
```

<a id="tecs.platform.window.HitRegionKind"></a>
### tecs.platform.window.HitRegionKind <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Selects how the desktop treats a custom window region.


```teal
type tecs.platform.window.HitRegionKind = Window.HitRegionKind
```

<a id="tecs.platform.window.Options"></a>
### tecs.platform.window.Options <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Describes the caller-writable configuration that `newWindow` reads.


```teal
type tecs.platform.window.Options = Window.Options
```

<a id="tecs.platform.window.Orientation"></a>
### tecs.platform.window.Orientation <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Describes which way up a display is.


```teal
type tecs.platform.window.Orientation = Window.Orientation
```

<a id="tecs.platform.window.Progress"></a>
### tecs.platform.window.Progress <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Selects what a taskbar progress indicator shows.


```teal
type tecs.platform.window.Progress = Window.Progress
```

<a id="tecs.platform.window.Theme"></a>
### tecs.platform.window.Theme <span class="tealdoc-kind-badge tealdoc-kind-type">type</span>

Describes the desktop's light or dark preference.


```teal
type tecs.platform.window.Theme = Window.Theme
```

<a id="tecs.platform.window.Window"></a>
### tecs.platform.window.Window <span class="tealdoc-kind-badge tealdoc-kind-record">record</span>

A `Window` owns one open OS window and reads the displays around it.

Game code changes state through methods. Public fields expose framework
state and remain read-only to callers.


```teal
record tecs.platform.window.Window
    handle: loader.CPtr
    title: string
    enum Orientation
        "landscape"
        "landscapeFlipped"
        "portrait"
        "portraitFlipped"
        "unknown"
    end

    enum Theme
        "dark"
        "light"
        "unknown"
    end

    enum Flash
        "brief"
        "cancel"
        "untilFocused"
    end

    enum Progress
        "error"
        "indeterminate"
        "none"
        "normal"
        "paused"
    end

    enum HitRegionKind
        "draggable"
        "resizeBottom"
        "resizeBottomLeft"
        "resizeBottomRight"
        "resizeLeft"
        "resizeRight"
        "resizeTop"
        "resizeTopLeft"
        "resizeTopRight"
    end

    record HitRegion
        kind: HitRegionKind
        x: integer
        y: integer
        width: integer
        height: integer
    end

    record DisplayMode
        display: integer
        width: integer
        height: integer
        pixelDensity: number
        refreshRate: number
    end

    record Options
        title: string
        width: integer
        height: integer
        resizable: boolean
        highPixelDensity: boolean
        fullscreen: boolean
        borderless: boolean
        hidden: boolean
        alwaysOnTop: boolean
        transparent: boolean
        x: integer
        y: integer
        minWidth: integer
        minHeight: integer
        maxWidth: integer
        maxHeight: integer
        icon: string
    end

    closestFullscreenMode: function(
        width: integer,
        height: integer,
        refreshRate: number,
        highDensity: boolean,
        displayId: integer
    ): Window.DisplayMode
    contentScale: function(displayId: integer): number
    currentMode: function(displayId: integer): Window.DisplayMode
    desktopMode: function(displayId: integer): Window.DisplayMode
    displayBounds: function(
        displayId: integer
    ): integer, integer, integer, integer
    displayName: function(displayId: integer): string
    displays: function(): {integer}
    fullscreenModes: function(displayId: integer): {Window.DisplayMode}
    isSupported: function(): boolean
    naturalOrientation: function(displayId: integer): Window.Orientation
    orientation: function(displayId: integer): Window.Orientation
    primaryDisplay: function(): integer
    screenSaverEnabled: function(): boolean
    setScreenSaverEnabled: function(enabled: boolean): boolean
    theme: function(): Window.Theme
    usableBounds: function(
        displayId: integer
    ): integer, integer, integer, integer
    aspectRatio: function(self): number, number
    borderSize: function(self): integer, integer, integer, integer
    center: function(self, displayId: integer): boolean
    destroy: function(self)
    display: function(self): integer
    displayScale: function(self): number
    flash: function(self, operation: Window.Flash): boolean
    fullscreenMode: function(self): Window.DisplayMode
    getPixelSize: function(self): integer, integer
    getSize: function(self): integer, integer
    hasFocus: function(self): boolean
    hasMouseFocus: function(self): boolean
    hide: function(self): boolean
    id: function(self): integer
    isAlwaysOnTop: function(self): boolean
    isBordered: function(self): boolean
    isFocusable: function(self): boolean
    isFullscreen: function(self): boolean
    isMaximized: function(self): boolean
    isMinimized: function(self): boolean
    isOccluded: function(self): boolean
    isResizable: function(self): boolean
    isVisible: function(self): boolean
    keyboardGrab: function(self): boolean
    maximize: function(self): boolean
    maximumSize: function(self): integer, integer
    minimize: function(self): boolean
    minimumSize: function(self): integer, integer
    mouseGrab: function(self): boolean
    mouseRect: function(self): integer, integer, integer, integer
    opacity: function(self): number
    pixelDensity: function(self): number
    position: function(self): integer, integer
    progress: function(self): Window.Progress, number
    raise: function(self): boolean
    restore: function(self): boolean
    safeArea: function(self): integer, integer, integer, integer
    setAlwaysOnTop: function(self, onTop: boolean): boolean
    setAspectRatio: function(
        self, minimum: number, maximum: number
    ): boolean
    setBordered: function(self, bordered: boolean): boolean
    setFocusable: function(self, focusable: boolean): boolean
    setFullscreen: function(self, fullscreen: boolean): boolean
    setFullscreenMode: function(self, mode: Window.DisplayMode): boolean
    setHitRegions: function(self, regions: {Window.HitRegion}): boolean
    setIcon: function(self, path: string): boolean
    setKeyboardGrab: function(self, grabbed: boolean): boolean
    setMaximumSize: function(
        self, width: integer, height: integer
    ): boolean
    setMinimumSize: function(
        self, width: integer, height: integer
    ): boolean
    setMouseGrab: function(self, grabbed: boolean): boolean
    setMouseRect: function(
        self, x: integer, y: integer, width: integer, height: integer
    ): boolean
    setOpacity: function(self, opacity: number): boolean
    setPosition: function(self, x: integer, y: integer): boolean
    setProgress: function(
        self, state: Window.Progress, value: number
    ): boolean
    setResizable: function(self, resizable: boolean): boolean
    setSize: function(self, width: integer, height: integer): boolean
    setTitle: function(self, title: string): boolean
    show: function(self): boolean
    showSystemMenu: function(self, x: integer, y: integer): boolean
    sync: function(self): boolean
end
```

<a id="tecs.platform.window.Window.handle"></a>
#### tecs.platform.window.Window.handle <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Engine-owned. The framework stores the native window handle here for
the GPU device to claim for presentation and sets it to nil when
`destroy` runs. Ordinary game code ignores this field.


```teal
tecs.platform.window.Window.handle: loader.CPtr
```

<a id="tecs.platform.window.Window.title"></a>
#### tecs.platform.window.Window.title <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The framework stores the last title here when it creates
the window or `setTitle` succeeds. Game code changes it through
`setTitle`.


```teal
tecs.platform.window.Window.title: string
```

<a id="tecs.platform.window.Window.Orientation"></a>
#### tecs.platform.window.Window.Orientation <span class="tealdoc-kind-badge tealdoc-kind-enum">enum</span>

`Orientation` describes a display's current or natural rotation.


```teal
enum tecs.platform.window.Window.Orientation
    "landscape"
    "landscapeFlipped"
    "portrait"
    "portraitFlipped"
    "unknown"
end
```

<a id="tecs.platform.window.Window.Theme"></a>
#### tecs.platform.window.Window.Theme <span class="tealdoc-kind-badge tealdoc-kind-enum">enum</span>

`Theme` describes the desktop's requested appearance.


```teal
enum tecs.platform.window.Window.Theme
    "dark"
    "light"
    "unknown"
end
```

<a id="tecs.platform.window.Window.Flash"></a>
#### tecs.platform.window.Window.Flash <span class="tealdoc-kind-badge tealdoc-kind-enum">enum</span>

`Flash` selects how long the desktop asks for attention.


```teal
enum tecs.platform.window.Window.Flash
    "brief"
    "cancel"
    "untilFocused"
end
```

<a id="tecs.platform.window.Window.Progress"></a>
#### tecs.platform.window.Window.Progress <span class="tealdoc-kind-badge tealdoc-kind-enum">enum</span>

`Progress` selects what the taskbar or dock shows over the icon.


```teal
enum tecs.platform.window.Window.Progress
    "error"
    "indeterminate"
    "none"
    "normal"
    "paused"
end
```

<a id="tecs.platform.window.Window.HitRegionKind"></a>
#### tecs.platform.window.Window.HitRegionKind <span class="tealdoc-kind-badge tealdoc-kind-enum">enum</span>

`HitRegionKind` selects how the desktop treats a window region.


```teal
enum tecs.platform.window.Window.HitRegionKind
    "draggable"
    "resizeBottom"
    "resizeBottomLeft"
    "resizeBottomRight"
    "resizeLeft"
    "resizeRight"
    "resizeTop"
    "resizeTopLeft"
    "resizeTopRight"
end
```

<a id="tecs.platform.window.Window.HitRegion"></a>
#### tecs.platform.window.Window.HitRegion <span class="tealdoc-kind-badge tealdoc-kind-record">record</span>

`HitRegion` gives part of a borderless window desktop behavior.


```teal
record tecs.platform.window.Window.HitRegion
    kind: HitRegionKind
    x: integer
    y: integer
    width: integer
    height: integer
end
```

<a id="tecs.platform.window.Window.HitRegion.kind"></a>
##### tecs.platform.window.Window.HitRegion.kind <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. Selects dragging or one resize direction.


```teal
tecs.platform.window.Window.HitRegion.kind: HitRegionKind
```

<a id="tecs.platform.window.Window.HitRegion.x"></a>
##### tecs.platform.window.Window.HitRegion.x <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. Sets the left edge in window client
coordinates. It must be a non-negative integer.


```teal
tecs.platform.window.Window.HitRegion.x: integer
```

<a id="tecs.platform.window.Window.HitRegion.y"></a>
##### tecs.platform.window.Window.HitRegion.y <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. Sets the top edge in window client
coordinates. It must be a non-negative integer.


```teal
tecs.platform.window.Window.HitRegion.y: integer
```

<a id="tecs.platform.window.Window.HitRegion.width"></a>
##### tecs.platform.window.Window.HitRegion.width <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. Sets a positive width in window client
coordinates.


```teal
tecs.platform.window.Window.HitRegion.width: integer
```

<a id="tecs.platform.window.Window.HitRegion.height"></a>
##### tecs.platform.window.Window.HitRegion.height <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. Sets a positive height in window client
coordinates.


```teal
tecs.platform.window.Window.HitRegion.height: integer
```

<a id="tecs.platform.window.Window.DisplayMode"></a>
#### tecs.platform.window.Window.DisplayMode <span class="tealdoc-kind-badge tealdoc-kind-record">record</span>

`DisplayMode` describes one video mode returned by the platform.

Callers treat every field as read-only and pass the record back to
`setFullscreenMode`.


```teal
record tecs.platform.window.Window.DisplayMode
    display: integer
    width: integer
    height: integer
    pixelDensity: number
    refreshRate: number
end
```

<a id="tecs.platform.window.Window.DisplayMode.display"></a>
##### tecs.platform.window.Window.DisplayMode.display <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The platform sets `display` when it builds the mode.


```teal
tecs.platform.window.Window.DisplayMode.display: integer
```

<a id="tecs.platform.window.Window.DisplayMode.width"></a>
##### tecs.platform.window.Window.DisplayMode.width <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The platform sets `width` in screen coordinates when
it builds the mode. Callers multiply it by `pixelDensity` to
obtain pixels.


```teal
tecs.platform.window.Window.DisplayMode.width: integer
```

<a id="tecs.platform.window.Window.DisplayMode.height"></a>
##### tecs.platform.window.Window.DisplayMode.height <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The platform sets `height` in screen coordinates
when it builds the mode. Callers multiply it by `pixelDensity`
to obtain pixels.


```teal
tecs.platform.window.Window.DisplayMode.height: integer
```

<a id="tecs.platform.window.Window.DisplayMode.pixelDensity"></a>
##### tecs.platform.window.Window.DisplayMode.pixelDensity <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The platform sets `pixelDensity` when it builds the
mode. A 1920 by 1080 mode at 2.0 draws 3840 by 2160 pixels.


```teal
tecs.platform.window.Window.DisplayMode.pixelDensity: number
```

<a id="tecs.platform.window.Window.DisplayMode.refreshRate"></a>
##### tecs.platform.window.Window.DisplayMode.refreshRate <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Read-only. The platform sets `refreshRate` in hertz when it
builds the mode, or to zero when it cannot report a rate.


```teal
tecs.platform.window.Window.DisplayMode.refreshRate: number
```

<a id="tecs.platform.window.Window.Options"></a>
#### tecs.platform.window.Window.Options <span class="tealdoc-kind-badge tealdoc-kind-record">record</span>

Callers may set any
`Options` field before passing
the record to `newWindow`. The function reads the values and does
not retain the record.


```teal
record tecs.platform.window.Window.Options
    title: string
    width: integer
    height: integer
    resizable: boolean
    highPixelDensity: boolean
    fullscreen: boolean
    borderless: boolean
    hidden: boolean
    alwaysOnTop: boolean
    transparent: boolean
    x: integer
    y: integer
    minWidth: integer
    minHeight: integer
    maxWidth: integer
    maxHeight: integer
    icon: string
end
```

<a id="tecs.platform.window.Window.Options.title"></a>
##### tecs.platform.window.Window.Options.title <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `title` to the desktop title
before `newWindow` reads it. It defaults to `"tecs"`.


```teal
tecs.platform.window.Window.Options.title: string
```

<a id="tecs.platform.window.Window.Options.width"></a>
##### tecs.platform.window.Window.Options.width <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `width` in screen coordinates
before `newWindow` reads it. It defaults to 1280.


```teal
tecs.platform.window.Window.Options.width: integer
```

<a id="tecs.platform.window.Window.Options.height"></a>
##### tecs.platform.window.Window.Options.height <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `height` in screen coordinates
before `newWindow` reads it. It defaults to 720.


```teal
tecs.platform.window.Window.Options.height: integer
```

<a id="tecs.platform.window.Window.Options.resizable"></a>
##### tecs.platform.window.Window.Options.resizable <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `resizable` before `newWindow`
reads it. It defaults to true, and only false disables edge
resizing.


```teal
tecs.platform.window.Window.Options.resizable: boolean
```

<a id="tecs.platform.window.Window.Options.highPixelDensity"></a>
##### tecs.platform.window.Window.Options.highPixelDensity <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `highPixelDensity` before
`newWindow` reads it. It defaults to true and lets the drawable
follow the display density instead of stretching.


```teal
tecs.platform.window.Window.Options.highPixelDensity: boolean
```

<a id="tecs.platform.window.Window.Options.fullscreen"></a>
##### tecs.platform.window.Window.Options.fullscreen <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `fullscreen` before
`newWindow` reads it to start on the display selected by the
window manager. It defaults to false.


```teal
tecs.platform.window.Window.Options.fullscreen: boolean
```

<a id="tecs.platform.window.Window.Options.borderless"></a>
##### tecs.platform.window.Window.Options.borderless <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `borderless` before
`newWindow` reads it to remove the title bar and frame. It
defaults to false.


```teal
tecs.platform.window.Window.Options.borderless: boolean
```

<a id="tecs.platform.window.Window.Options.hidden"></a>
##### tecs.platform.window.Window.Options.hidden <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `hidden` before `newWindow`
reads it to defer mapping until `show`. It defaults to false.


```teal
tecs.platform.window.Window.Options.hidden: boolean
```

<a id="tecs.platform.window.Window.Options.alwaysOnTop"></a>
##### tecs.platform.window.Window.Options.alwaysOnTop <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `alwaysOnTop` before
`newWindow` reads it to keep the window above others. It
defaults to false.


```teal
tecs.platform.window.Window.Options.alwaysOnTop: boolean
```

<a id="tecs.platform.window.Window.Options.transparent"></a>
##### tecs.platform.window.Window.Options.transparent <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `transparent` before
`newWindow` reads it to request desktop alpha compositing. It
defaults to false.


```teal
tecs.platform.window.Window.Options.transparent: boolean
```

<a id="tecs.platform.window.Window.Options.x"></a>
##### tecs.platform.window.Window.Options.x <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `x` with `y` before
`newWindow` reads them. Without both fields, the window manager
chooses the position.


```teal
tecs.platform.window.Window.Options.x: integer
```

<a id="tecs.platform.window.Window.Options.y"></a>
##### tecs.platform.window.Window.Options.y <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `y` with `x` before
`newWindow` reads them.


```teal
tecs.platform.window.Window.Options.y: integer
```

<a id="tecs.platform.window.Window.Options.minWidth"></a>
##### tecs.platform.window.Window.Options.minWidth <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `minWidth` with `minHeight`
before `newWindow` reads them.


```teal
tecs.platform.window.Window.Options.minWidth: integer
```

<a id="tecs.platform.window.Window.Options.minHeight"></a>
##### tecs.platform.window.Window.Options.minHeight <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `minHeight` with `minWidth`
before `newWindow` reads them.


```teal
tecs.platform.window.Window.Options.minHeight: integer
```

<a id="tecs.platform.window.Window.Options.maxWidth"></a>
##### tecs.platform.window.Window.Options.maxWidth <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `maxWidth` with `maxHeight`
before `newWindow` reads them.


```teal
tecs.platform.window.Window.Options.maxWidth: integer
```

<a id="tecs.platform.window.Window.Options.maxHeight"></a>
##### tecs.platform.window.Window.Options.maxHeight <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `maxHeight` with `maxWidth`
before `newWindow` reads them.


```teal
tecs.platform.window.Window.Options.maxHeight: integer
```

<a id="tecs.platform.window.Window.Options.icon"></a>
##### tecs.platform.window.Window.Options.icon <span class="tealdoc-kind-badge tealdoc-kind-field">field</span>

Caller-writable. The caller sets `icon` to an image path before
`newWindow` reads it. `newWindow` decodes it synchronously.


```teal
tecs.platform.window.Window.Options.icon: string
```

<a id="tecs.platform.window.Window.closestFullscreenMode"></a>
#### tecs.platform.window.Window.closestFullscreenMode <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Finds the nearest fullscreen mode to a requested size.

Use this when restoring a saved mode that the display may no longer
offer exactly.



```teal
function tecs.platform.window.Window.closestFullscreenMode(
    width: integer,
    height: integer,
    refreshRate: number,
    highDensity: boolean,
    displayId: integer
): Window.DisplayMode
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `width` | `integer` | The caller supplies the requested width in screen coordinates. |
| `height` | `integer` | The caller supplies the requested height in screen coordinates. |
| `refreshRate` | `number` | The caller supplies hertz, or zero or nil for the highest available rate. |
| `highDensity` | `boolean` | The caller chooses whether the function may select modes above density 1. It defaults to false. |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the nearest platform mode, or nil when none fits. |

<a id="tecs.platform.window.Window.contentScale"></a>
#### tecs.platform.window.Window.contentScale <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads a display's preferred content scale.



```teal
function tecs.platform.window.Window.contentScale(
    displayId: integer
): number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| `number` | Returns the scale, or zero without video. |

<a id="tecs.platform.window.Window.currentMode"></a>
#### tecs.platform.window.Window.currentMode <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the display mode in use now.



```teal
function tecs.platform.window.Window.currentMode(
    displayId: integer
): Window.DisplayMode
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil without video. |

<a id="tecs.platform.window.Window.desktopMode"></a>
#### tecs.platform.window.Window.desktopMode <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the display mode the desktop started in.



```teal
function tecs.platform.window.Window.desktopMode(
    displayId: integer
): Window.DisplayMode
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil without video. |

<a id="tecs.platform.window.Window.displayBounds"></a>
#### tecs.platform.window.Window.displayBounds <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads a display's desktop rectangle.



```teal
function tecs.platform.window.Window.displayBounds(
    displayId: integer
): integer, integer, integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the horizontal position in desktop screen coordinates. |
| `integer` | Returns the vertical position in desktop screen coordinates. |
| `integer` | Returns the width in screen coordinates. |
| `integer` | Returns the height in screen coordinates. |

<a id="tecs.platform.window.Window.displayName"></a>
#### tecs.platform.window.Window.displayName <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the desktop name for a display.



```teal
function tecs.platform.window.Window.displayName(
    displayId: integer
): string
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| `string` | Returns the name, or an empty string without video. |

<a id="tecs.platform.window.Window.displays"></a>
#### tecs.platform.window.Window.displays <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Lists attached displays in platform order.



```teal
function tecs.platform.window.Window.displays(): {integer}
```

##### Arguments

None.

##### Returns

| Type | Description |
| --- | --- |
| `{integer}` | Returns display ids, or an empty list without video. |

<a id="tecs.platform.window.Window.fullscreenModes"></a>
#### tecs.platform.window.Window.fullscreenModes <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Lists the display's exclusive fullscreen modes, largest first.



```teal
function tecs.platform.window.Window.fullscreenModes(
    displayId: integer
): {Window.DisplayMode}
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| `{`[`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode)`}` | Returns modes accepted by `setFullscreenMode`, or an empty list without video. |

<a id="tecs.platform.window.Window.isSupported"></a>
#### tecs.platform.window.Window.isSupported <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Returns whether the platform can create and inspect windows.

False in a headless process. Display and screen-saver functions
answer harmless defaults there, while `newWindow` raises.



```teal
function tecs.platform.window.Window.isSupported(): boolean
```

##### Arguments

None.

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns true when this process can create and inspect windows. |

<a id="tecs.platform.window.Window.naturalOrientation"></a>
#### tecs.platform.window.Window.naturalOrientation <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the orientation a display was built for.



```teal
function tecs.platform.window.Window.naturalOrientation(
    displayId: integer
): Window.Orientation
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.Orientation`](/modules/platform/window/#tecs.platform.window.Window.Orientation) | Returns the natural orientation, or `"unknown"` without video. |

<a id="tecs.platform.window.Window.orientation"></a>
#### tecs.platform.window.Window.orientation <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads a display's current rotation.



```teal
function tecs.platform.window.Window.orientation(
    displayId: integer
): Window.Orientation
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.Orientation`](/modules/platform/window/#tecs.platform.window.Window.Orientation) | Returns the orientation, or `"unknown"` without video. |

<a id="tecs.platform.window.Window.primaryDisplay"></a>
#### tecs.platform.window.Window.primaryDisplay <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the desktop's primary display.



```teal
function tecs.platform.window.Window.primaryDisplay(): integer
```

##### Arguments

None.

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the display id, or zero without video. |

<a id="tecs.platform.window.Window.screenSaverEnabled"></a>
#### tecs.platform.window.Window.screenSaverEnabled <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Returns whether the desktop may blank the display.

Video startup disables the screen saver. Enable it for an unattended
menu or cutscene.



```teal
function tecs.platform.window.Window.screenSaverEnabled(): boolean
```

##### Arguments

None.

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false without video. |

<a id="tecs.platform.window.Window.setScreenSaverEnabled"></a>
#### tecs.platform.window.Window.setScreenSaverEnabled <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Allows or forbids the desktop blanking the display.



```teal
function tecs.platform.window.Window.setScreenSaverEnabled(
    enabled: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `enabled` | `boolean` | The caller chooses whether the screen saver may run. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the change, or false without video. |

<a id="tecs.platform.window.Window.theme"></a>
#### tecs.platform.window.Window.theme <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the desktop's light or dark preference.



```teal
function tecs.platform.window.Window.theme(): Window.Theme
```

##### Arguments

None.

##### Returns

| Type | Description |
| --- | --- |
| [`Window.Theme`](/modules/platform/window/#tecs.platform.window.Window.Theme) | Returns `"light"`, `"dark"` or `"unknown"`. |

<a id="tecs.platform.window.Window.usableBounds"></a>
#### tecs.platform.window.Window.usableBounds <span class="tealdoc-kind-badge tealdoc-kind-static">Static</span>

Reads the display area not occupied by desktop chrome.



```teal
function tecs.platform.window.Window.usableBounds(
    displayId: integer
): integer, integer, integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `displayId` | `integer` | The caller omits this value to use the primary display. |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the horizontal position in desktop screen coordinates. |
| `integer` | Returns the vertical position in desktop screen coordinates. |
| `integer` | Returns the width in screen coordinates. |
| `integer` | Returns the height in screen coordinates. |

<a id="tecs.platform.window.Window.aspectRatio"></a>
#### tecs.platform.window.Window:aspectRatio <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the allowed width-over-height range.



```teal
function tecs.platform.window.Window.aspectRatio(self): number, number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `number` | Returns the minimum ratio, or zero when unset. |
| `number` | Returns the maximum ratio, or zero when unset. |

<a id="tecs.platform.window.Window.borderSize"></a>
#### tecs.platform.window.Window:borderSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the window decoration thickness in screen coordinates.



```teal
function tecs.platform.window.Window.borderSize(
    self
): integer, integer, integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the top thickness, or zero without decoration. |
| `integer` | Returns the left thickness, or zero without decoration. |
| `integer` | Returns the bottom thickness, or zero without decoration. |
| `integer` | Returns the right thickness, or zero without decoration. |

<a id="tecs.platform.window.Window.center"></a>
#### tecs.platform.window.Window:center <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Centers the window on a display.



```teal
function tecs.platform.window.Window.center(
    self, displayId: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `displayId` | `integer` | The caller omits this value to use the display the window occupies. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.destroy"></a>
#### tecs.platform.window.Window:destroy <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Releases the window. Safe to call more than once.

Every getter answers zero, false or nil after this call.


```teal
function tecs.platform.window.Window.destroy(self)
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

None.

<a id="tecs.platform.window.Window.display"></a>
#### tecs.platform.window.Window:display <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the display this window mostly occupies.



```teal
function tecs.platform.window.Window.display(self): integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the display id, or zero after `destroy`. |

<a id="tecs.platform.window.Window.displayScale"></a>
#### tecs.platform.window.Window:displayScale <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns the desktop's preferred scale for content.

This is not the ratio between `getSize` and `getPixelSize`; use
`pixelDensity` for that. A theme or UI can multiply its natural
metrics by this value.



```teal
function tecs.platform.window.Window.displayScale(self): number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `number` | Returns the scale, or zero after `destroy`. |

<a id="tecs.platform.window.Window.flash"></a>
#### tecs.platform.window.Window:flash <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Asks for attention without taking focus.

`"untilFocused"` keeps asking and `"cancel"` stops a request. An
unknown operation raises.



```teal
function tecs.platform.window.Window.flash(
    self, operation: Window.Flash
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `operation` | [`Window.Flash`](/modules/platform/window/#tecs.platform.window.Window.Flash) | The caller chooses how long to ask for attention. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the desktop accepted the request. |

<a id="tecs.platform.window.Window.fullscreenMode"></a>
#### tecs.platform.window.Window:fullscreenMode <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the selected exclusive fullscreen mode.



```teal
function tecs.platform.window.Window.fullscreenMode(
    self
): Window.DisplayMode
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | Returns the mode, or nil for borderless fullscreen and after `destroy`. |

<a id="tecs.platform.window.Window.getPixelSize"></a>
#### tecs.platform.window.Window:getPixelSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the drawable size in pixels.



```teal
function tecs.platform.window.Window.getPixelSize(
    self
): integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the pixel width, or zero after `destroy`. |
| `integer` | Returns the pixel height, or zero after `destroy`. |

<a id="tecs.platform.window.Window.getSize"></a>
#### tecs.platform.window.Window:getSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the window size in screen coordinates.

Pointer positions use these units. Render targets use
`getPixelSize`.



```teal
function tecs.platform.window.Window.getSize(self): integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the width, or zero after `destroy`. |
| `integer` | Returns the height, or zero after `destroy`. |

<a id="tecs.platform.window.Window.hasFocus"></a>
#### tecs.platform.window.Window:hasFocus <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether keyboard events currently target this window.



```teal
function tecs.platform.window.Window.hasFocus(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.hasMouseFocus"></a>
#### tecs.platform.window.Window:hasMouseFocus <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the pointer is over the window.

Relative mouse mode has no pointer position and reports false.



```teal
function tecs.platform.window.Window.hasMouseFocus(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.hide"></a>
#### tecs.platform.window.Window:hide <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Unmaps the window without destroying it.

A claimed swapchain yields no texture while the desktop hides the
window.



```teal
function tecs.platform.window.Window.hide(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform hid the window. |

<a id="tecs.platform.window.Window.id"></a>
#### tecs.platform.window.Window:id <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns the id carried in a window event's `which` field.



```teal
function tecs.platform.window.Window.id(self): integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the platform window id, or zero after `destroy`. |

<a id="tecs.platform.window.Window.isAlwaysOnTop"></a>
#### tecs.platform.window.Window:isAlwaysOnTop <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the desktop keeps the window above others.



```teal
function tecs.platform.window.Window.isAlwaysOnTop(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isBordered"></a>
#### tecs.platform.window.Window:isBordered <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window has a title bar and frame.



```teal
function tecs.platform.window.Window.isBordered(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isFocusable"></a>
#### tecs.platform.window.Window:isFocusable <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window may take keyboard focus.



```teal
function tecs.platform.window.Window.isFocusable(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isFullscreen"></a>
#### tecs.platform.window.Window:isFullscreen <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window occupies a fullscreen display.



```teal
function tecs.platform.window.Window.isFullscreen(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isMaximized"></a>
#### tecs.platform.window.Window:isMaximized <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window fills the display's usable bounds.



```teal
function tecs.platform.window.Window.isMaximized(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isMinimized"></a>
#### tecs.platform.window.Window:isMinimized <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window occupies its minimized state.



```teal
function tecs.platform.window.Window.isMinimized(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isOccluded"></a>
#### tecs.platform.window.Window:isOccluded <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether other windows cover this window completely.



```teal
function tecs.platform.window.Window.isOccluded(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isResizable"></a>
#### tecs.platform.window.Window:isResizable <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the user can resize the window by dragging an edge.



```teal
function tecs.platform.window.Window.isResizable(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.isVisible"></a>
#### tecs.platform.window.Window:isVisible <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the desktop shows the window.

Minimizing the window does not hide it.



```teal
function tecs.platform.window.Window.isVisible(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false for a hidden or destroyed window. |

<a id="tecs.platform.window.Window.keyboardGrab"></a>
#### tecs.platform.window.Window:keyboardGrab <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether the window intercepts desktop keyboard shortcuts.



```teal
function tecs.platform.window.Window.keyboardGrab(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false after `destroy`. |

<a id="tecs.platform.window.Window.maximize"></a>
#### tecs.platform.window.Window:maximize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Maximizes the window to the display's usable bounds.



```teal
function tecs.platform.window.Window.maximize(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.maximumSize"></a>
#### tecs.platform.window.Window:maximumSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the maximum resize limit.



```teal
function tecs.platform.window.Window.maximumSize(self): integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the maximum width, or zero when unset. |
| `integer` | Returns the maximum height, or zero when unset. |

<a id="tecs.platform.window.Window.minimize"></a>
#### tecs.platform.window.Window:minimize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Minimizes the window to the taskbar or dock.



```teal
function tecs.platform.window.Window.minimize(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.minimumSize"></a>
#### tecs.platform.window.Window:minimumSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the minimum resize limit.



```teal
function tecs.platform.window.Window.minimumSize(self): integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the minimum width, or zero when unset. |
| `integer` | Returns the minimum height, or zero when unset. |

<a id="tecs.platform.window.Window.mouseGrab"></a>
#### tecs.platform.window.Window:mouseGrab <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns whether pointer confinement applies to the focused window.



```teal
function tecs.platform.window.Window.mouseGrab(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false when the window lacks focus or after `destroy`. |

<a id="tecs.platform.window.Window.mouseRect"></a>
#### tecs.platform.window.Window:mouseRect <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the pointer confinement region.



```teal
function tecs.platform.window.Window.mouseRect(
    self
): integer, integer, integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the horizontal offset in screen coordinates. |
| `integer` | Returns the vertical offset in screen coordinates. |
| `integer` | Returns the width in screen coordinates. |
| `integer` | Returns the height in screen coordinates. All four values contain zero when unset. |

<a id="tecs.platform.window.Window.opacity"></a>
#### tecs.platform.window.Window:opacity <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the window opacity.



```teal
function tecs.platform.window.Window.opacity(self): number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `number` | Returns a value from 0 for invisible to 1 for solid, zero after `destroy`, or 1 on a platform without compositing. |

<a id="tecs.platform.window.Window.pixelDensity"></a>
#### tecs.platform.window.Window:pixelDensity <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Returns the ratio of drawable pixels to screen coordinates.



```teal
function tecs.platform.window.Window.pixelDensity(self): number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `number` | Returns the ratio, 1 without high-density drawing, or zero after `destroy`. |

<a id="tecs.platform.window.Window.position"></a>
#### tecs.platform.window.Window:position <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the top-left corner in desktop screen coordinates.



```teal
function tecs.platform.window.Window.position(self): integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the horizontal position, or zero after `destroy`. |
| `integer` | Returns the vertical position, or zero after `destroy`. |

<a id="tecs.platform.window.Window.progress"></a>
#### tecs.platform.window.Window:progress <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads taskbar or dock progress.



```teal
function tecs.platform.window.Window.progress(
    self
): Window.Progress, number
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| [`Window.Progress`](/modules/platform/window/#tecs.platform.window.Window.Progress) | Returns the current state, or `"none"` after `destroy`. |
| `number` | Returns progress from 0 to 1, or zero after `destroy`. |

<a id="tecs.platform.window.Window.raise"></a>
#### tecs.platform.window.Window:raise <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Brings the window forward and requests input focus.

Prefer `flash` when the user did not request a focus change.



```teal
function tecs.platform.window.Window.raise(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.restore"></a>
#### tecs.platform.window.Window:restore <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Restores a minimized or maximized window.



```teal
function tecs.platform.window.Window.restore(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.safeArea"></a>
#### tecs.platform.window.Window:safeArea <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Reads the unobstructed region inside the window.

A desktop normally returns the whole window. Phones and handhelds
may exclude notches, rounded corners or gesture areas.



```teal
function tecs.platform.window.Window.safeArea(
    self
): integer, integer, integer, integer
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `integer` | Returns the horizontal offset in screen coordinates. |
| `integer` | Returns the vertical offset in screen coordinates. |
| `integer` | Returns the width in screen coordinates. |
| `integer` | Returns the height in screen coordinates. |

<a id="tecs.platform.window.Window.setAlwaysOnTop"></a>
#### tecs.platform.window.Window:setAlwaysOnTop <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Enables or disables always-on-top behavior.



```teal
function tecs.platform.window.Window.setAlwaysOnTop(
    self, onTop: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `onTop` | `boolean` | The caller chooses whether to keep the window above others. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the change. |

<a id="tecs.platform.window.Window.setAspectRatio"></a>
#### tecs.platform.window.Window:setAspectRatio <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Constrains the width-over-height ratio.

Equal values pin the window to one shape.



```teal
function tecs.platform.window.Window.setAspectRatio(
    self, minimum: number, maximum: number
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `minimum` | `number` | The caller supplies the minimum ratio, or zero to remove that bound. |
| `maximum` | `number` | The caller supplies the maximum ratio, or zero to remove that bound. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the bounds. |

<a id="tecs.platform.window.Window.setBordered"></a>
#### tecs.platform.window.Window:setBordered <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Adds or removes the title bar and frame.

The client area keeps its size.



```teal
function tecs.platform.window.Window.setBordered(
    self, bordered: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `bordered` | `boolean` | The caller chooses whether to show desktop decoration. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the change. |

<a id="tecs.platform.window.Window.setFocusable"></a>
#### tecs.platform.window.Window:setFocusable <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Allows or forbids keyboard focus.

A non-focusable window suits an overlay.



```teal
function tecs.platform.window.Window.setFocusable(
    self, focusable: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `focusable` | `boolean` | The caller chooses whether the window may take focus. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the change. |

<a id="tecs.platform.window.Window.setFullscreen"></a>
#### tecs.platform.window.Window:setFullscreen <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Enters or leaves fullscreen.

With no selected mode, fullscreen uses the desktop resolution.
With a mode from `setFullscreenMode`, it changes the display mode.
The swapchain follows the new size on the next acquired frame.



```teal
function tecs.platform.window.Window.setFullscreen(
    self, fullscreen: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `fullscreen` | `boolean` | The caller passes true to enter fullscreen or false to leave it. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setFullscreenMode"></a>
#### tecs.platform.window.Window:setFullscreenMode <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Selects the video mode used by fullscreen.

The mode must come from `fullscreenModes` or
`closestFullscreenMode`; a hand-built record raises. Nil selects
borderless fullscreen at the desktop resolution.



```teal
function tecs.platform.window.Window.setFullscreenMode(
    self, mode: Window.DisplayMode
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `mode` | [`Window.DisplayMode`](/modules/platform/window/#tecs.platform.window.Window.DisplayMode) | The caller supplies a platform mode, or nil for borderless fullscreen. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the mode. |

<a id="tecs.platform.window.Window.setHitRegions"></a>
#### tecs.platform.window.Window:setHitRegions <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Replaces the regions used for native window hit testing.

The first region containing a point wins. Left and top edges are
included; right and bottom edges are excluded. SDL copies no Lua
state: Rust copies every record before this call returns and answers
the native callback without entering LuaJIT.

Pass nil or an empty list to restore ordinary desktop hit testing.
Regions normally accompany a borderless window and must be updated
after layout changes that move a title bar or resize border.



```teal
function tecs.platform.window.Window.setHitRegions(
    self, regions: {Window.HitRegion}
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `regions` | `{`[`Window.HitRegion`](/modules/platform/window/#tecs.platform.window.Window.HitRegion)`}` | The caller supplies special regions in priority order, or nil to clear every region. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform installed, replaced or cleared the regions. |

<a id="tecs.platform.window.Window.setIcon"></a>
#### tecs.platform.window.Window:setIcon <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Sets the image the desktop shows for the window.

The call decodes the file synchronously.



```teal
function tecs.platform.window.Window.setIcon(
    self, path: string
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `path` | `string` | The caller supplies the image path. Nil raises. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false when the decoder cannot read the file or after `destroy`. |

<a id="tecs.platform.window.Window.setKeyboardGrab"></a>
#### tecs.platform.window.Window:setKeyboardGrab <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Enables or disables interception of desktop keyboard shortcuts.

Some desktops refuse this or require user permission.



```teal
function tecs.platform.window.Window.setKeyboardGrab(
    self, grabbed: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `grabbed` | `boolean` | The caller chooses whether to intercept shortcuts while focused. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setMaximumSize"></a>
#### tecs.platform.window.Window:setMaximumSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Sets the maximum resize limit.



```teal
function tecs.platform.window.Window.setMaximumSize(
    self, width: integer, height: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `width` | `integer` | The caller supplies the maximum width, or zero to remove that limit. |
| `height` | `integer` | The caller supplies the maximum height, or zero to remove that limit. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the limits. |

<a id="tecs.platform.window.Window.setMinimumSize"></a>
#### tecs.platform.window.Window:setMinimumSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Sets the minimum resize limit.



```teal
function tecs.platform.window.Window.setMinimumSize(
    self, width: integer, height: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `width` | `integer` | The caller supplies the minimum width, or zero to remove that limit. |
| `height` | `integer` | The caller supplies the minimum height, or zero to remove that limit. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the limits. |

<a id="tecs.platform.window.Window.setMouseGrab"></a>
#### tecs.platform.window.Window:setMouseGrab <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Confines the pointer to the window or releases it.

Unlike relative mouse mode, this leaves the pointer visible. An
unfocused window records the request and resumes it on focus.



```teal
function tecs.platform.window.Window.setMouseGrab(
    self, grabbed: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `grabbed` | `boolean` | The caller chooses whether to confine the pointer. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setMouseRect"></a>
#### tecs.platform.window.Window:setMouseRect <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Confines the pointer to part of the window.

This is independent of `setMouseGrab`. Call with no arguments to
remove the region.



```teal
function tecs.platform.window.Window.setMouseRect(
    self, x: integer, y: integer, width: integer, height: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `x` | `integer` | The caller supplies the horizontal offset, or nil to remove the region. |
| `y` | `integer` | The caller supplies the vertical offset with `x`. |
| `width` | `integer` | The caller supplies the region width with `x`. |
| `height` | `integer` | The caller supplies the region height with `x`. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setOpacity"></a>
#### tecs.platform.window.Window:setOpacity <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Sets the window opacity.



```teal
function tecs.platform.window.Window.setOpacity(
    self, opacity: number
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `opacity` | `number` | The caller supplies a value from 0 for invisible to 1 for solid. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the desktop accepted the change. |

<a id="tecs.platform.window.Window.setPosition"></a>
#### tecs.platform.window.Window:setPosition <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Moves the window in desktop screen coordinates.

The coordinate space spans all displays and may contain negative
positions.



```teal
function tecs.platform.window.Window.setPosition(
    self, x: integer, y: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `x` | `integer` | The caller supplies the horizontal position. |
| `y` | `integer` | The caller supplies the vertical position. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setProgress"></a>
#### tecs.platform.window.Window:setProgress <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Shows progress on the taskbar or dock.



```teal
function tecs.platform.window.Window.setProgress(
    self, state: Window.Progress, value: number
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `state` | [`Window.Progress`](/modules/platform/window/#tecs.platform.window.Window.Progress) | The caller supplies `"none"`, `"indeterminate"`, `"normal"`, `"paused"` or `"error"`. An unknown value raises. |
| `value` | `number` | The caller supplies progress from 0 to 1. The desktop reads it for `"normal"`, `"paused"` and `"error"`; omit it to keep the current value. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the desktop accepted the state and value. |

<a id="tecs.platform.window.Window.setResizable"></a>
#### tecs.platform.window.Window:setResizable <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Allows or forbids user resizing.



```teal
function tecs.platform.window.Window.setResizable(
    self, resizable: boolean
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `resizable` | `boolean` | The caller chooses whether the user may resize the window. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the change. |

<a id="tecs.platform.window.Window.setSize"></a>
#### tecs.platform.window.Window:setSize <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Resizes the window in screen coordinates.

A fullscreen window ignores the request. A compositor may apply it
after this returns; use `sync` before an immediate readback.



```teal
function tecs.platform.window.Window.setSize(
    self, width: integer, height: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `width` | `integer` | The caller supplies the new width in screen coordinates. |
| `height` | `integer` | The caller supplies the new height in screen coordinates. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform accepted the request. |

<a id="tecs.platform.window.Window.setTitle"></a>
#### tecs.platform.window.Window:setTitle <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Sets the title and updates the public `title` field.



```teal
function tecs.platform.window.Window.setTitle(
    self, title: string
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `title` | `string` | The caller supplies the new title. Nil raises. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform changed the title. |

<a id="tecs.platform.window.Window.show"></a>
#### tecs.platform.window.Window:show <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Maps a hidden window onto the desktop.



```teal
function tecs.platform.window.Window.show(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the platform showed the window. |

<a id="tecs.platform.window.Window.showSystemMenu"></a>
#### tecs.platform.window.Window:showSystemMenu <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Opens the desktop's standard menu for this window.

This supplies the platform menu used for operations such as moving
the window between displays or workspaces. Unsupported desktops
ignore the request.



```teal
function tecs.platform.window.Window.showSystemMenu(
    self, x: integer, y: integer
): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |
| `x` | `integer` | The caller supplies the horizontal position relative to the top-left of the window's client area. |
| `y` | `integer` | The caller supplies the vertical position relative to the top-left of the window's client area. |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns whether the desktop accepted the request. |

<a id="tecs.platform.window.Window.sync"></a>
#### tecs.platform.window.Window:sync <span class="tealdoc-kind-badge tealdoc-kind-instance">Instance</span>

Waits for the compositor to apply pending window changes.

Size, position and fullscreen changes may land after their setters
return. Call this only when code must read a changed value back
immediately.



```teal
function tecs.platform.window.Window.sync(self): boolean
```

##### Arguments

| Name | Type | Description |
| --- | --- | --- |
| `self` | `Window` |  |

##### Returns

| Type | Description |
| --- | --- |
| `boolean` | Returns false when the platform times out or after `destroy`. |