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
This commit is contained in:
Michael Stapelberg
2020-05-17 16:38:43 +02:00
parent 08052ddeb9
commit 1b8ddd5fd1
15 changed files with 109 additions and 74 deletions

View File

@ -51,6 +51,8 @@
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include "i3-config-wizard-atoms.xmacro.h"
/* We need SYSCONFDIR for the path to the keycode config template, so raise an
* error if its not defined for whatever reason */
#ifndef SYSCONFDIR
@ -843,7 +845,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"
CONFIG_WIZARD_ATOMS_XMACRO
#undef xmacro
/* Init startup notification. */
@ -900,7 +902,7 @@ int main(int argc, char *argv[]) {
A_##name = reply->atom; \
free(reply); \
} while (0);
#include "atoms.xmacro"
CONFIG_WIZARD_ATOMS_XMACRO
#undef xmacro
/* Set dock mode */