atom: add get_atom_cached

Add a version of get_atom that does not query the X server.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2024-02-15 20:12:20 +00:00
parent 071b77c49f
commit 580aef939f

View File

@@ -65,6 +65,10 @@ static inline xcb_atom_t get_atom(struct atom *a, const char *key) {
return (xcb_atom_t)(intptr_t)cache_get_or_fetch(a->c, key, NULL);
}
static inline xcb_atom_t get_atom_cached(struct atom *a, const char *key) {
return (xcb_atom_t)(intptr_t)cache_get(a->c, key);
}
static inline void destroy_atoms(struct atom *a) {
cache_free(a->c);
free(a);