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:
8
i3-config-wizard/i3-config-wizard-atoms.xmacro.h
Normal file
8
i3-config-wizard/i3-config-wizard-atoms.xmacro.h
Normal file
@ -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)
|
@ -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 */
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user