Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/window/system"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
handle |
std/window/handle |
system.dodo |
heap |
std/window/heap |
system.dodo |
mem |
core/mem |
system.dodo |
ptr |
core/ptr |
system.dodo |
raw |
std/window/raw |
system.dodo |
Backend
Struct · Source
pub struct Backend {
}
Backend.connect
Function · Source
pub fn connect() -> void!raw.Error
Backend.disconnect
Function · Source
Close every window and the connection.
pub fn disconnect()
Backend.open
Function · Source
Open a window and return its id. Without a pixel buffer the window system never repaints it; a GPU program draws into it instead.
pub fn open(title: &str, width: u32, height: u32, resizable: bool, pixel_buffer: bool) -> u32!raw.Error
Backend.close
Function · Source
Closing an unknown or closed window does nothing.
pub fn close(id: u32)
Backend.size
Function · Source
The drawing area’s size in pixels as of the last event; false once the window is closed.
pub fn size(id: u32, width: &mut u32, height: &mut u32) -> bool
Backend.attach
Function · Source
The pixel buffer to repaint from,
width*heightBGRA pixels that stay valid until the next attach or close.
pub fn attach(id: u32, pixels: *mut u8, width: u32, height: u32)
Backend.scale_percent
Function · Source
pub fn scale_percent(id: u32) -> u32
Backend.next_event
Function · Source
The next event of any window, waiting up to
milliseconds.
pub fn next_event(milliseconds: u32, event: &mut raw.Event) -> bool!raw.Error
Backend.present
Function · Source
pub fn present(id: u32, x: i32, y: i32, width: u32, height: u32) -> void!raw.Error
Backend.clock
Function · Source
Monotonic nanoseconds, the clock of next_vblank and frame pacing.
pub fn clock() -> u64
Backend.frame_period
Function · Source
Nanoseconds per display refresh, or 0 when unknown.
pub fn frame_period(id: u32) -> u64
Backend.next_vblank
Function · Source
The clock() time of the first display refresh after
now, or 0 when unknown. Windows reads it from the compositor.
pub fn next_vblank(id: u32, now: u64) -> u64
Backend.request_frame
Function · Source
Ask for a FRAME event at the window’s next refresh: macOS 14 and later have a display link for it. False when there is no such source.
pub fn request_frame(id: u32) -> bool!raw.Error
Backend.set_animating
Function · Source
While animating, macOS must not throttle the program with App Nap.
pub fn set_animating(animating: bool)
Backend.set_title
Function · Source
pub fn set_title(id: u32, title: &str) -> void!raw.Error
Backend.set_cursor_visible
Function · Source
pub fn set_cursor_visible(id: u32, visible: bool) -> void!raw.Error
Backend.set_cursor
Function · Source
pub fn set_cursor(id: u32, shape: u32) -> void!raw.Error
Backend.set_size
Function · Source
pub fn set_size(id: u32, width: u32, height: u32) -> void!raw.Error
Backend.set_size_limits
Function · Source
pub fn set_size_limits(id: u32, min_width: u32, min_height: u32, max_width: u32, max_height: u32) -> void!raw.Error
Backend.set_fullscreen
Function · Source
pub fn set_fullscreen(id: u32, fullscreen: bool) -> void!raw.Error
Backend.fullscreen
Function · Source
pub fn fullscreen(id: u32) -> bool
Backend.set_clipboard
Function · Source
pub fn set_clipboard(text: &[u8]) -> void!raw.Error
Backend.clipboard
Function · Source
The clipboard’s text as UTF-8 in memory from dodo_window_alloc, which the returned bytes own.
pub fn clipboard() -> heap.Bytes!raw.Error
Backend.native_handle
Function · Source
The window system’s objects behind the window: its NSWindow and content view on macOS, its HWND and HINSTANCE on Windows.
pub fn native_handle(id: u32) -> handle.NativeHandle!raw.Error
Backend.metal_layer
Function · Source
The CAMetalLayer backing a window without a pixel buffer, made on the first call; macOS only.
pub fn metal_layer(id: u32) -> usize!raw.Error