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

@ -1,2 +0,0 @@
#include "atoms_NET_SUPPORTED.xmacro"
#include "atoms_rest.xmacro"

View File

@ -1,35 +0,0 @@
xmacro(_NET_SUPPORTED)
xmacro(_NET_SUPPORTING_WM_CHECK)
xmacro(_NET_WM_NAME)
xmacro(_NET_WM_VISIBLE_NAME)
xmacro(_NET_WM_MOVERESIZE)
xmacro(_NET_WM_STATE_STICKY)
xmacro(_NET_WM_STATE_FULLSCREEN)
xmacro(_NET_WM_STATE_DEMANDS_ATTENTION)
xmacro(_NET_WM_STATE_MODAL)
xmacro(_NET_WM_STATE_HIDDEN)
xmacro(_NET_WM_STATE_FOCUSED)
xmacro(_NET_WM_STATE)
xmacro(_NET_WM_WINDOW_TYPE)
xmacro(_NET_WM_WINDOW_TYPE_NORMAL)
xmacro(_NET_WM_WINDOW_TYPE_DOCK)
xmacro(_NET_WM_WINDOW_TYPE_DIALOG)
xmacro(_NET_WM_WINDOW_TYPE_UTILITY)
xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR)
xmacro(_NET_WM_WINDOW_TYPE_SPLASH)
xmacro(_NET_WM_WINDOW_TYPE_MENU)
xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU)
xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP)
xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION)
xmacro(_NET_WM_DESKTOP)
xmacro(_NET_WM_STRUT_PARTIAL)
xmacro(_NET_CLIENT_LIST)
xmacro(_NET_CLIENT_LIST_STACKING)
xmacro(_NET_CURRENT_DESKTOP)
xmacro(_NET_NUMBER_OF_DESKTOPS)
xmacro(_NET_DESKTOP_NAMES)
xmacro(_NET_DESKTOP_VIEWPORT)
xmacro(_NET_ACTIVE_WINDOW)
xmacro(_NET_CLOSE_WINDOW)
xmacro(_NET_MOVERESIZE_WINDOW)

View File

@ -1,20 +0,0 @@
xmacro(_NET_WM_USER_TIME)
xmacro(_NET_STARTUP_ID)
xmacro(_NET_WORKAREA)
xmacro(WM_PROTOCOLS)
xmacro(WM_DELETE_WINDOW)
xmacro(UTF8_STRING)
xmacro(WM_STATE)
xmacro(WM_CLIENT_LEADER)
xmacro(WM_TAKE_FOCUS)
xmacro(WM_WINDOW_ROLE)
xmacro(I3_SOCKET_PATH)
xmacro(I3_CONFIG_PATH)
xmacro(I3_SYNC)
xmacro(I3_SHMLOG_PATH)
xmacro(I3_PID)
xmacro(I3_FLOATING_WINDOW)
xmacro(_NET_REQUEST_FRAME_EXTENTS)
xmacro(_NET_FRAME_EXTENTS)
xmacro(_MOTIF_WM_HINTS)
xmacro(WM_CHANGE_STATE)

View File

@ -0,0 +1,37 @@
// clang-format off
#define I3_NET_SUPPORTED_ATOMS_XMACRO \
xmacro(_NET_SUPPORTED) \
xmacro(_NET_SUPPORTING_WM_CHECK) \
xmacro(_NET_WM_NAME) \
xmacro(_NET_WM_VISIBLE_NAME) \
xmacro(_NET_WM_MOVERESIZE) \
xmacro(_NET_WM_STATE_STICKY) \
xmacro(_NET_WM_STATE_FULLSCREEN) \
xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) \
xmacro(_NET_WM_STATE_MODAL) \
xmacro(_NET_WM_STATE_HIDDEN) \
xmacro(_NET_WM_STATE_FOCUSED) \
xmacro(_NET_WM_STATE) \
xmacro(_NET_WM_WINDOW_TYPE) \
xmacro(_NET_WM_WINDOW_TYPE_NORMAL) \
xmacro(_NET_WM_WINDOW_TYPE_DOCK) \
xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \
xmacro(_NET_WM_WINDOW_TYPE_UTILITY) \
xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR) \
xmacro(_NET_WM_WINDOW_TYPE_SPLASH) \
xmacro(_NET_WM_WINDOW_TYPE_MENU) \
xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) \
xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU) \
xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP) \
xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION) \
xmacro(_NET_WM_DESKTOP) \
xmacro(_NET_WM_STRUT_PARTIAL) \
xmacro(_NET_CLIENT_LIST) \
xmacro(_NET_CLIENT_LIST_STACKING) \
xmacro(_NET_CURRENT_DESKTOP) \
xmacro(_NET_NUMBER_OF_DESKTOPS) \
xmacro(_NET_DESKTOP_NAMES) \
xmacro(_NET_DESKTOP_VIEWPORT) \
xmacro(_NET_ACTIVE_WINDOW) \
xmacro(_NET_CLOSE_WINDOW) \
xmacro(_NET_MOVERESIZE_WINDOW)

View File

@ -0,0 +1,22 @@
// clang-format off
#define I3_REST_ATOMS_XMACRO \
xmacro(_NET_WM_USER_TIME) \
xmacro(_NET_STARTUP_ID) \
xmacro(_NET_WORKAREA) \
xmacro(WM_PROTOCOLS) \
xmacro(WM_DELETE_WINDOW) \
xmacro(UTF8_STRING) \
xmacro(WM_STATE) \
xmacro(WM_CLIENT_LEADER) \
xmacro(WM_TAKE_FOCUS) \
xmacro(WM_WINDOW_ROLE) \
xmacro(I3_SOCKET_PATH) \
xmacro(I3_CONFIG_PATH) \
xmacro(I3_SYNC) \
xmacro(I3_SHMLOG_PATH) \
xmacro(I3_PID) \
xmacro(I3_FLOATING_WINDOW) \
xmacro(_NET_REQUEST_FRAME_EXTENTS) \
xmacro(_NET_FRAME_EXTENTS) \
xmacro(_MOTIF_WM_HINTS) \
xmacro(WM_CHANGE_STATE)

View File

@ -49,8 +49,12 @@
XCB_EVENT_MASK_FOCUS_CHANGE | \
XCB_EVENT_MASK_ENTER_WINDOW)
#include "i3-atoms_rest.xmacro.h"
#include "i3-atoms_NET_SUPPORTED.xmacro.h"
#define xmacro(atom) extern xcb_atom_t A_##atom;
#include "atoms.xmacro"
I3_NET_SUPPORTED_ATOMS_XMACRO
I3_REST_ATOMS_XMACRO
#undef xmacro
extern unsigned int xcb_numlock_mask;