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-config-wizard | |
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-config-wizard')
-rw-r--r-- | i3-config-wizard/i3-config-wizard-atoms.xmacro.h | 8 | ||||
-rw-r--r-- | i3-config-wizard/main.c | 6 | ||||
-rw-r--r-- | i3-config-wizard/xcb.h | 4 |
3 files changed, 15 insertions, 3 deletions
diff --git a/i3-config-wizard/i3-config-wizard-atoms.xmacro.h b/i3-config-wizard/i3-config-wizard-atoms.xmacro.h new file mode 100644 index 00000000..2d504678 --- /dev/null +++ b/i3-config-wizard/i3-config-wizard-atoms.xmacro.h @@ -0,0 +1,8 @@ +// clang-format off +#define CONFIG_WIZARD_ATOMS_XMACRO \ +xmacro(_NET_WM_NAME) \ +xmacro(_NET_WM_WINDOW_TYPE) \ +xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \ +xmacro(ATOM) \ +xmacro(CARDINAL) \ +xmacro(UTF8_STRING) diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index 9e07d1f7..25117f2b 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -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 it’s 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 */ diff --git a/i3-config-wizard/xcb.h b/i3-config-wizard/xcb.h index f3e204e8..dc8568a7 100644 --- a/i3-config-wizard/xcb.h +++ b/i3-config-wizard/xcb.h @@ -3,6 +3,8 @@ /* from X11/keysymdef.h */ #define XCB_NUM_LOCK 0xff7f +#include "i3-config-wizard-atoms.xmacro.h" + #define xmacro(atom) xcb_atom_t A_##atom; -#include "atoms.xmacro" +CONFIG_WIZARD_ATOMS_XMACRO #undef xmacro |