diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2020-05-17 16:38:43 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2020-05-17 16:38:43 +0200 |
commit | 1b8ddd5fd16a3de46d84328054a8c4a3adcdeb11 (patch) | |
tree | 05fc99f41c9f0d95636edd4bbb77c0dce3502ba2 /i3-nagbar | |
parent | 08052ddeb9c8fc71a970b71787d018c710391ff2 (diff) | |
download | i3-1b8ddd5fd16a3de46d84328054a8c4a3adcdeb11.tar.gz i3-1b8ddd5fd16a3de46d84328054a8c4a3adcdeb11.zip |
xmacro: declare in header files, instantiate instead of include
This works better with meson, where .h files can be declared as being part of an
executable easily, but I couldn’t find a way to declare
e.g. include/atoms.xmacro as a dependency.
related to #4086
Diffstat (limited to 'i3-nagbar')
-rw-r--r-- | i3-nagbar/i3-nagbar-atoms.xmacro.h | 8 | ||||
-rw-r--r-- | i3-nagbar/main.c | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/i3-nagbar/i3-nagbar-atoms.xmacro.h b/i3-nagbar/i3-nagbar-atoms.xmacro.h new file mode 100644 index 00000000..c430b59a --- /dev/null +++ b/i3-nagbar/i3-nagbar-atoms.xmacro.h @@ -0,0 +1,8 @@ +// clang-format off +#define NAGBAR_ATOMS_XMACRO \ +xmacro(_NET_WM_WINDOW_TYPE) \ +xmacro(_NET_WM_WINDOW_TYPE_DOCK) \ +xmacro(_NET_WM_STRUT_PARTIAL) \ +xmacro(I3_SOCKET_PATH) \ +xmacro(ATOM) \ +xmacro(CARDINAL) diff --git a/i3-nagbar/main.c b/i3-nagbar/main.c index 51e5475c..b13ee134 100644 --- a/i3-nagbar/main.c +++ b/i3-nagbar/main.c @@ -35,6 +35,8 @@ xcb_visualtype_t *visual_type = NULL; #define SN_API_NOT_YET_FROZEN 1 #include <libsn/sn-launchee.h> +#include "i3-nagbar-atoms.xmacro.h" + #define MSG_PADDING logical_px(8) #define BTN_PADDING logical_px(3) #define BTN_BORDER logical_px(3) @@ -43,7 +45,7 @@ xcb_visualtype_t *visual_type = NULL; #define BAR_BORDER logical_px(2) #define xmacro(atom) xcb_atom_t A_##atom; -#include "atoms.xmacro" +NAGBAR_ATOMS_XMACRO #undef xmacro #define die(...) errx(EXIT_FAILURE, __VA_ARGS__); @@ -426,7 +428,7 @@ int main(int argc, char *argv[]) { /* Place requests for the atoms we need as soon as possible */ #define xmacro(atom) \ xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom); -#include "atoms.xmacro" + NAGBAR_ATOMS_XMACRO #undef xmacro /* Init startup notification. */ @@ -508,7 +510,7 @@ int main(int argc, char *argv[]) { A_##name = reply->atom; \ free(reply); \ } while (0); -#include "atoms.xmacro" + NAGBAR_ATOMS_XMACRO #undef xmacro /* Set dock mode */ |