gpu

module pkg::alloy::windowsource

Windows, their events and input on every platform (PLAN.md, stage F1): Wayland on Linux, Win32 on Windows, AppKit on macOS (F7), a canvas in the browser, and a headless window for tests. A program gives run its state and a handler, which the platform's event loop calls with each event until the program closes the window.

import pkg::alloy::window;

fn on_event(clicks: &var u32, window: &var Window, event: &Event) {
    match (event) {
        ::Button |&b| {
            if (b.pressed) {
                clicks += 1;
            }
        }
        ::CloseRequested {
            window.close();
        }
        else {}
    }
}

fn main() -> i32 {
    return run(&WindowConfig::titled(&"Clicks"), 0 to u32, on_event);
}

What a program uses of the platform beyond the window it installs: screen readers (window.install_access(), which pkg::alloy::ui_access calls) and file dialogs and drops (window.install_files(), which pkg::alloy::ui_app calls); a program installing neither links none of their code.

Sizes and positions are in physical pixels, the display's own; the scale says how many make one logical pixel (2 on a typical high-density display), so a program draws scale times larger to look the same everywhere.

## How it was built

Notes kept from each stage as it was finished, the sizes and numbers of their day; what changed since is in REVIEW.md and the history.

**F1 as built** (2026-10-12):

**F6a as built** (2026-10-13):

**F6b as built** (2026-10-13), with the files and drops every platform shares:

**F6c as built** (2026-10-13):

**F7a as built** (2026-10-13), not yet run on a Mac:

**F7b as built** (2026-10-13), not yet run on a Mac:

**F7c as built** (2026-10-13), not yet run on a Mac:

**Fonts arriving** (2026-10-14; decisions/F10.md, question 6A):

**F11a as built** (2026-10-15; decisions/F11.md, question 7A and "Accessibility on each platform"):

**F11b as built** (2026-10-15; decisions/F11.md, "Choices" and "Accessibility on each platform"):

**F11c as built** (2026-10-15; decisions/F11.md, "Screens", question 6B, and "Accessibility on each platform"):

**F11d as built** (2026-10-15; decisions/F11.md, "Dates and times" and "Accessibility on each platform"):

**F11e as built** (2026-10-15; decisions/F11.md, "Reduced motion"): window.reduced_motion(), read as the window opens, and Event::ReducedMotion(bool) as it changes. Linux: the settings portal (org.freedesktop.portal.Settings.Read, a second at most) for GNOME's enable-animations, else KDE's AnimationDurationFactor at 0, and its SettingChanged signal, the portal's session bus now joined as the window opens; Windows: SPI_GETCLIENTAREAANIMATION and WM_SETTINGCHANGE; macOS (built only): NSWorkspace's accessibilityDisplayShouldReduceMotion and its notification, observed by the window's delegate; the web: `matchMedia("(prefers-reduced-motion: reduce)") and its change`; headless: off but as a script's event says. The test portal (dbus/fake_portal.alloy) answers the setting.

**F12a as built** (2026-10-15; decisions/F12.md, "Timers"): on the web the page shown again (visibilitychange to visible, the page event Timer with a set) gives an Event::Timer whether or not the deadline has come, a hidden page's setTimeout running late; the fake page's ALLOY_PAGE=shown hides and shows it. A headless run's Replay counts wakes, the deadlines wake_at changed.

**F12c as built** (2026-10-16; decisions/F12.md, "Waiting in ui"):

**F12d as built** (2026-10-16; decisions/F12.md, "Storage"): WindowConfig.app (default "", app_name() giving the title then), kept as Window.app and sent as the toplevel's app_id on Wayland, window.app_name() giving it to pkg::alloy::ui's store as the app starts (2026-10-17, question 23B); the fake page's localStorage, kept in the file ALLOY_PAGE_STORAGE names and refusing every write with ALLOY_PAGE=full.

