TODO
The red value of your color.
The green value of your color.
The blue value of your color.
release queued events
Releases queued events if the client has caused a device (pointer/keyboard) to
freeze due to grabbing it actively. This request has no effect if time
is
earlier than the last-grab time of the most recent active grab for this client
or if time
is later than the current X server time.
Timestamp to avoid race conditions when running X over the network.
* The special value XCB_CURRENT_TIME
will be replaced with the current server
time.
change graphics context components
Changes the components specified by value_mask
for the specified graphics context.
The graphics context to change.
Changes a window property
Sets or updates a property on the specified window
. Properties are for
example the window title (WM_NAME
) or its minimum size (WM_NORMAL_HINTS
).
Protocols such as EWMH also use properties - for example EWMH defines the
window title, encoded as UTF-8 string, in the _NET_WM_NAME
property.
The window whose property you want to change.
The property you want to change (an atom).
Specifies whether the data should be viewed as a list of 8-bit, 16-bit or 32-bit quantities. Possible values are 8, 16 and 32. This information allows the X server to correctly perform byte-swap operations as necessary.
Changes a client's save set
TODO: explain what the save set is for.
This function either adds or removes the specified window to the client's (your application's) save set.
Insert to add the specified window to the save set or Delete to delete it from the save set.
change window attributes
Changes the attributes specified by value_mask
for the specified window
.
The window to change.
Change window stacking order
If direction
is XCB_CIRCULATE_RAISE_LOWEST
, the lowest mapped child (if
any) will be raised to the top of the stack.
If direction
is XCB_CIRCULATE_LOWER_HIGHEST
, the highest mapped child will
be lowered to the bottom of the stack.
Configures window attributes
Configures a window's size, position, border width and stacking order.
The window to configure.
copy areas
Copies the specified rectangle from src_drawable
to dst_drawable
.
The graphics context to use.
The width of the area to copy (in pixels).
The height of the area to copy (in pixels).
Creates a graphics context
Creates a graphics context. The graphics context can be used with any drawable that has the same root and depth as the specified drawable.
The ID with which you will refer to the graphics context, created by
xcb_generate_id
.
Drawable to get the root/depth from.
See also:
create cursor
Creates a cursor from a font glyph. X provides a set of standard cursor shapes in a special font named cursor. Applications are encouraged to use this interface for their cursors because the font can be customized for the individual display type.
All pixels which are set to 1 in the source will use the foreground color (as
specified by fore_red
, fore_green
and fore_blue
). All pixels set to 0
will use the background color (as specified by back_red
, back_green
and
back_blue
).
The ID with which you will refer to the cursor, created by xcb_generate_id
.
Creates a pixmap
Creates a pixmap. The pixmap can only be used on the same screen as drawable
is on and only with drawables of the same depth
.
TODO
The ID with which you will refer to the new pixmap, created by
xcb_generate_id
.
Drawable to get the screen from.
The width of the new pixmap.
The height of the new pixmap.
See also:
Creates a window
Creates an unmapped window as child of the specified parent
window. A
CreateNotify event will be generated. The new window is placed on top in the
stacking order with respect to siblings.
The coordinate system has the X axis horizontal and the Y axis vertical with the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms of pixels, and coincide with pixel centers. Each window and pixmap has its own coordinate system. For a window, the origin is inside the border at the inside, upper-left corner.
The created window is not yet displayed (mapped), call xcb_map_window
to
display it.
The created window will initially use the same cursor as its parent.
Specifies the new window's depth (TODO: what unit?).
* The special value XCB_COPY_FROM_PARENT
means the depth is taken from the
parent
window.
The ID with which you will refer to the new window, created by
xcb_generate_id
.
The parent window of the new window.
The X coordinate of the new window.
The Y coordinate of the new window.
The width of the new window.
Specifies the id for the new window's visual.
* The special value XCB_COPY_FROM_PARENT
means the visual is taken from the
parent
window.
Destroys a window
Destroys the specified window and all of its subwindows. A DestroyNotify event is generated for each destroyed window (a DestroyNotify event is first generated for any given window's inferiors). If the window was mapped, it will be automatically unmapped before destroying.
Calling DestroyWindow on the root window will do nothing.
Deletes a cursor
Deletes the association between the cursor resource ID and the specified cursor. The cursor is freed when no other resource references it.
The cursor to destroy.
Destroys a graphics context
Destroys the specified gc
and all associated storage.
The graphics context to destroy.
Destroys a pixmap
Deletes the association between the pixmap ID and the pixmap. The pixmap storage will be freed when there are no more references to it.
The pixmap to destroy.
Get current window geometry
Gets the current geometry of the specified drawable (either Window
or Pixmap
).
The drawable (Window
or Pixmap
) of which the geometry will be received.
See also:
Gets a window property
Gets the specified property
from the specified window
. Properties are for
example the window title (WM_NAME
) or its minimum size (WM_NORMAL_HINTS
).
Protocols such as EWMH also use properties - for example EWMH defines the
window title, encoded as UTF-8 string, in the _NET_WM_NAME
property.
TODO: talk about type
TODO: talk about delete
TODO: talk about the offset/length thing. what's a valid use case?
The window whose property you want to get.
The property you want to get (an atom).
Gets the owner of a selection
Gets the owner of the specified selection.
TODO: briefly explain what a selection is.
Gets window attributes
Gets the current attributes for the specified window
.
The window to get the attributes from.
Grab pointer button(s)
This request establishes a passive grab. The pointer is actively grabbed as described in GrabPointer, the last-pointer-grab time is set to the time at which the button was pressed (as transmitted in the ButtonPress event), and the ButtonPress event is reported if all of the following conditions are true:
The pointer is not grabbed and the specified button is logically pressed when the specified modifier keys are logically down, and no other buttons or modifier keys are logically down.
The grab-window contains the pointer.
The confine-to window (if any) is viewable.
A passive grab on the same button/key combination does not exist on any ancestor of grab-window.
The interpretation of the remaining arguments is the same as for GrabPointer. The active grab is terminated automatically when the logical state of the pointer has all buttons released, independent of the logical state of modifier keys. Note that the logical state of a device (as seen by means of the protocol) may lag the physical state if device event processing is frozen. This request overrides all previous passive grabs by the same client on the same button/key combinations on the same window. A modifier of AnyModifier is equivalent to issuing the request for all possible modifier combinations (including the combination of no modifiers). It is not required that all specified modifiers have currently assigned keycodes. A button of AnyButton is equivalent to issuing the request for all possible buttons. Otherwise, it is not required that the button specified currently be assigned to a physical button.
An Access error is generated if some other client has already issued a GrabButton request with the same button/key combination on the same window. When using AnyModifier or AnyButton, the request fails completely (no grabs are established), and an Access error is generated if there is a conflicting grab for any combination. The request has no effect on an active grab.
Specifies the cursor that should be displayed or XCB_NONE
to not change the
cursor.
The modifiers to grab.
* Using the special value XCB_MOD_MASK_ANY
means grab the pointer with all
possible modifier combinations.
Grab keyboard key(s)
Establishes a passive grab on the keyboard. In the future, the keyboard is
actively grabbed (as for GrabKeyboard
), the last-keyboard-grab time is set to
the time at which the key was pressed (as transmitted in the KeyPress event),
and the KeyPress event is reported if all of the following conditions are true:
The keyboard is not grabbed and the specified key (which can itself be a modifier key) is logically pressed when the specified modifier keys are logically down, and no other modifier keys are logically down.
Either the grab_window is an ancestor of (or is) the focus window, or the grab_window is a descendant of the focus window and contains the pointer.
A passive grab on the same key combination does not exist on any ancestor of grab_window.
The interpretation of the remaining arguments is as for XGrabKeyboard. The active grab is terminated automatically when the logical state of the keyboard has the specified key released (independent of the logical state of the modifier keys), at which point a KeyRelease event is reported to the grabbing window.
Note that the logical state of a device (as seen by client applications) may lag the physical state if device event processing is frozen.
A modifiers argument of AnyModifier is equivalent to issuing the request for all possible modifier combinations (including the combination of no modifiers). It is not required that all modifiers specified have currently assigned KeyCodes. A keycode argument of AnyKey is equivalent to issuing the request for all possible KeyCodes. Otherwise, the specified keycode must be in the range specified by min_keycode and max_keycode in the connection setup, or a BadValue error results.
If some other client has issued a XGrabKey with the same key combination on the same window, a BadAccess error results. When using AnyModifier or AnyKey, the request fails completely, and a BadAccess error results (no grabs are established) if there is a conflicting grab for any combination.
The modifiers to grab.
* Using the special value XCB_MOD_MASK_ANY
means grab the pointer with all
possible modifier combinations.
The keycode of the key to grab.
* The special value XCB_GRAB_ANY
means grab any key.
Grab the keyboard
Actively grabs control of the keyboard and generates FocusIn and FocusOut events. Further key events are reported only to the grabbing client.
Any active keyboard grab by this client is overridden. If the keyboard is
actively grabbed by some other client, AlreadyGrabbed
is returned. If
grab_window
is not viewable, GrabNotViewable
is returned. If the keyboard
is frozen by an active grab of another client, GrabFrozen
is returned. If the
specified time
is earlier than the last-keyboard-grab time or later than the
current X server time, GrabInvalidTime
is returned. Otherwise, the
last-keyboard-grab time is set to the specified time.
Timestamp to avoid race conditions when running X over the network.
* The special value XCB_CURRENT_TIME
will be replaced with the current server
time.
Grab the pointer
Actively grabs control of the pointer. Further pointer events are reported only to the grabbing client. Overrides any active pointer grab by this client.
Specifies the cursor that should be displayed or XCB_NONE
to not change the
cursor.
The time argument allows you to avoid certain circumstances that come up if
applications take a long time to respond or if there are long network delays.
Consider a situation where you have two applications, both of which normally
grab the pointer when clicked on. If both applications specify the timestamp
from the event, the second application may wake up faster and successfully grab
the pointer before the first application. The first application then will get
an indication that the other application grabbed the pointer before its request
was processed.
* The special value XCB_CURRENT_TIME
will be replaced with the current server
time.
Draws text
Fills the destination rectangle with the background pixel from gc
, then
paints the text with the foreground pixel from gc
. The upper-left corner of
the filled rectangle is at [x, y - font-ascent]. The width is overall-width,
the height is font-ascent + font-descent. The overall-width, font-ascent and
font-descent are as returned by xcb_query_text_extents
(TODO).
Note that using X core fonts is deprecated (but still supported) in favor of client-side rendering using Xft.
The drawable (Window or Pixmap) to draw text on.
The graphics context to use. * The following graphics context components are used: plane-mask, foreground, background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask.
See also:
The x coordinate of the first character, relative to the origin of drawable
.
The y coordinate of the first character, relative to the origin of drawable
.
Draws text
Fills the destination rectangle with the background pixel from gc
, then
paints the text with the foreground pixel from gc
. The upper-left corner of
the filled rectangle is at [x, y - font-ascent]. The width is overall-width,
the height is font-ascent + font-descent. The overall-width, font-ascent and
font-descent are as returned by xcb_query_text_extents
(TODO).
Note that using X core fonts is deprecated (but still supported) in favor of client-side rendering using Xft.
The drawable (Window or Pixmap) to draw text on.
The graphics context to use. * The following graphics context components are used: plane-mask, foreground, background, font, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask.
See also:
The x coordinate of the first character, relative to the origin of drawable
.
The y coordinate of the first character, relative to the origin of drawable
.
Get atom identifier by name
Retrieves the identifier (xcb_atom_t TODO) for the atom with the specified
name. Atoms are used in protocols like EWMH, for example to store window titles
(_NET_WM_NAME
atom) as property of a window.
If only_if_exists
is 0, the atom will be created if it does not already exist.
If only_if_exists
is 1, XCB_ATOM_NONE
will be returned if the atom does
not yet exist.
The name of the atom.
kills a client
Forces a close down of the client that created the specified resource
.
Any resource belonging to the client (for example a Window), used to identify
the client connection.
* The special value of XCB_KILL_ALL_TEMPORARY
, the resources of all clients
that have terminated in RetainTemporary
(TODO) are destroyed.
See also:
get matching font names
Gets a list of available font names which match the given pattern
.
A font pattern, for example "-misc-fixed-*". * The asterisk (*) is a wildcard for any number of characters. The question mark (?) is a wildcard for a single character. Use of uppercase or lowercase does not matter.
get matching font names and information
Gets a list of available font names which match the given pattern
.
A font pattern, for example "-misc-fixed-*". * The asterisk (*) is a wildcard for any number of characters. The question mark (?) is a wildcard for a single character. Use of uppercase or lowercase does not matter.
Makes a window visible
Maps the specified window. This means making the window visible (as long as its parent is visible).
This MapWindow request will be translated to a MapRequest request if a window manager is running. The window manager then decides to either map the window or not. Set the override-redirect window attribute to true if you want to bypass this mechanism.
If the window manager decides to map the window (or if no window manager is running), a MapNotify event is generated.
If the window becomes viewable and no earlier contents for it are remembered, the X server tiles the window with its background. If the window's background is undefined, the existing screen contents are not altered, and the X server generates zero or more Expose events.
If the window type is InputOutput, an Expose event will be generated when the window becomes visible. The normal response to an Expose event should be to repaint the window.
opens a font
Opens any X core font matching the given name
(for example "-misc-fixed-*").
Note that X core fonts are deprecated (but still supported) in favor of client-side rendering using Xft.
The ID with which you will refer to the font, created by xcb_generate_id
.
A pattern describing an X core font.
See also:
Fills rectangles
Fills the specified rectangle(s) in the order listed in the array. For any given rectangle, each pixel is not drawn more than once. If rectangles intersect, the intersecting pixels are drawn multiple times.
The drawable (Window or Pixmap) to draw on.
The graphics context to use. * The following graphics context components are used: function, plane-mask, fill-style, subwindow-mode, clip-x-origin, clip-y-origin, and clip-mask. * The following graphics context mode-dependent components are used: foreground, background, tile, stipple, tile-stipple-x-origin, and tile-stipple-y-origin.
The rectangles to fill.
draw lines
Draws points_len
-1 lines between each pair of points (point[i], point[i+1])
in the points
array. The lines are drawn in the order listed in the array.
They join correctly at all intermediate points, and if the first and last
points coincide, the first and last lines also join correctly. For any given
line, a pixel is not drawn more than once. If thin (zero line-width) lines
intersect, the intersecting pixels are drawn multiple times. If wide lines
intersect, the intersecting pixels are drawn only once, as though the entire
request were a single, filled shape.
The drawable to draw the line(s) on.
The graphics context to use.
An array of points.
draw lines
Draws multiple, unconnected lines. For each segment, a line is drawn between
(x1, y1) and (x2, y2). The lines are drawn in the order listed in the array of
xcb_segment_t
structures and does not perform joining at coincident
endpoints. For any given line, a pixel is not drawn more than once. If lines
intersect, the intersecting pixels are drawn multiple times.
TODO: include the xcb_segment_t data structure
TODO: an example
A drawable (Window or Pixmap) to draw on.
The graphics context to use. * TODO: document which attributes of a gc are used
An array of xcb_segment_t
structures.
check if extension is present
Determines if the specified extension is present on this X11 server.
Every extension has a unique major_opcode
to identify requests, the minor
opcodes and request formats are extension-specific. If the extension provides
events and errors, the first_event
and first_error
fields in the reply are
set accordingly.
There should rarely be a need to use this request directly, XCB provides the
xcb_get_extension_data
function instead.
The name of the extension to query, for example "RANDR". This is case sensitive!
See also:
query font metrics
Queries information associated with the font.
The fontable (Font or Graphics Context) to query.
get pointer coordinates
Gets the root window the pointer is logically on and the pointer coordinates relative to the root window's origin.
A window to check if the pointer is on the same screen as window
(see the
same_screen
field in the reply).
get text extents
Query text extents from the X11 server. This request returns the bounding box
of the specified 16-bit character string in the specified font
or the font
contained in the specified graphics context.
font_ascent
is set to the maximum of the ascent metrics of all characters in
the string. font_descent
is set to the maximum of the descent metrics.
overall_width
is set to the sum of the character-width metrics of all
characters in the string. For each character in the string, let W be the sum of
the character-width metrics of all characters preceding it in the string. Let L
be the left-side-bearing metric of the character plus W. Let R be the
right-side-bearing metric of the character plus W. The lbearing member is set
to the minimum L of all characters in the string. The rbearing member is set to
the maximum R.
For fonts defined with linear indexing rather than 2-byte matrix indexing, each
xcb_char2b_t
structure is interpreted as a 16-bit number with byte1 as the
most significant byte. If the font has no defined default character, undefined
characters in the string are taken to have all zero metrics.
Characters with all zero metrics are ignored. If the font has no defined default_char, the undefined characters in the string are also ignored.
The font
to calculate text extents in. You can also pass a graphics context.
query the window tree
Gets the root window ID, parent window ID and list of children windows for the
specified window
. The children are listed in bottom-to-top stacking order.
The window
to query.
See also:
Reparents a window
Makes the specified window a child of the specified parent window. If the window is mapped, it will automatically be unmapped before reparenting and re-mapped after reparenting. The window is placed in the stacking order on top with respect to sibling windows.
After reparenting, a ReparentNotify event is generated.
The window to reparent.
The new parent of the window.
The X position of the window within its new parent.
The Y position of the window within its new parent.
See also:
send an event
Identifies the destination
window, determines which clients should receive
the specified event and ignores any active grabs.
The event
must be one of the core events or an event defined by an extension,
so that the X server can correctly byte-swap the contents as necessary. The
contents of event
are otherwise unaltered and unchecked except for the
send_event
field which is forced to 'true'.
If propagate
is true and no clients have selected any event on destination
,
the destination is replaced with the closest ancestor of destination
for
which some client has selected a type in event_mask
and for which no
intervening window has that type in its do-not-propagate-mask. If no such
window exists or if the window is an ancestor of the focus window and
InputFocus
was originally specified as the destination, the event is not sent
to any clients. Otherwise, the event is reported to every client selecting on
the final destination any of the types specified in event_mask
.
The window to send this event to. Every client which selects any event within
event_mask
on destination
will get the event.
* The special value XCB_SEND_EVENT_DEST_POINTER_WINDOW
refers to the window
that contains the mouse pointer.
* The special value XCB_SEND_EVENT_DEST_ITEM_FOCUS
refers to the window which
has the keyboard focus.
Sets input focus
Changes the input focus and the last-focus-change time. If the specified time
is earlier than the current last-focus-change time, the request is ignored (to
avoid race conditions when running X over the network).
A FocusIn and FocusOut event is generated when focus is changed.
The window to focus. All keyboard events will be reported to this window. The
window must be viewable (TODO), or a xcb_match_error_t
occurs (TODO).
* If focus
is XCB_NONE
(TODO), all keyboard events are
discarded until a new focus window is set.
* If focus
is XCB_POINTER_ROOT
(TODO), focus is on the root window of the
screen on which the pointer is on currently.
Timestamp to avoid race conditions when running X over the network.
* The special value XCB_CURRENT_TIME
will be replaced with the current server
time.
Sets the owner of a selection
Makes window
the owner of the selection selection
and updates the
last-change time of the specified selection.
TODO: briefly explain what a selection is.
The new owner of the selection.
* The special value XCB_NONE
means that the selection will have no owner.
The selection.
Timestamp to avoid race conditions when running X over the network.
* The selection will not be changed if time
is earlier than the current
last-change time of the selection
or is later than the current X server time.
Otherwise, the last-change time is set to the specified time.
* The special value XCB_CURRENT_TIME
will be replaced with the current server
time.
See also:
release a key combination
Releases the key combination on grab_window
if you grabbed it using
xcb_grab_key
before.
The keycode of the specified key combination.
* Using the special value XCB_GRAB_ANY
means releasing all possible key codes.
The modifiers of the specified key combination.
* Using the special value XCB_MOD_MASK_ANY
means releasing the key combination
with every possible modifier combination.
See also:
release the pointer
Releases the pointer and any queued events if you actively grabbed the pointer
before using xcb_grab_pointer
, xcb_grab_button
or within a normal button
press.
EnterNotify and LeaveNotify events are generated.
Timestamp to avoid race conditions when running X over the network.
* The pointer will not be released if time
is earlier than the
last-pointer-grab time or later than the current X server time.
Makes a window invisible
Unmaps the specified window. This means making the window invisible (and all its child windows).
Unmapping a window leads to the UnmapNotify
event being generated. Also,
Expose
events are generated for formerly obscured windows.
move mouse pointer
Moves the mouse pointer to the specified position.
If src_window
is not XCB_NONE
(TODO), the move will only take place if the
pointer is inside src_window
and within the rectangle specified by (src_x
,
src_y
, src_width
, src_height
). The rectangle coordinates are relative to
src_window
.
If dst_window
is not XCB_NONE
(TODO), the pointer will be moved to the
offsets (dst_x
, dst_y
) relative to dst_window
. If dst_window
is
XCB_NONE
(TODO), the pointer will be moved by the offsets (dst_x
, dst_y
)
relative to the current position of the pointer.
Generated using TypeDoc
Allocate a color
Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware. If you are using TrueColor, you can take a shortcut and directly calculate the color pixel value to avoid the round trip. But, for example, on 16-bit color setups (VNC), you can easily get the closest supported RGB value to the RGB value you are specifying.