Debian Codegraph @

src/x11/x11-priv.h

raw
1 /*
2 * Copyright © 2013 Ran Benita
3 * SPDX-License-Identifier: MIT
4 */
5 #pragma once
6
7 #include "config.h"
8
9 #include <xcb/xkb.h>
10
11 #include "keymap.h"
12 #include "xkbcommon/xkbcommon-x11.h"
13
14 struct x11_atom_interner {
15 struct xkb_context *ctx;
16 xcb_connection_t *conn;
17 bool had_error;
18 /* Atoms for which we send a GetAtomName request */
19 struct {
20 xcb_atom_t from;
21 xkb_atom_t *out;
22 xcb_get_atom_name_cookie_t cookie;
23 } pending[128];
24 size_t num_pending;
25 /* Atoms which were already pending but queried again */
26 struct {
27 xcb_atom_t from;
28 xkb_atom_t *out;
29 } copies[128];
30 size_t num_copies;
31 /* These are not interned, but saved directly (after XkbEscapeMapName) */
32 struct {
33 xcb_get_atom_name_cookie_t cookie;
34 char **out;
35 } escaped[4];
36 size_t num_escaped;
37 };
38
39 void
40 x11_atom_interner_init(struct x11_atom_interner *interner,
41 struct xkb_context *ctx, xcb_connection_t *conn);
42
43 void
44 x11_atom_interner_round_trip(struct x11_atom_interner *interner);
45
46 /*
47 * Make a xkb_atom_t's from X atoms. The actual write is delayed until the next
48 * call to x11_atom_interner_round_trip() or when too many atoms are pending.
49 */
50 void
51 x11_atom_interner_adopt_atom(struct x11_atom_interner *interner,
52 const xcb_atom_t atom, xkb_atom_t *out);
53
54 /*
55 * Get a strdup'd and XkbEscapeMapName'd name of an X atom. The actual write is
56 * delayed until the next call to x11_atom_interner_round_trip().
57 */
58 void
59 x11_atom_interner_get_escaped_atom_name(struct x11_atom_interner *interner,
60 xcb_atom_t atom, char **out);