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/x11"
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 |
|---|---|---|
raw |
std/window/raw |
x11.dodo |
KEY_PRESS_MASK
Constant · Source
Event masks.
pub const KEY_PRESS_MASK: u32 = 0x1
KEY_RELEASE_MASK
Constant · Source
pub const KEY_RELEASE_MASK: u32 = 0x2
BUTTON_PRESS_MASK
Constant · Source
pub const BUTTON_PRESS_MASK: u32 = 0x4
BUTTON_RELEASE_MASK
Constant · Source
pub const BUTTON_RELEASE_MASK: u32 = 0x8
LEAVE_WINDOW_MASK
Constant · Source
pub const LEAVE_WINDOW_MASK: u32 = 0x20
POINTER_MOTION_MASK
Constant · Source
pub const POINTER_MOTION_MASK: u32 = 0x40
EXPOSURE_MASK
Constant · Source
pub const EXPOSURE_MASK: u32 = 0x8000
STRUCTURE_NOTIFY_MASK
Constant · Source
pub const STRUCTURE_NOTIFY_MASK: u32 = 0x20000
SUBSTRUCTURE_NOTIFY_MASK
Constant · Source
pub const SUBSTRUCTURE_NOTIFY_MASK: u32 = 0x80000
SUBSTRUCTURE_REDIRECT_MASK
Constant · Source
pub const SUBSTRUCTURE_REDIRECT_MASK: u32 = 0x100000
FOCUS_CHANGE_MASK
Constant · Source
pub const FOCUS_CHANGE_MASK: u32 = 0x200000
PROPERTY_CHANGE_MASK
Constant · Source
pub const PROPERTY_CHANGE_MASK: u32 = 0x400000
ERROR
Constant · Source
Event codes, after clearing the “sent by a client” bit 0x80.
pub const ERROR: u8 = 0
REPLY
Constant · Source
pub const REPLY: u8 = 1
KEY_PRESS
Constant · Source
pub const KEY_PRESS: u8 = 2
KEY_RELEASE
Constant · Source
pub const KEY_RELEASE: u8 = 3
BUTTON_PRESS
Constant · Source
pub const BUTTON_PRESS: u8 = 4
BUTTON_RELEASE
Constant · Source
pub const BUTTON_RELEASE: u8 = 5
MOTION_NOTIFY
Constant · Source
pub const MOTION_NOTIFY: u8 = 6
ENTER_NOTIFY
Constant · Source
pub const ENTER_NOTIFY: u8 = 7
LEAVE_NOTIFY
Constant · Source
pub const LEAVE_NOTIFY: u8 = 8
FOCUS_IN
Constant · Source
pub const FOCUS_IN: u8 = 9
FOCUS_OUT
Constant · Source
pub const FOCUS_OUT: u8 = 10
EXPOSE
Constant · Source
pub const EXPOSE: u8 = 12
CONFIGURE_NOTIFY
Constant · Source
pub const CONFIGURE_NOTIFY: u8 = 22
PROPERTY_NOTIFY
Constant · Source
pub const PROPERTY_NOTIFY: u8 = 28
SELECTION_CLEAR
Constant · Source
pub const SELECTION_CLEAR: u8 = 29
SELECTION_REQUEST
Constant · Source
pub const SELECTION_REQUEST: u8 = 30
SELECTION_NOTIFY
Constant · Source
pub const SELECTION_NOTIFY: u8 = 31
CLIENT_MESSAGE
Constant · Source
pub const CLIENT_MESSAGE: u8 = 33
MAPPING_NOTIFY
Constant · Source
pub const MAPPING_NOTIFY: u8 = 34
GENERIC_EVENT
Constant · Source
An extension event that may be longer than 32 bytes.
pub const GENERIC_EVENT: u8 = 35
SHIFT_MASK
Constant · Source
Key and button state bits.
pub const SHIFT_MASK: u32 = 0x1
LOCK_MASK
Constant · Source
pub const LOCK_MASK: u32 = 0x2
CONTROL_MASK
Constant · Source
pub const CONTROL_MASK: u32 = 0x4
MOD1_MASK
Constant · Source
pub const MOD1_MASK: u32 = 0x8
MOD2_MASK
Constant · Source
pub const MOD2_MASK: u32 = 0x10
MOD4_MASK
Constant · Source
pub const MOD4_MASK: u32 = 0x40
MOD5_MASK
Constant · Source
pub const MOD5_MASK: u32 = 0x80
ATOM_NONE
Constant · Source
Predefined atoms; 0 is None, which GetProperty also takes as any type.
pub const ATOM_NONE: u32 = 0
ATOM_ATOM
Constant · Source
pub const ATOM_ATOM: u32 = 4
ATOM_STRING
Constant · Source
pub const ATOM_STRING: u32 = 31
ATOM_WINDOW
Constant · Source
pub const ATOM_WINDOW: u32 = 33
ATOM_WM_NAME
Constant · Source
pub const ATOM_WM_NAME: u32 = 39
ATOM_WM_NORMAL_HINTS
Constant · Source
pub const ATOM_WM_NORMAL_HINTS: u32 = 40
ATOM_WM_SIZE_HINTS
Constant · Source
pub const ATOM_WM_SIZE_HINTS: u32 = 41
ATOM_WM_CLASS
Constant · Source
pub const ATOM_WM_CLASS: u32 = 67
PROPERTY_REPLACE
Constant · Source
ChangeProperty modes.
pub const PROPERTY_REPLACE: u8 = 0
PROPERTY_APPEND
Constant · Source
pub const PROPERTY_APPEND: u8 = 2
CONFIGURE_X
Constant · Source
ConfigureWindow value-mask bits; values follow in this order.
pub const CONFIGURE_X: u32 = 0x1
CONFIGURE_Y
Constant · Source
pub const CONFIGURE_Y: u32 = 0x2
CONFIGURE_WIDTH
Constant · Source
pub const CONFIGURE_WIDTH: u32 = 0x4
CONFIGURE_HEIGHT
Constant · Source
pub const CONFIGURE_HEIGHT: u32 = 0x8
CONFIGURE_STACK_MODE
Constant · Source
pub const CONFIGURE_STACK_MODE: u32 = 0x40
STACK_ABOVE
Constant · Source
The stack mode raising a window above its siblings.
pub const STACK_ABOVE: u32 = 0
PACKET
Constant · Source
Every message the server sends is at least this long.
pub const PACKET: usize = 32
u16_at
Function · Source
pub fn u16_at(data: &[u8], offset: usize) -> u32
i16_at
Function · Source
pub fn i16_at(data: &[u8], offset: usize) -> i32
u32_at
Function · Source
pub fn u32_at(data: &[u8], offset: usize) -> u32
u64_at
Function · Source
pub fn u64_at(data: &[u8], offset: usize) -> u64
setup_request
Function · Source
The setup request, with optional authorization such as “MIT-MAGIC-COOKIE-1” and its 16-byte cookie.
pub fn setup_request(out: &mut[u8], auth_name: &[u8], auth_data: &[u8]) -> usize
setup_length
Function · Source
Total length of the setup reply whose first 8 bytes are
head.
pub fn setup_length(head: &[u8]) -> usize
Setup
Struct · Source
What the client needs from the setup reply.
pub struct Setup {
pub id_base: u32
pub id_mask: u32
// Largest request, in bytes.
pub max_request: usize
pub min_keycode: u32
pub max_keycode: u32
pub root: u32
pub root_visual: u32
pub root_depth: u32
pub screen_width: u32
pub screen_height: u32
}
parse_setup
Function · Source
Parse the setup reply for
screen. Fails with Protocol when the server refused the connection, typically for missing authorization, or the reply is malformed, and with Unsupported when the screen’s default visual is not 24-bit true color stored as 32-bit little-endian pixels, the layout of graphics.PixelFormat.Bgra8888.
pub fn parse_setup(reply: &[u8], screen: u32) -> Setup!raw.Error
create_window
Function · Source
CreateWindow with the parent’s depth and visual. NorthWest bit gravity keeps the picture in place while resizing.
pub fn create_window(out: &mut[u8], window: u32, parent: u32, width: u32, height: u32, event_mask: u32) -> usize
set_cursor
Function · Source
ChangeWindowAttributes setting the cursor; 0 restores the parent’s.
pub fn set_cursor(out: &mut[u8], window: u32, cursor: u32) -> usize
destroy_window
Function · Source
pub fn destroy_window(out: &mut[u8], window: u32) -> usize
map_window
Function · Source
pub fn map_window(out: &mut[u8], window: u32) -> usize
intern_atom
Function · Source
pub fn intern_atom(out: &mut[u8], name: &[u8]) -> usize
change_property
Function · Source
ChangeProperty in Replace mode.
formatis 8 or 32: the size in bits of each element ofdata, whose length is in bytes.
pub fn change_property(out: &mut[u8], window: u32, property: u32, kind: u32, format: u8, data: &[u8]) -> usize
change_property_mode
Function · Source
ChangeProperty in
mode: PROPERTY_REPLACE, or PROPERTY_APPEND to adddataat the end, which builds a value larger than one request.
pub fn change_property_mode(out: &mut[u8], mode: u8, window: u32, property: u32, kind: u32, format: u8, data: &[u8]) -> usize
fixed_size_hints
Function · Source
A WM_NORMAL_HINTS value fixing the size, for windows that cannot be resized.
pub fn fixed_size_hints(out: &mut[u8], width: u32, height: u32) -> usize
size_hints
Function · Source
A WM_NORMAL_HINTS value with a minimum and a maximum size; a 0 dimension is unlimited, and with both 0 the hint is left out. 0 everywhere makes a value without hints.
pub fn size_hints(out: &mut[u8], min_width: u32, min_height: u32, max_width: u32, max_height: u32) -> usize
delete_property
Function · Source
pub fn delete_property(out: &mut[u8], window: u32, property: u32) -> usize
get_property
Function · Source
GetProperty for
length4-byte units fromoffset(also in 4-byte units) of a value of typekind, ATOM_NONE for any. The reply has the value’s format in byte 1, its type at 8, the bytes left after this part at 12, the returned length in format units at 16 and the data from 32 on.
pub fn get_property(out: &mut[u8], delete: bool, window: u32, property: u32, kind: u32, offset: u32, length: u32) -> usize
configure_window
Function · Source
ConfigureWindow.
valuesholds one value per bit set inmask, in the order of the CONFIGURE_ bits.
pub fn configure_window(out: &mut[u8], window: u32, mask: u32, values: &[u32]) -> usize
set_selection_owner
Function · Source
pub fn set_selection_owner(out: &mut[u8], owner: u32, selection: u32, time: u32) -> usize
get_selection_owner
Function · Source
GetSelectionOwner, whose reply names the owner at byte 8, 0 for none.
pub fn get_selection_owner(out: &mut[u8], selection: u32) -> usize
convert_selection
Function · Source
Ask the owner of
selectionto store it astargetinpropertyofrequestor; a SelectionNotify reports the outcome.
pub fn convert_selection(out: &mut[u8], requestor: u32, selection: u32, target: u32, property: u32, time: u32) -> usize
send_event
Function · Source
SendEvent of the 32-byte
eventtodestination; with an emptymaskit goes to the destination’s owner whatever it selected.
pub fn send_event(out: &mut[u8], propagate: bool, destination: u32, mask: u32, event: &[u8]) -> usize
selection_notify
Function · Source
The SelectionNotify an owner sends the requestor, with
property0 when it refused the conversion.
pub fn selection_notify(out: &mut[u8], time: u32, requestor: u32, selection: u32, target: u32, property: u32) -> usize
client_message
Function · Source
A ClientMessage event of format 32 about
windowwith five data words, such as the _NET_WM_STATE requests window managers take.
pub fn client_message(out: &mut[u8], window: u32, kind: u32, data: &[u32]) -> usize
create_pixmap
Function · Source
pub fn create_pixmap(out: &mut[u8], pixmap: u32, drawable: u32, depth: u8, width: u32, height: u32) -> usize
free_pixmap
Function · Source
pub fn free_pixmap(out: &mut[u8], pixmap: u32) -> usize
create_gc
Function · Source
CreateGC drawing in
foreground, without graphics exposure events.
pub fn create_gc(out: &mut[u8], gc: u32, drawable: u32, foreground: u32) -> usize
fill_rectangle
Function · Source
PolyFillRectangle with one rectangle.
pub fn fill_rectangle(out: &mut[u8], drawable: u32, gc: u32, x: i32, y: i32, width: u32, height: u32) -> usize
free_gc
Function · Source
pub fn free_gc(out: &mut[u8], gc: u32) -> usize
PUT_IMAGE_HEADER
Constant · Source
Bytes of the PutImage header that put_image_header writes.
pub const PUT_IMAGE_HEADER: usize = 24
put_image_header
Function · Source
The header of a ZPixmap PutImage of width x height 32-bit pixels at (x, y); width * height * 4 bytes of pixel rows must follow.
pub fn put_image_header(out: &mut[u8], drawable: u32, gc: u32, width: u32, height: u32, x: i32, y: i32, depth: u8) -> usize
create_cursor
Function · Source
CreateCursor from a source and mask bitmap; with an all-zero mask it is invisible.
pub fn create_cursor(out: &mut[u8], cursor: u32, source: u32, mask: u32) -> usize
open_font
Function · Source
pub fn open_font(out: &mut[u8], font: u32, name: &[u8]) -> usize
create_glyph_cursor
Function · Source
CreateGlyphCursor from the cursor font: glyph
glyphdrawn black on a white outline, the mask glyph that follows it.
pub fn create_glyph_cursor(out: &mut[u8], cursor: u32, font: u32, glyph: u32) -> usize
cursor_glyph
Function · Source
The glyph of the standard “cursor” font for a raw.CURSOR_ shape, from X11’s cursorfont.h. Diagonal resizing uses the corner arrows, and NotAllowed the circle, as the core font has no closer shapes.
pub fn cursor_glyph(shape: u32) -> u32
get_keyboard_mapping
Function · Source
pub fn get_keyboard_mapping(out: &mut[u8], first: u32, count: u32) -> usize
query_extension
Function · Source
QueryExtension, whose reply tells whether the server has the extension
name(byte 8) and its major opcode (byte 9).
pub fn query_extension(out: &mut[u8], name: &[u8]) -> usize
PRESENT_COMPLETE_MASK
Constant · Source
PresentSelectInput mask for CompleteNotify events.
pub const PRESENT_COMPLETE_MASK: u32 = 2
PRESENT_COMPLETE_NOTIFY
Constant · Source
GenericEvent type of a CompleteNotify, and its kind for a NotifyMSC.
pub const PRESENT_COMPLETE_NOTIFY: u32 = 1
PRESENT_KIND_NOTIFY_MSC
Constant · Source
pub const PRESENT_KIND_NOTIFY_MSC: u8 = 1
present_query_version
Function · Source
pub fn present_query_version(out: &mut[u8], opcode: u8, major: u32, minor: u32) -> usize
present_select_input
Function · Source
Ask for
maskevents aboutwindow, under the new event idevent.
pub fn present_select_input(out: &mut[u8], opcode: u8, event: u32, window: u32, mask: u32) -> usize
present_notify_msc
Function · Source
PresentNotifyMSC: a CompleteNotify once the display’s frame counter reaches
target, or, when that has passed, the next frame where counter % divisor == remainder. Target 0 and divisor 1 mean the next refresh.
pub fn present_notify_msc(out: &mut[u8], opcode: u8, window: u32, serial: u32, target: u64, divisor: u64, remainder: u64) -> usize
message_length
Function · Source
Total length of the message starting with
head(at least 32 bytes): replies and generic events carry extra data, errors and core events never do.
pub fn message_length(head: &[u8]) -> usize
code
Function · Source
The message’s code without the “sent by a client” bit.
pub fn code(message: &[u8]) -> u8
sequence
Function · Source
The 16-bit sequence number of the request a reply or error answers.
pub fn sequence(message: &[u8]) -> u32
keysym
Function · Source
The keysym GetKeyboardMapping lists for
keycodeatcolumn, where each keycode hasper_keycodecolumns starting atfirst. 0 is NoSymbol.
pub fn keysym(mapping: &[u8], first: u32, per_keycode: u32, keycode: u32, column: u32) -> u32
lookup
Function · Source
The keysym a key press produces under
state, following the core protocol’s rules for the first group: Shift selects the second column, Lock capitalises letters, NumLock inverts Shift on the keypad, and Mod5 (AltGr in common layouts) selects columns 5 and 6 where XKB places the third and fourth levels.
pub fn lookup(mapping: &[u8], first: u32, per_keycode: u32, keycode: u32, state: u32) -> u32
keysym_to_unicode
Function · Source
The character a keysym types, or 0 for keys that type nothing. Covers Latin-1, the keypad, the euro sign and the Unicode keysyms XKB uses for everything else in current layouts.
pub fn keysym_to_unicode(sym: u32) -> u32