diff options
| author | allusive-dev <[email protected]> | 2023-09-19 17:47:33 +1000 |
|---|---|---|
| committer | allusive-dev <[email protected]> | 2023-09-19 17:47:33 +1000 |
| commit | a93aba600b1c5d019b680b9f4ff3fa85d5d43a60 (patch) | |
| tree | 77f8152222655657472a70e0bfa413a0495dd555 /src/atom.h | |
| parent | reset (diff) | |
| download | compfy-a93aba600b1c5d019b680b9f4ff3fa85d5d43a60.tar.xz compfy-a93aba600b1c5d019b680b9f4ff3fa85d5d43a60.zip | |
Fixed broken files/code and other errors
Diffstat (limited to 'src/atom.h')
| -rw-r--r-- | src/atom.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/atom.h b/src/atom.h new file mode 100644 index 0000000..baf3360 --- /dev/null +++ b/src/atom.h @@ -0,0 +1,68 @@ +#pragma once +#include <stdlib.h> + +#include <xcb/xcb.h> + +#include "meta.h" +#include "cache.h" + +// clang-format off +// Splitted into 2 lists because of the limitation of our macros +#define ATOM_LIST1 \ + _NET_WM_WINDOW_OPACITY, \ + _NET_FRAME_EXTENTS, \ + WM_STATE, \ + _NET_WM_NAME, \ + _NET_WM_PID, \ + WM_NAME, \ + WM_CLASS, \ + WM_ICON_NAME, \ + WM_TRANSIENT_FOR, \ + WM_WINDOW_ROLE, \ + WM_CLIENT_LEADER, \ + WM_CLIENT_MACHINE, \ + _NET_ACTIVE_WINDOW, \ + _COMPTON_SHADOW, \ + _NET_WM_WINDOW_TYPE, \ + _NET_CURRENT_DESKTOP + +#define ATOM_LIST2 \ + _NET_WM_WINDOW_TYPE_DESKTOP, \ + _NET_WM_WINDOW_TYPE_DOCK, \ + _NET_WM_WINDOW_TYPE_TOOLBAR, \ + _NET_WM_WINDOW_TYPE_MENU, \ + _NET_WM_WINDOW_TYPE_UTILITY, \ + _NET_WM_WINDOW_TYPE_SPLASH, \ + _NET_WM_WINDOW_TYPE_DIALOG, \ + _NET_WM_WINDOW_TYPE_NORMAL, \ + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, \ + _NET_WM_WINDOW_TYPE_POPUP_MENU, \ + _NET_WM_WINDOW_TYPE_TOOLTIP, \ + _NET_WM_WINDOW_TYPE_NOTIFICATION, \ + _NET_WM_WINDOW_TYPE_COMBO, \ + _NET_WM_WINDOW_TYPE_DND, \ + _NET_WM_STATE, \ + _NET_WM_STATE_FULLSCREEN, \ + _NET_WM_BYPASS_COMPOSITOR, \ + UTF8_STRING, \ + C_STRING +// clang-format on + +#define ATOM_DEF(x) xcb_atom_t a##x + +struct atom { + struct cache *c; + LIST_APPLY(ATOM_DEF, SEP_COLON, ATOM_LIST1); + LIST_APPLY(ATOM_DEF, SEP_COLON, ATOM_LIST2); +}; + +struct atom *init_atoms(xcb_connection_t *); + +static inline xcb_atom_t get_atom(struct atom *a, const char *key) { + return (xcb_atom_t)(intptr_t)cache_get(a->c, key, NULL); +} + +static inline void destroy_atoms(struct atom *a) { + cache_free(a->c); + free(a); +} |