**Closing refused** (2026-10-17; decisions/showcase.md, question 6A): Event::CloseRequested comes on every platform and the window stays open until the program calls close (Wayland's xdg_toplevel.close, Win32's WM_CLOSE, AppKit's windowShouldClose: and applicationShouldTerminate: answered no, as since F1 and F7a); the web gains it from beforeunload, the page's handler giving the event and, when the program did not close its window, asking the browser to ask the person (its own words: the most a page may do). Navigated now sets the window's history entry, so an entry the program sets after it goes to the page only when it differs: a program refusing to go back is put back deeper. tests/history in node's page leaves the page, which the program refuses.

**Fields in error** (2026-10-17; showcase.md, question 11A): Semantics.invalid, a field whose value is refused, its description saying why: UI Automation's IsDataValidForForm false and invalid=true in AriaProperties, AT-SPI's INVALID_ENTRY state (with its StateChanged), aria-invalid on the web. NSAccessibility has no property for it (the old API's AXInvalid attribute only), so on macOS the message as the element's help is what VoiceOver says, not yet run on a Mac. tests/access gives a field in error (read in node's page), tests/atspi and tests/automation an empty field "Required".

**Checked menu items** (2026-10-17; showcase.md, question 12A): Role::MenuItemCheckbox with checked: UI Automation's MenuItem with the Toggle pattern, AT-SPI's CHECK_MENU_ITEM with its CHECKABLE and CHECKED states, ARIA's menuitemcheckbox with aria-checked, and macOS's AXMenuItem with the value 0 or 1. tests/access gives one.

**Secret input** (2026-10-20; decisions/F13.md, question 13A): Semantics.secret, a field hiding what is typed, its value the dots it shows: UI Automation's IsPassword (the Value pattern giving the dots), AT-SPI's PASSWORD_TEXT role (its Text the dots), on the web the layer's node an <input type="password"> holding the dots, as a page's own password field reads (no ARIA role says it), and on macOS the AXSecureTextField subrole, not yet run on a Mac. window.set_secret_input(secret) tells the input method: Wayland's text-input-v3 content type (purpose password, hints hidden_text and sensitive_data; enabled again to go back to normal), on Windows no input context associated, as an ES_PASSWORD edit has (characters still as WM_CHAR), on the web a hidden <input type="password"> taking the keyboard instead of the textarea, and on macOS keys skipping the input method and EnableSecureEventInput held while the window has the focus, as NSSecureTextField does. Headless: Replay.secret_input. tests/access gives a password's field.

**F14a as built** (2026-10-20; decisions/F14.md, "Right to left"): WindowConfig.languages lists the languages an app has, its first the one it falls back to (["en"] by default), which pkg::alloy::ui chooses among. window.set_language(tag, right_to_left) says what its content is in, kept as language() and right_to_left() and taken by each platform as it asks (Requests.language): UI Automation's Culture property, the LCID LocaleNameToLCID gives, on every node; AT-SPI's GetLocale and Locale (ar_EG.UTF-8, as POSIX writes it); on the web the layer's lang and dir; on macOS the view's userInterfaceLayoutDirection (NSAccessibility has no language of its own for an element), not yet run on a Mac. Semantics.right_to_left marks a node reading the other way than the window, the web's dir on it (UI Automation and AT-SPI have no direction for a node). Headless: Replay.language and right_to_left. Tests: tests/access (lang, dir and a node's own), tests/atspi (the locale of an app in British English), window/tests.alloy (the replay keeping the last).

**F14b as built** (2026-10-20; decisions/F14.md, "Text for screen readers"): AccessNode.text, a TextMap (graphemes' starts and edges, word starts, lines with their boxes in the node's pixels and direction, one TextFormat) that pkg::alloy::ui sends with a field and a text of several lines while a screen reader reads, never on the web; maps compare by revision alone. text_ranges.alloy answers from one for every platform: unit_at and moved by TextUnit (a character a grapheme, a word to the next one's start, a line as drawn, a paragraph to a line break, the document), boxes (one a line, more where the direction changes, the caret's a pixel wide), offset_at, grapheme_at, visible_lines, clamped, and TextMap::plain for a value no layout was sent for. A secret field's map is of its dots.

**R6f as built** (2026-10-26; REFOCUS.md, question 3B, and the portal and drops under pkg::alloy::ui_app): what a program installs.

**14B as built** (2026-10-27; REFOCUS.md, question 14): the page's accessibility layer in a module of its own, layer.alloy with layer.web.js, whose externs only the installed layer calls, so a web program bundles its JavaScript only when it installs screen readers; it reaches the canvas, its scale, events, keys and focus through alloy.page, which browser.web.js fills, and records there the elements it adds (removed as the window closes) and the layer (part of the window when focus moves). The counter's glue 9.8 KB smaller.

type Sizesource

exp type Size = struct

A size in pixels.

Fields

exp width: u32
exp height: u32

type Pointsource

exp type Point = struct

A position in pixels from the window's top left.

Fields

exp x: f32
exp y: f32

type Areasource

exp type Area = struct

A rectangle in pixels from the window's top left.

Fields

exp x: f32
exp y: f32
exp width: f32
exp height: f32

type WindowConfigsource

exp type WindowConfig = struct

How the window opens.

Fields

exp title: &[u8]
exp size: Size

in logical pixels

exp resizable: bool
exp app: &[u8] = &""

the app's name, which its data is kept under (std::storage) and Wayland's app_id; the title when empty

exp languages: &[&[u8]] = &[&"en"]

the languages the app is written in, as BCP 47 tags, its first the one it falls back to: ui lays it out in the first of the system's preferred languages it has, and in that one's direction

Functions

fn WindowConfig::titledsource

exp fn WindowConfig::titled(title: &[u8]) -> WindowConfig

A resizable window of 800 by 600 logical pixels.

fn app_namesource

exp fn app_name(self config: &WindowConfig) -> &[u8]

The name the app's data is kept under: its own, else the title.

type Modifierssource

exp type Modifiers = struct

The modifier keys held during an event.

Fields

exp shift: bool
exp control: bool
exp alt: bool
exp super: bool

the Windows or Command key

Functions

fn Modifiers::nonesource

exp fn Modifiers::none() -> Modifiers

No modifier key held.

type Keysource

exp type Key = enum

A key, by what the keyboard layout makes of it: the same physical key is Character('z') on a QWERTY layout and Character('y') on a QWERTZ one. Text typed comes separately, as Event::Text.

Variants

Character: u32

a key writing a character, as a Unicode code point, lower case: Character(' ') for the space bar

Enter
Escape
Backspace
Tab
Delete
Insert
Left
Right
Up
Down
Home
End
PageUp
PageDown
Function: u8

F1 to F24

Shift
Control
Alt
Super
CapsLock
Menu

the context menu's key

Unknown: u32

the platform's code for the key

type KeyEventsource

exp type KeyEvent = struct

A key pressed or released.

Fields

exp key: Key
exp pressed: bool
exp repeat: bool

a press repeated while the key is held

exp modifiers: Modifiers

type PointerButtonsource

exp type PointerButton = enum

A mouse button, or a pen's or touchpad's equivalent.

Variants

Left
Right
Middle
Back
Forward
Other: u32

type ButtonEventsource

exp type ButtonEvent = struct

A button pressed or released where the pointer is.

Fields

exp button: PointerButton
exp pressed: bool
exp position: Point
exp modifiers: Modifiers

type ScrollEventsource

exp type ScrollEvent = struct

A wheel's or touchpad's scrolling, positive down and to the right.

Fields

exp delta: Point
exp precise: bool

the delta is in physical pixels (a touchpad), not in lines (a wheel's notches)

exp modifiers: Modifiers

type Eventsource

exp type Event = enum

What happens to the window, in the order it happens.

Variants

Resized: Size

the window's size changed, and when it opens; a Redraw follows

Scaled: f32

the scale changed, and when it opens if not 1; a Resized follows

Redraw: Duration

the window needs drawing: when it opens, after a resize, and after request_redraw, paced by the display; the frame's time on the window's clock (now)

Timer

the time wake_at asked for has come

CloseRequested

the user asked to close the window (on the web, to leave or reload the page); it closes when the program calls close, and a program not calling it keeps it open (on the web the browser then asks the person whether to leave, in its own words)

Focused: bool
PointerMoved: Point
PointerLeft
Button: ButtonEvent
Scroll: ScrollEvent
Key: KeyEvent
Text: String

text typed, as UTF-8: a character, or several when an input method commits a composition

Preedit: Preedit

the composition an input method has in progress, which the program shows at the caret in place of the last one, until a Text commits it; an empty one ends it, and comes before the Text

Woken

another task woke the loop through the window's Waker; wakes close together may come as one

Clipboard: String

the clipboard's text, after request_clipboard; empty when it holds none

AccessRequested

a screen reader started reading the window: the program sends its whole accessibility tree, then its changes (update_access)

Action: ActionRequest

what a screen reader asks of a node of the tree

FilesChosen: Chosen

the files a dialog open_files or save_file showed gave, none when cancelled

DragEntered: Dragged

something dragged from another program came over the window, moved over it, left it, or was dropped on it

DragMoved: Point
DragLeft
Dropped: Drop
FontsArrived

on the web, a font the program fetched (pkg::alloy::text's fonts.fetch) has arrived: text laid out before it may show boxes it now covers, to lay out again; never sent elsewhere, where a fetch reads the file at once

Navigated: HistoryEntry

on the web, the browser's Back or Forward, or an address typed, moved to another entry of the page's history (set_history)

ReducedMotion: bool

the system's setting asking for less motion changed: whether it asks now (reduced_motion)

type HistoryEntrysource

exp type HistoryEntry = struct

Where a program is in the page's history: how deep in its own entries, from 1, and its path, which the address shows after a # (/events/42), empty for none.

Fields

exp depth: u64
exp path: String

type Preeditsource

exp type Preedit = struct

Text an input method is composing, not yet typed.

Fields

exp text: String
exp cursor: u64

the input method's caret in the text, in bytes

type FileFiltersource

exp type FileFilter = struct

A kind of file a dialog offers: its name and its patterns, *.png.

Fields

exp name: String
exp patterns: Vector<String>

Functions

fn FileFilter::ofsource

exp fn FileFilter::of(name: &[u8], patterns: &[&[u8]]) -> FileFilter

type FileDialogsource

exp type FileDialog = struct

What a file dialog shows.

Fields

exp title: String = String::empty()
exp filters: Vector<FileFilter> = Vector<FileFilter>::empty()
exp multiple: bool = false

opening: more than one file

exp name: String = String::empty()

saving: the name proposed

type ChosenFilesource

exp type ChosenFile = struct

A file chosen or dropped: its name, and on the desktop its path, on the web its bytes when opened or dropped (a page reaches no paths).

Fields

exp name: String
exp path: Option<String> = ::None
exp bytes: Option<Vector<u8>> = ::None

type Chosensource

exp type Chosen = struct

The files a dialog gave, for the request open_files or save_file returned.

Fields

exp request: u64
exp files: Vector<ChosenFile>

type Draggedsource

exp type Dragged = struct

What is being dragged over the window, where.

Fields

exp position: Point
exp files: bool
exp text: bool

type Dropsource

exp type Drop = struct

What was dropped on the window, where.

Fields

exp position: Point
exp files: Vector<ChosenFile>
exp text: Option<String>

type Rolesource

exp type Role = enum

What a node of the accessibility tree is to a screen reader.

Variants

Unknown

nothing a screen reader shows; its children stand in for it

Window
Group
Label
Button
CheckBox
Slider
TextInput
Image
List
ListItem
ScrollView
Dialog

a layer above the content (decisions/F11.md): a dialog, an alert asking for an answer, a menu and its items, a tooltip

Alert
Menu
MenuItem
Tooltip
ComboBox

choices (F11b): a closed list showing the chosen item, opening a list box of options; radio buttons in a group

ListBox
ListOption
RadioGroup
RadioButton
TabList

screens (F11c): a row of tabs, one selected, showing a view of its own beside it

Tab
Grid

dates (F11d): cells in rows and columns, a calendar's days

GridCell
ProgressBar

waiting (F12c): how much of a piece of work is done, its range's value, or not known without one

MenuItemCheckbox

a menu item turning a setting on or off, checked saying which

type Semanticssource

exp type Semantics = struct

How a node describes itself: its role, what a screen reader says of it and what can be done with it.

Fields

exp role: Role = Role::Unknown
exp label: String = String::empty()
exp value: String = String::empty()

a field's text, a slider's value as said

exp disabled: bool = false
exp focusable: bool = false
exp checked: Option<bool> = ::None

a checkbox's or a checked menu item's state

exp multiline: bool = false
exp range: Option<AccessRange> = ::None

a slider's

exp selection: Option<[u64 : 2]> = ::None

a field's anchor and caret, in bytes

exp modal: bool = false

a dialog keeping the pointer and the keyboard from the rest

exp expanded: Option<bool> = ::None

whether what it opens is open: a menu item's submenu

exp description: String = String::empty()

what more a screen reader says of it after its label: a tooltip's text

exp selected: Option<bool> = ::None

whether an option or a tab is the one selected

exp position: Option<[u32 : 2]> = ::None

where an option or a radio is among its group's, from 1, and how many there are: "2 of 3"

exp cell: Option<[u32 : 2]> = ::None

a grid cell's row and column, from 0

exp current: bool = false

the current one of its kind: today among a calendar's days

exp busy: bool = false

what it shows is still coming: a list loading

exp invalid: bool = false

a field whose value is refused, its description saying why

exp required: bool = false

a field a form needs filled in

exp secret: bool = false

a field hiding what is typed, a password: its value is the dots shown, one a character

exp right_to_left: Option<bool> = ::None

a subtree reading in a direction of its own, against what holds it: true right to left (the web's dir on its element)

type AccessRangesource

exp type AccessRange = struct

Fields

exp value: f64
exp minimum: f64
exp maximum: f64
exp step: f64

type AccessNodesource

exp type AccessNode = struct

A node of the tree: its semantics, where it is in the window, in pixels, its children in order, and a field's text or a text of several lines as laid out, while a screen reader reads (text_ranges.alloy).

Fields

exp id: u64
exp semantics: Semantics
exp bounds: Area
exp children: Vector<u64>
exp text: Option<TextMap> = ::None

Functions

type TextMapsource

exp type TextMap : Equal = struct

A node's text as laid out (decisions/F14.md, F14b): its value, a field's, or else its label, cut into graphemes, words and lines, positions in bytes and pixels from the node's top left. Maps compare by revision alone.

Fields

exp revision: u32

changes whenever anything below does

exp graphemes: Vector<u32>

where each grapheme starts, then the text's end

exp edges: Vector<[f32 : 2]>

each grapheme's left and right on its line

exp words: Vector<u32>

where each word starts (UAX #29)

exp lines: Vector<TextLine>
exp format: TextFormat

one: a node's text has one style

Functions

fn equalssource

exp fn equals(self map: &TextMap, other: &TextMap) -> bool

type TextLinesource

exp type TextLine = struct

A line as drawn: its bytes, its box and whether it reads right to left.

Fields

exp start: u32
exp end: u32
exp box: Area
exp right_to_left: bool

type TextFormatsource

exp type TextFormat = struct

How a node's text is drawn, as screen readers tell it.

Fields

exp family: String
exp size: f32

in pixels

exp weight: u32
exp color: [u8 : 4]

red, green, blue, alpha

exp language: String

BCP 47

exp heading: bool
exp read_only: bool

type TreeUpdatesource

exp type TreeUpdate = struct

What changed in the tree: the nodes new or changed, whole, and those gone; the root and the focused node as they are now.

Fields

exp nodes: Vector<AccessNode>
exp removed: Vector<u64>
exp root: u64
exp focus: Option<u64>

type Actionsource

exp type Action = enum

What a screen reader asks of a node.

Variants

Click
Focus
Increment
Decrement
SetValue: String
ScrollIntoView
SetSelection: [u64 : 2]

anchor and caret, in bytes

Expand

open what it opens: a submenu

Collapse
Dismiss

close a dialog or menu, as Escape does

Select

choose an option, a radio, a tab or a day

type ActionRequestsource

exp type ActionRequest = struct

Fields

exp node: u64
exp action: Action

type Announcementsource

exp type Announcement = struct

What a screen reader is to say at once, without the focus moving: a toast's text; assertive interrupts what it is saying.

Fields

exp text: String
exp assertive: bool

type AccessTreesource

exp type AccessTree = struct

The tree as the updates sent so far leave it, with each node's parent.

Fields

exp nodes: Map<u64, AccessNode>
exp root: u64
exp focus: Option<u64>

Functions

fn AccessTree::emptysource

exp fn AccessTree::empty() -> AccessTree

fn applysource

exp fn apply(self tree: &var AccessTree, update: TreeUpdate)

fn try_parent_ofsource

exp fn try_parent_of(self tree: &AccessTree, id: u64) -> Option<u64>

The node holding a node, none for the root or one not in the tree.

fn node_atsource

exp fn node_at(self tree: &AccessTree, from: u64, point: Point) -> Option<u64>

The deepest node under from holding the point, in the window's pixels, the last child holding it at each level.

type Cursorsource

exp type Cursor = enum

How the pointer looks over the window.

Variants

Arrow
Hand

over something to click

Text

over text to select or type into

type Wakersource

exp type Waker = enum

Wakes a window's event loop from another task (window.waker()), its handler then given an Event::Woken: tasks finishing work tell the window this way. Copied to as many tasks as need it; one woken after its window closed does nothing.

Variants

None

a headless window, which no other task wakes

Eventfd: i32

Wayland's loop polls it beside the compositor's socket

Win32: c_pointer

the HWND, posted a message

AppKit: AppKitWaker
Page

the page's, which a callback of the browser's wakes: a message posted to it, taken before the next frame

Functions

type AppKitWakersource

exp type AppKitWaker = struct

The main run loop's source a Waker signals on macOS, and the CoreFoundation functions signalling it, which any thread may call.

type Targetsource

exp type Target = enum

The native objects a GPU surface draws into, for pkg::alloy::gpu.

Variants

None

a headless window, or one only present draws into

Wayland: WaylandTarget
Win32: Win32Target
AppKit: AppKitTarget
Canvas: u32

the page's canvas, marked data-alloy-window with the number

type WaylandTargetsource

exp type WaylandTarget = struct

Fields

exp display: c_pointer

the wl_display

exp surface: c_pointer

the wl_surface

type Win32Targetsource

exp type Win32Target = struct

Fields

exp instance: c_pointer

the HINSTANCE

exp window: c_pointer

the HWND

type AppKitTargetsource

exp type AppKitTarget = struct

Fields

exp window: c_pointer

the NSWindow

exp view: c_pointer

its content view, an NSView whose layer is drawn into

type Windowsource

exp type Window = struct

The window the handler is given with each event. What the handler asks of it takes effect once the handler returns.

Functions

fn app_namesource

exp fn app_name(self window: &Window) -> &[u8]

The name the app's data is kept under (WindowConfig.app_name()).

fn set_cursorsource

exp fn set_cursor(self window: &var Window, cursor: Cursor)

Shows the cursor while the pointer is over the window.

fn cursorsource

exp fn cursor(self window: &Window) -> Cursor

fn install_accesssource

exp fn install_access(self window: &var Window)

Lets the platform's screen readers reach the window: AT-SPI on Linux (with the settings portal's wish for less motion), UI Automation on Windows, NSAccessibility on macOS, and on the web a layer of elements behind a "Turn on accessibility" button. Until then nothing gives Event::AccessRequested and update_access and announce do nothing; a program never calling it links none of them (pkg::alloy::ui_access calls it).

fn install_filessource

exp fn install_files(self window: &var Window)

Lets files be chosen through the platform's dialogs and dropped on the window: the desktop portal on Linux (with its wish for less motion), the shell's dialogs and OLE's drops on Windows, NSOpenPanel, NSSavePanel and the view's dragging on macOS, the page's file input, file pickers and drops. open_files and save_file install them; without, nothing dropped reaches the program, and a program never installing them links none of them (pkg::alloy::ui_app calls it).

fn update_accesssource

exp fn update_access(self window: &var Window, update: TreeUpdate)

Sends the accessibility tree's changes to the platform's screen readers, after an Event::AccessRequested.

fn announcesource

exp fn announce(self window: &var Window, text: String, assertive: bool)

Has the platform's screen readers say the text, politely or, when assertive, at once, once the tree's updates are sent.

fn set_clipboardsource

exp fn set_clipboard(self window: &var Window, text: String)

Puts the text on the clipboard.

fn request_clipboardsource

exp fn request_clipboard(self window: &var Window)

Asks for the clipboard's text, which an Event::Clipboard gives.

fn open_filessource

exp fn open_files(self window: &var Window, dialog: FileDialog) -> u64

Shows a dialog choosing files to open; an Event::FilesChosen with the returned request gives them.

fn save_filesource

exp fn save_file(self window: &var Window, dialog: FileDialog) -> u64

Shows a dialog choosing where to save, dialog.name proposed; an Event::FilesChosen with the returned request gives the file, which save_bytes writes.

fn save_bytessource

exp fn save_bytes(self window: &var Window, file: &ChosenFile, bytes: &[u8]) -> bool

Writes the bytes into a file save_file gave: at its path on the desktop, and on the web through the page (where the browser lets a page write a chosen file) or as a download; whether it was written or given to the page.

fn nowsource

exp fn now(self window: &Window) -> Duration

The time on the window's clock: monotonic, from when the window opened; a headless window's stands still but as its script moves it.

fn wake_atsource

exp fn wake_at(self window: &var Window, at: Option<Duration>)

Asks for an Event::Timer at the time on the window's clock, or after; each call replaces the time the last asked for, and None asks for none.

fn set_historysource

exp fn set_history(self window: &var Window, depth: u64, path: String)

Keeps the page's history in step with where the program is: a deeper entry goes into the history after the one shown (the browser's Back then giving Event::Navigated), a shallower one goes back to it and a new path replaces the shown entry's; an empty path leaves the address as it is. Only a page has a history: elsewhere this does nothing.

fn set_languagesource

exp fn set_language(self window: &var Window, tag: &[u8], right_to_left: bool)

Tells screen readers the language the window's content is in, a BCP 47 tag, and whether it reads right to left: UI Automation's Culture, AT-SPI's locale, the accessibility layer's lang and dir on the web, the view's layout direction on macOS.

fn languagesource

exp fn language(self window: &Window) -> &[u8]

The language set_language gave, "en" until then.

fn right_to_leftsource

exp fn right_to_left(self window: &Window) -> bool

fn reduced_motionsource

exp fn reduced_motion(self window: &Window) -> bool

Whether the system asks programs for less motion: GNOME's animations off or KDE's at no length through the settings portal, Windows' "Animation effects" off, macOS's "Reduce motion", a page's prefers-reduced-motion; never in a headless window but as its script says. Event::ReducedMotion tells a change.

fn start_pathsource

exp fn start_path(self window: &Window) -> &[u8]

The path the page was opened or reloaded at, after the address's #; empty elsewhere.

fn wakersource

exp fn waker(self window: &Window) -> Waker

What wakes the window's loop from another task.

fn wakesource

exp fn wake(self waker: &Waker)

Wakes the window's loop, which gives its handler an Event::Woken.

fn sizesource

exp fn size(self window: &Window) -> Size

The size in physical pixels.

fn scalesource

exp fn scale(self window: &Window) -> f32

Physical pixels per logical pixel.

fn focusedsource

exp fn focused(self window: &Window) -> bool

Whether the window has the keyboard.

fn titlesource

exp fn title(self window: &Window) -> &[u8]

The title the window shows.

fn set_titlesource

exp fn set_title(self window: &var Window, title: &[u8])

Changes the title the window shows.

fn request_redrawsource

exp fn request_redraw(self window: &var Window)

Asks for a Redraw event when the display is next ready for a frame: called while handling Redraw, it draws one frame after another.

fn closesource

exp fn close(self window: &var Window)

Closes the window, which ends run once the handler returns.

fn set_text_inputsource

exp fn set_text_input(self window: &var Window, area: Option<Area>)

Turns the platform's input method on while a text field has the keyboard, giving the caret's area, which the input method's own windows keep clear of: compositions then come as Preedit events. ::None turns it off, as it starts. Text typed comes as Text events either way.

fn set_secret_inputsource

exp fn set_secret_input(self window: &var Window, secret: bool)

Tells the input method whether the text typed is a password, hidden as it is typed: then nothing composes and nothing typed is remembered or suggested (Wayland's content purpose, no input context on Windows, a password input on the web, secure input on macOS).

fn presentsource

exp fn present(self window: &var Window, pixels: &[u32], size: Size)

Shows the pixels, size of them row by row from the top left, each 0xRRGGBB (the top byte unused): software drawing, for a window no GPU surface draws into. The window shows them scaled to its size when the two differ.

fn targetsource

exp fn target(self window: &Window) -> Target

The native objects a GPU surface draws into.

fn surface_presentedsource

exp fn surface_presented(self window: &var Window)

Tells the window a GPU surface presented a frame into it, in place of present, for pkg::alloy::gpu: the window then neither draws its own frame nor waits for the display before the next Redraw, which the surface's presenting paces.

fn runsource

exp fn run<S>(config: &WindowConfig, state: S, handler: |=| (&var S, &var Window, &Event)) -> i32

Opens the window and runs the platform's event loop, calling the handler with the state and each event until the window closes; gives the exit status for main, 1 when no window can open (the reason printed). In a browser, whose event loop goes on after main returns, it returns 0 at once, leaving the window running.