WINDOW
PIXMAP
FONT
GCONTEXT
-
0
-
1
-
2
-
3
-
4
-
5
visuals_len
-
0
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
0
-
1
-
2
allowed_depths_len
authorization_protocol_name_len
authorization_protocol_data_len
reason_len
length
4
-
0
-
1
vendor_len
pixmap_formats_len
roots_len
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
15
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
0
a key was pressed/released
-
8
-
9
-
10
-
11
-
12
-
15
a mouse button was pressed/released
-
0
-
1
a key was pressed
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
0
-
1
-
2
-
3
the pointer is in a different window
NOT YET DOCUMENTED
31
NOT YET DOCUMENTED
-
0
-
1
-
2
a window is destroyed
a window is unmapped
a window was mapped
window wants to be mapped
NOT YET DOCUMENTED
-
0
-
1
NOT YET DOCUMENTED
-
0
-
1
a window property changed
-
0
-
0
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
0
-
1
-
0
the colormap for some window changed
20
10
5
NOT YET DOCUMENTED
-
0
-
1
-
2
keyboard mapping changed
generic event (with length)
-
0
-
1
-
2
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
0
-
1
-
0
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
value_mask
BackPixmap
BackPixel
BorderPixmap
BorderPixel
BitGravity
WinGravity
BackingStore
BackingPlanes
BackingPixel
OverrideRedirect
SaveUnder
EventMask
DontPropagate
Colormap
Cursor
Creates a window
value_mask
BackPixmap
BackPixel
BorderPixmap
BorderPixel
BitGravity
WinGravity
BackingStore
BackingPlanes
BackingPixel
OverrideRedirect
SaveUnder
EventMask
DontPropagate
Colormap
Cursor
change window attributes
-
0
-
1
-
2
Gets window attributes
Destroys a window
-
0
-
1
Changes a client's save set
Reparents a window
Makes a window visible
Makes a window invisible
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
0
-
1
-
2
-
3
-
4
value_mask
X
Y
Width
Height
BorderWidth
Sibling
StackMode
Configures window attributes
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Configures the given window to the left upper corner
// with a size of 1024x768 pixels.
conn.send_request(&x::ConfigureWindow {
window,
value_list: &[
x::ConfigWindow::X(0),
x::ConfigWindow::Y(0),
x::ConfigWindow::Width(0),
x::ConfigWindow::Height(0),
],
});
conn.flush()?;
# Ok(())
# }
]]>
-
0
-
1
Change window stacking order
Get current window geometry
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Get the X and Y coordinates of a window.
let cookie = conn.send_request(&x::GetGeometry {
drawable: x::Drawable::Window(window),
});
let reply = conn.wait_for_reply(cookie)?;
let (x, y) = (reply.x(), reply.y());
# Ok(())
# }
]]>
children_len
query the window tree
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Get the root, parent and children of the specified window.
let cookie = conn.send_request(&x::QueryTree {
window,
});
let reply = conn.wait_for_reply(cookie)?;
// type inference is not needed here, only to show the type of returned value.
let root: x::Window = reply.root();
let parent: x::Window = reply.parent();
let children: &[x::Window] = reply.children();
# Ok(())
# }
]]>
name_len
Get atom identifier by name
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Resolve the _NET_WM_NAME atom.
let cookie = conn.send_request(&x::InternAtom {
only_if_exists: false,
name: b"_NET_WM_NAME",
});
let reply = conn.wait_for_reply(cookie)?;
let wm_name = reply.atom();
# Ok(())
# }
]]>
name_len
-
0
-
1
-
2
data_len
format
8
Changes a window property
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Set the WM_NAME property of the window "XCB Example".
conn.send_request(&x::ChangeProperty {
mode: x::PropMode::Replace,
window,
property: x::ATOM_WM_NAME,
r#type: x::ATOM_STRING,
data: b"XCB Example",
});
# Ok(())
# }
]]>
-
0
value_len
format
8
Gets a window property
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Get the WM_NAME property of the window
let cookie = conn.send_request(&x::GetProperty {
delete: false,
window,
property: x::ATOM_WM_NAME,
r#type: x::ATOM_STRING,
long_offset: 0,
long_length: 0,
});
let reply = conn.wait_for_reply(cookie)?;
// value() returns &[u8]
let title = str::from_utf8(reply.value()).expect("The WM_NAME property is not valid UTF-8");
# Ok(())
# }
]]>
atoms_len
Sets the owner of a selection
Gets the owner of a selection
-
0
-
1
32
send an event
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let window: x::Window = conn.generate_id();
// Tell the given window that it was configured to a size of 800x600 pixels.
let event = x::ConfigureNotifyEvent::new(
window,
window,
x::Window::none(),
0,
0,
800,
600,
0,
false,
);
conn.send_request(&x::SendEvent {
propagate: false,
destination: x::SendEventDest::Window(window),
event_mask: x::EventMask::STRUCTURE_NOTIFY,
event: &event,
});
conn.flush()?;
# Ok(())
# }
]]>
-
0
-
1
-
0
-
1
-
2
-
3
-
4
-
0
Grab the pointer
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let setup = conn.get_setup();
# let screen = setup.roots().nth(screen_num as usize).unwrap();
# let window: x::Window = conn.generate_id();
# let cursor: x::Cursor = conn.generate_id();
// Grabs the pointer actively
let cookie = conn.send_request(&x::GrabPointer {
owner_events: false, // get all pointer events specified by the following mask
grab_window: screen.root(), // grab the root window
event_mask: x::EventMask::NO_EVENT, // which event to let through
pointer_mode: x::GrabMode::Async, // pointer events should continue as normal
keyboard_mode: x::GrabMode::Async, // pointer events should continue as normal
confine_to: x::Window::none(), // in which window should the cursor stay
cursor, // we change the cursor
time: x::CURRENT_TIME,
});
let reply = conn.wait_for_reply(cookie)?;
assert!(reply.status() == x::GrabStatus::Success, "GrabPointer did not succeed");
# Ok(())
# }
]]>
release the pointer
-
0
-
1
-
2
-
3
-
4
-
5
Grab pointer button(s)
Grab the keyboard
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let setup = conn.get_setup();
# let screen = setup.roots().nth(screen_num as usize).unwrap();
# let window: x::Window = conn.generate_id();
# let cursor: x::Cursor = conn.generate_id();
// Grabs the keyboard actively
let cookie = conn.send_request(&x::GrabKeyboard {
owner_events: true, // get all pointer events specified by the following mask
grab_window: screen.root(), // grab the root window
time: x::CURRENT_TIME,
pointer_mode: x::GrabMode::Async, // process events as normal, do not require sync
keyboard_mode: x::GrabMode::Async,
});
let reply = conn.wait_for_reply(cookie)?;
assert!(reply.status() == x::GrabStatus::Success, "GrabKeyboard did not succeed");
# Ok(())
# }
]]>
-
0
Grab keyboard key(s)
release a key combination
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
release queued events
get pointer coordinates
events_len
move mouse pointer
-
0
-
1
-
2
-
3
Sets input focus
32
name_len
opens a font
-
0
-
1
properties_len
char_infos_len
query font metrics
string_len
1
get text extents
name_len
pattern_len
names_len
get matching font names
pattern_len
properties_len
name_len
get matching font names and information
font_qty
path_len
Creates a pixmap
Destroys a pixmap
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
0
-
1
-
2
-
0
-
1
-
2
-
3
-
0
-
1
-
2
-
0
-
1
-
2
-
3
-
0
-
1
-
0
-
1
-
0
-
1
value_mask
Function
PlaneMask
Foreground
Background
LineWidth
LineStyle
CapStyle
JoinStyle
FillStyle
FillRule
Tile
Stipple
TileStippleOriginX
TileStippleOriginY
Font
SubwindowMode
GraphicsExposures
ClipOriginX
ClipOriginY
ClipMask
DashOffset
DashList
ArcMode
Creates a graphics context
value_mask
Function
PlaneMask
Foreground
Background
LineWidth
LineStyle
CapStyle
JoinStyle
FillStyle
FillRule
Tile
Stipple
TileStippleOriginX
TileStippleOriginY
Font
SubwindowMode
GraphicsExposures
ClipOriginX
ClipOriginY
ClipMask
DashOffset
DashList
ArcMode
change graphics context components
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let setup = conn.get_setup();
# let screen = setup.roots().nth(screen_num as usize).unwrap();
# let gc: x::Gcontext = conn.generate_id();
// Change the foreground and background component
// of a graphics context to white on black.
// `value_list` components order must be in the same order
// than in the `Gc` enum.
conn.send_request(&x::ChangeGc {
gc,
value_list: &[
x::Gc::Foreground(screen.white_pixel()),
x::Gc::Background(screen.black_pixel()),
],
});
conn.flush()?;
# Ok(())
# }
]]>
dashes_len
-
0
-
1
-
2
-
3
Destroys a graphics context
copy areas
-
0
-
1
Draw lines
xcb::Result<()> {
# let (conn, screen_num) = xcb::Connection::connect(None)?;
# let setup = conn.get_setup();
# let screen = setup.roots().nth(screen_num as usize).unwrap();
# let window: x::Window = conn.generate_id();
# let gc: x::Gcontext = conn.generate_id();
// Draw a straight line on a window
let points = &[
x::Point { x: 10, y: 10 },
x::Point { x: 100, y: 10 },
];
conn.send_request(&x::PolyLine {
coordinate_mode: x::CoordMode::Origin,
drawable: x::Drawable::Window(window),
gc,
points,
});
conn.flush()?;
# Ok(())
# }
]]>
Draw lines
-
0
-
1
-
2
Fills rectangles
-
0
-
1
-
2
length
4
string_len
Draws text
string_len
Draws text
-
0
-
1
cmaps_len
Allocate a color
name_len
pixels_len
masks_len
pixels_len
-
0
-
1
-
2
name_len
colors_len
name_len
-
0
-
0
create cursor
Deletes a cursor
-
0
-
1
-
2
name_len
check if extension is present
names_len
keycode_count
keysyms_per_keycode
length
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
0
-
1
-
0
-
1
-
2
value_mask
KeyClickPercent
BellPercent
BellPitch
BellDuration
Led
LedMode
Key
AutoRepeatMode
32
-
0
-
1
-
2
-
0
-
1
-
2
-
0
-
1
-
0
-
1
-
2
-
5
-
6
address_len
address_len
hosts_len
-
0
-
1
-
0
-
1
-
2
-
0
kills a client
atoms_len
-
0
-
1
-
0
-
1
-
2
map_len
map_len
-
0
-
1
-
2
-
3
-
4
-
5
-
6
-
7
keycodes_per_modifier
8
keycodes_per_modifier
8