1xcb_intern_atom(3) XCB Requests xcb_intern_atom(3)
2
3
4
6 xcb_intern_atom - Get atom identifier by name
7
9 #include <xcb/xproto.h>
10
11 Request function
12 xcb_intern_atom_cookie_t xcb_intern_atom(xcb_connection_t *conn,
13 uint8_t only_if_exists, uint16_t name_len, const char *name);
14
15 Reply datastructure
16 typedef struct xcb_intern_atom_reply_t {
17 uint8_t response_type;
18 uint8_t pad0;
19 uint16_t sequence;
20 uint32_t length;
21 xcb_atom_t atom;
22 } xcb_intern_atom_reply_t;
23
24 Reply function
25 xcb_intern_atom_reply_t *xcb_intern_atom_reply(xcb_connection_t *conn,
26 xcb_intern_atom_cookie_t cookie, xcb_generic_error_t **e);
27
29 conn The XCB connection to X11.
30
31 only_if_exists
32 Return a valid atom id only if the atom already exists.
33
34 name_len The length of the following name.
35
36 name The name of the atom.
37
39 response_type
40 The type of this reply, in this case XCB_INTERN_ATOM. This
41 field is also present in the xcb_generic_reply_t and can be
42 used to tell replies apart from each other.
43
44 sequence The sequence number of the last request processed by the X11
45 server.
46
47 length The length of the reply, in words (a word is 4 bytes).
48
49 atom TODO: NOT YET DOCUMENTED.
50
52 Retrieves the identifier (xcb_atom_t TODO) for the atom with the speci‐
53 fied name. Atoms are used in protocols like EWMH, for example to store
54 window titles (_NET_WM_NAME atom) as property of a window.
55
56 If only_if_exists is 0, the atom will be created if it does not already
57 exist. If only_if_exists is 1, XCB_ATOM_NONE will be returned if the
58 atom does not yet exist.
59
61 Returns an xcb_intern_atom_cookie_t. Errors have to be handled when
62 calling the reply function xcb_intern_atom_reply.
63
64 If you want to handle errors in the event loop instead, use xcb_in‐
65 tern_atom_unchecked. See xcb-requests(3) for details.
66
68 xcb_alloc_error_t
69 TODO: reasons?
70
71 xcb_value_error_t
72 A value other than 0 or 1 was specified for only_if_exists.
73
75 /*
76 * Resolves the _NET_WM_NAME atom.
77 *
78 */
79 void my_example(xcb_connection_t *c) {
80 xcb_intern_atom_cookie_t cookie;
81 xcb_intern_atom_reply_t *reply;
82
83 cookie = xcb_intern_atom(c, 0, strlen("_NET_WM_NAME"), "_NET_WM_NAME");
84 /* ... do other work here if possible ... */
85 if ((reply = xcb_intern_atom_reply(c, cookie, NULL))) {
86 printf("The _NET_WM_NAME atom has ID %u0, reply->atom);
87 free(reply);
88 }
89 }
90
92 xcb-requests(3), xcb-examples(3), xcb_get_atom_name(3), xlsatoms(1)
93
95 Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐
96 rections and improvements.
97
98
99
100X Version 11 libxcb 1.13 xcb_intern_atom(3)