メインコンテンツまでスキップ

Requests: Atoms and Properties

InternAtom​

name: STRING8
only-if-exists: BOOL

=>

atom: ATOM or None
Errors: Value, Alloc

Returns the atom for the given name. If only-if-exists is False, then the atom is created if it does not exist. The string should use the ASCII encoding, and upper/lower case matters.

The lifetime of an atom is not tied to the interning client. Atoms remained defined until server reset (see Section 11).

GetAtomName​

atom: ATOM

=>

name: STRING8
Errors: Atom

Returns the name for the given atom.

ChangeProperty​

window: WINDOW
property, type: ATOM
format: {8, 16, 32}
mode: {Replace, Prepend, Append}
data: LISTofINT8 or LISTofINT16 or LISTofINT32
Errors: Window, Atom, Value, Match, Alloc

Alters the property for the specified window. The type is uninterpreted by the server. The format specifies whether the data should be viewed as a list of 8-bit, 16-bit, or 32-bit quantities, so that the server can correctly byte-swap as necessary.

If mode is Replace, the previous property value is discarded. If the mode is Prepend or Append, then the type and format must match the existing property value (else a Match error); if the property is undefined, it is treated as defined with the correct type and format with zero-length data. For Prepend, the data is tacked on to the beginning of the existing data, and for Append it is tacked on to the end of the existing data.

Generates a PropertyNotify event on the window.

The lifetime of a property is not tied to the storing client. Properties remain until explicitly deleted, or the window is destroyed, or until server reset (see Section 11).

The maximum size of a property is server dependent.

DeleteProperty​

window: WINDOW
property: ATOM
Errors: Window, Atom

Deletes the property from the specified window if the property exists. Generates a PropertyNotify event on the window unless the property does not exist.

GetProperty​

window: WINDOW
property: ATOM
type: ATOM or AnyPropertyType
long-offset, long-length: CARD32
delete: BOOL

=>

type: ATOM
format: {8, 16, 32}
bytes-after: CARD32
value: LISTofINT8 or LISTofINT16 or LISTofINT32
Errors: Window, Atom, Property, Match, Value

If the specified property does not exist for the specifed window, a Property error is generated. Otherwise, if type AnyPropertyType is specified, (part of) the property is returned regardless of its type; if a type is specified, (part of) the property is returned only if its type equals the specified type (else a Match error). The actual type and format of the property are returned.

Define the following values​

N = actual length of the stored property in bytes
(even if the format is 16 or 32)
I = 4 * long-offset
T = N - I
L = MINIMUM(T, 4 * long-length)
A = N - (I + L)

The returned value starts at byte index I in the property (indexing from 0), and its length in bytes is L. It is a Value error if long-offset is given such that L is negative. The value of bytes-after is A, giving the number of trailing unread bytes in the stored property.

If delete is True and bytes-after is zero, the property is also deleted from the window and a PropertyNotify event is generated on the window.

RotateProperties​

window: WINDOW
delta: INT8
properties: LISTofATOM
Errors: Window, Atom, Match

If the property names in the list are viewed as being numbered starting from zero, and there are N property names in the list, then the value associated with property name I becomes the value associated with property name (I + delta) mod N, for all I from zero to N - 1. The effect is to rotate the states by delta places around the virtual ring of property names (right for positive delta, left for negative delta).

A PropertyNotify event is generated for each property, in the order listed.

If an atom occurs more than once in the list or no property with that name is defined for the window, a Match error is generated. If an Atom or Match error is generated, no properties are changed.

ListProperties​

window: WINDOW

=>

atoms: LISTofATOM
Errors: Window

Returns the atoms of properties currently defined on the window.