1xcb_query_tree(3) XCB Requests xcb_query_tree(3)
2
3
4
6 xcb_query_tree - query the window tree
7
9 #include <xcb/xproto.h>
10
11 Request function
12 xcb_query_tree_cookie_t xcb_query_tree(xcb_connection_t *conn,
13 xcb_window_t window);
14
15 Reply datastructure
16 typedef struct xcb_query_tree_reply_t {
17 uint8_t response_type;
18 uint8_t pad0;
19 uint16_t sequence;
20 uint32_t length;
21 xcb_window_t root;
22 xcb_window_t parent;
23 uint16_t children_len;
24 uint8_t pad1[14];
25 } xcb_query_tree_reply_t;
26
27 Reply function
28 xcb_query_tree_reply_t *xcb_query_tree_reply(xcb_connection_t *conn,
29 xcb_query_tree_cookie_t cookie, xcb_generic_error_t **e);
30
31 Reply accessors
32 xcb_window_t *xcb_query_tree_children(const xcb_query_tree_request_t
33 *reply);
34
35 int xcb_query_tree_children_length(const xcb_query_tree_reply_t
36 *reply);
37
38 xcb_generic_iterator_t xcb_query_tree_children_end(const
39 xcb_query_tree_reply_t *reply);
40
42 conn The XCB connection to X11.
43
44 window The window to query.
45
47 response_type
48 The type of this reply, in this case XCB_QUERY_TREE. This
49 field is also present in the xcb_generic_reply_t and can be
50 used to tell replies apart from each other.
51
52 sequence The sequence number of the last request processed by the X11
53 server.
54
55 length The length of the reply, in words (a word is 4 bytes).
56
57 root The root window of window.
58
59 parent The parent window of window.
60
61 children_len
62 The number of child windows.
63
65 Gets the root window ID, parent window ID and list of children windows
66 for the specified window. The children are listed in bottom-to-top
67 stacking order.
68
70 Returns an xcb_query_tree_cookie_t. Errors have to be handled when
71 calling the reply function xcb_query_tree_reply.
72
73 If you want to handle errors in the event loop instead, use
74 xcb_query_tree_unchecked. See xcb-requests(3) for details.
75
77 This request does never generate any errors.
78
80 /*
81 * Displays the root, parent and children of the specified window.
82 *
83 */
84 void my_example(xcb_connection_t *conn, xcb_window_t window) {
85 xcb_query_tree_cookie_t cookie;
86 xcb_query_tree_reply_t *reply;
87
88 cookie = xcb_query_tree(conn, window);
89 if ((reply = xcb_query_tree_reply(conn, cookie, NULL))) {
90 printf("root = 0x%08x\n", reply->root);
91 printf("parent = 0x%08x\n", reply->parent);
92
93 xcb_window_t *children = xcb_query_tree_children(reply);
94 for (int i = 0; i < xcb_query_tree_children_length(reply); i++)
95 printf("child window = 0x%08x\n", children[i]);
96
97 free(reply);
98 }
99 }
100
102 xcb-requests(3), xcb-examples(3), xwininfo(1)
103
105 Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐
106 rections and improvements.
107
108
109
110X Version 11 libxcb 1.12 xcb_query_tree(3)