Codebase list i3-gaps / 1b8ddd5
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 Michael Stapelberg 3 years ago
15 changed file(s) with 109 addition(s) and 74 deletion(s). Raw diff Collapse all Expand all
377377 $(XCB_UTIL_CURSOR_LIBS)
378378
379379 i3_nagbar_i3_nagbar_SOURCES = \
380 i3-nagbar/atoms.xmacro \
380 i3-nagbar/i3-nagbar-atoms.xmacro.h \
381381 i3-nagbar/main.c
382382
383383 i3bar_i3bar_CPPFLAGS = \
436436 $(XKBCOMMON_LIBS)
437437
438438 i3_config_wizard_i3_config_wizard_SOURCES = \
439 i3-config-wizard/atoms.xmacro \
439 i3-config-wizard/i3-config-wizard-atoms.xmacro.h \
440440 i3-config-wizard/main.c \
441441 i3-config-wizard/xcb.h
442442
499499 i3_SOURCES = \
500500 include/all.h \
501501 include/assignments.h \
502 include/atoms_NET_SUPPORTED.xmacro \
503 include/atoms_rest.xmacro \
504 include/atoms.xmacro \
502 include/i3-atoms_NET_SUPPORTED.xmacro.h \
503 include/i3-atoms_rest.xmacro.h \
505504 include/bindings.h \
506505 include/click.h \
507506 include/cmdparse.h \
253253 Handlers to update X11 window properties like +WM_CLASS+, +_NET_WM_NAME+,
254254 +CLIENT_LEADER+, etc.
255255
256 include/atoms.xmacro::
256 include/*.xmacro.*::
257257 A file containing all X11 atoms which i3 uses. This file will be included
258258 various times (for defining, requesting and receiving the atoms), each time
259259 with a different definition of xmacro().
0 // clang-format off
1 #define CONFIG_WIZARD_ATOMS_XMACRO \
2 xmacro(_NET_WM_NAME) \
3 xmacro(_NET_WM_WINDOW_TYPE) \
4 xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \
5 xmacro(ATOM) \
6 xmacro(CARDINAL) \
7 xmacro(UTF8_STRING)
4949 #include <X11/XKBlib.h>
5050 #include <X11/Xlib.h>
5151 #include <X11/keysym.h>
52
53 #include "i3-config-wizard-atoms.xmacro.h"
5254
5355 /* We need SYSCONFDIR for the path to the keycode config template, so raise an
5456 * error if it’s not defined for whatever reason */
842844 /* Place requests for the atoms we need as soon as possible */
843845 #define xmacro(atom) \
844846 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
845 #include "atoms.xmacro"
847 CONFIG_WIZARD_ATOMS_XMACRO
846848 #undef xmacro
847849
848850 /* Init startup notification. */
899901 A_##name = reply->atom; \
900902 free(reply); \
901903 } while (0);
902 #include "atoms.xmacro"
904 CONFIG_WIZARD_ATOMS_XMACRO
903905 #undef xmacro
904906
905907 /* Set dock mode */
22 /* from X11/keysymdef.h */
33 #define XCB_NUM_LOCK 0xff7f
44
5 #include "i3-config-wizard-atoms.xmacro.h"
6
57 #define xmacro(atom) xcb_atom_t A_##atom;
6 #include "atoms.xmacro"
8 CONFIG_WIZARD_ATOMS_XMACRO
79 #undef xmacro
0 // clang-format off
1 #define NAGBAR_ATOMS_XMACRO \
2 xmacro(_NET_WM_WINDOW_TYPE) \
3 xmacro(_NET_WM_WINDOW_TYPE_DOCK) \
4 xmacro(_NET_WM_STRUT_PARTIAL) \
5 xmacro(I3_SOCKET_PATH) \
6 xmacro(ATOM) \
7 xmacro(CARDINAL)
3434 #define SN_API_NOT_YET_FROZEN 1
3535 #include <libsn/sn-launchee.h>
3636
37 #include "i3-nagbar-atoms.xmacro.h"
38
3739 #define MSG_PADDING logical_px(8)
3840 #define BTN_PADDING logical_px(3)
3941 #define BTN_BORDER logical_px(3)
4244 #define BAR_BORDER logical_px(2)
4345
4446 #define xmacro(atom) xcb_atom_t A_##atom;
45 #include "atoms.xmacro"
47 NAGBAR_ATOMS_XMACRO
4648 #undef xmacro
4749
4850 #define die(...) errx(EXIT_FAILURE, __VA_ARGS__);
425427 /* Place requests for the atoms we need as soon as possible */
426428 #define xmacro(atom) \
427429 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
428 #include "atoms.xmacro"
430 NAGBAR_ATOMS_XMACRO
429431 #undef xmacro
430432
431433 /* Init startup notification. */
507509 A_##name = reply->atom; \
508510 free(reply); \
509511 } while (0);
510 #include "atoms.xmacro"
512 NAGBAR_ATOMS_XMACRO
511513 #undef xmacro
512514
513515 /* Set dock mode */
+0
-2
include/atoms.xmacro less more
0 #include "atoms_NET_SUPPORTED.xmacro"
1 #include "atoms_rest.xmacro"
+0
-35
include/atoms_NET_SUPPORTED.xmacro less more
0 xmacro(_NET_SUPPORTED)
1 xmacro(_NET_SUPPORTING_WM_CHECK)
2 xmacro(_NET_WM_NAME)
3 xmacro(_NET_WM_VISIBLE_NAME)
4 xmacro(_NET_WM_MOVERESIZE)
5 xmacro(_NET_WM_STATE_STICKY)
6 xmacro(_NET_WM_STATE_FULLSCREEN)
7 xmacro(_NET_WM_STATE_DEMANDS_ATTENTION)
8 xmacro(_NET_WM_STATE_MODAL)
9 xmacro(_NET_WM_STATE_HIDDEN)
10 xmacro(_NET_WM_STATE_FOCUSED)
11 xmacro(_NET_WM_STATE)
12 xmacro(_NET_WM_WINDOW_TYPE)
13 xmacro(_NET_WM_WINDOW_TYPE_NORMAL)
14 xmacro(_NET_WM_WINDOW_TYPE_DOCK)
15 xmacro(_NET_WM_WINDOW_TYPE_DIALOG)
16 xmacro(_NET_WM_WINDOW_TYPE_UTILITY)
17 xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR)
18 xmacro(_NET_WM_WINDOW_TYPE_SPLASH)
19 xmacro(_NET_WM_WINDOW_TYPE_MENU)
20 xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU)
21 xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU)
22 xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP)
23 xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION)
24 xmacro(_NET_WM_DESKTOP)
25 xmacro(_NET_WM_STRUT_PARTIAL)
26 xmacro(_NET_CLIENT_LIST)
27 xmacro(_NET_CLIENT_LIST_STACKING)
28 xmacro(_NET_CURRENT_DESKTOP)
29 xmacro(_NET_NUMBER_OF_DESKTOPS)
30 xmacro(_NET_DESKTOP_NAMES)
31 xmacro(_NET_DESKTOP_VIEWPORT)
32 xmacro(_NET_ACTIVE_WINDOW)
33 xmacro(_NET_CLOSE_WINDOW)
34 xmacro(_NET_MOVERESIZE_WINDOW)
+0
-20
include/atoms_rest.xmacro less more
0 xmacro(_NET_WM_USER_TIME)
1 xmacro(_NET_STARTUP_ID)
2 xmacro(_NET_WORKAREA)
3 xmacro(WM_PROTOCOLS)
4 xmacro(WM_DELETE_WINDOW)
5 xmacro(UTF8_STRING)
6 xmacro(WM_STATE)
7 xmacro(WM_CLIENT_LEADER)
8 xmacro(WM_TAKE_FOCUS)
9 xmacro(WM_WINDOW_ROLE)
10 xmacro(I3_SOCKET_PATH)
11 xmacro(I3_CONFIG_PATH)
12 xmacro(I3_SYNC)
13 xmacro(I3_SHMLOG_PATH)
14 xmacro(I3_PID)
15 xmacro(I3_FLOATING_WINDOW)
16 xmacro(_NET_REQUEST_FRAME_EXTENTS)
17 xmacro(_NET_FRAME_EXTENTS)
18 xmacro(_MOTIF_WM_HINTS)
19 xmacro(WM_CHANGE_STATE)
0 // clang-format off
1 #define I3_NET_SUPPORTED_ATOMS_XMACRO \
2 xmacro(_NET_SUPPORTED) \
3 xmacro(_NET_SUPPORTING_WM_CHECK) \
4 xmacro(_NET_WM_NAME) \
5 xmacro(_NET_WM_VISIBLE_NAME) \
6 xmacro(_NET_WM_MOVERESIZE) \
7 xmacro(_NET_WM_STATE_STICKY) \
8 xmacro(_NET_WM_STATE_FULLSCREEN) \
9 xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) \
10 xmacro(_NET_WM_STATE_MODAL) \
11 xmacro(_NET_WM_STATE_HIDDEN) \
12 xmacro(_NET_WM_STATE_FOCUSED) \
13 xmacro(_NET_WM_STATE) \
14 xmacro(_NET_WM_WINDOW_TYPE) \
15 xmacro(_NET_WM_WINDOW_TYPE_NORMAL) \
16 xmacro(_NET_WM_WINDOW_TYPE_DOCK) \
17 xmacro(_NET_WM_WINDOW_TYPE_DIALOG) \
18 xmacro(_NET_WM_WINDOW_TYPE_UTILITY) \
19 xmacro(_NET_WM_WINDOW_TYPE_TOOLBAR) \
20 xmacro(_NET_WM_WINDOW_TYPE_SPLASH) \
21 xmacro(_NET_WM_WINDOW_TYPE_MENU) \
22 xmacro(_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) \
23 xmacro(_NET_WM_WINDOW_TYPE_POPUP_MENU) \
24 xmacro(_NET_WM_WINDOW_TYPE_TOOLTIP) \
25 xmacro(_NET_WM_WINDOW_TYPE_NOTIFICATION) \
26 xmacro(_NET_WM_DESKTOP) \
27 xmacro(_NET_WM_STRUT_PARTIAL) \
28 xmacro(_NET_CLIENT_LIST) \
29 xmacro(_NET_CLIENT_LIST_STACKING) \
30 xmacro(_NET_CURRENT_DESKTOP) \
31 xmacro(_NET_NUMBER_OF_DESKTOPS) \
32 xmacro(_NET_DESKTOP_NAMES) \
33 xmacro(_NET_DESKTOP_VIEWPORT) \
34 xmacro(_NET_ACTIVE_WINDOW) \
35 xmacro(_NET_CLOSE_WINDOW) \
36 xmacro(_NET_MOVERESIZE_WINDOW)
0 // clang-format off
1 #define I3_REST_ATOMS_XMACRO \
2 xmacro(_NET_WM_USER_TIME) \
3 xmacro(_NET_STARTUP_ID) \
4 xmacro(_NET_WORKAREA) \
5 xmacro(WM_PROTOCOLS) \
6 xmacro(WM_DELETE_WINDOW) \
7 xmacro(UTF8_STRING) \
8 xmacro(WM_STATE) \
9 xmacro(WM_CLIENT_LEADER) \
10 xmacro(WM_TAKE_FOCUS) \
11 xmacro(WM_WINDOW_ROLE) \
12 xmacro(I3_SOCKET_PATH) \
13 xmacro(I3_CONFIG_PATH) \
14 xmacro(I3_SYNC) \
15 xmacro(I3_SHMLOG_PATH) \
16 xmacro(I3_PID) \
17 xmacro(I3_FLOATING_WINDOW) \
18 xmacro(_NET_REQUEST_FRAME_EXTENTS) \
19 xmacro(_NET_FRAME_EXTENTS) \
20 xmacro(_MOTIF_WM_HINTS) \
21 xmacro(WM_CHANGE_STATE)
4848 XCB_EVENT_MASK_FOCUS_CHANGE | \
4949 XCB_EVENT_MASK_ENTER_WINDOW)
5050
51 #include "i3-atoms_rest.xmacro.h"
52 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
53
5154 #define xmacro(atom) extern xcb_atom_t A_##atom;
52 #include "atoms.xmacro"
55 I3_NET_SUPPORTED_ATOMS_XMACRO
56 I3_REST_ATOMS_XMACRO
5357 #undef xmacro
5458
5559 extern unsigned int xcb_numlock_mask;
77 *
88 */
99 #include "all.h"
10
11 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
1012
1113 xcb_window_t ewmh_window;
1214
304306 void ewmh_setup_hints(void) {
305307 xcb_atom_t supported_atoms[] = {
306308 #define xmacro(atom) A_##atom,
307 #include "atoms_NET_SUPPORTED.xmacro"
309 I3_NET_SUPPORTED_ATOMS_XMACRO
308310 #undef xmacro
309311 };
310312
3030
3131 #include "sd-daemon.h"
3232
33 #include "i3-atoms_NET_SUPPORTED.xmacro.h"
34 #include "i3-atoms_rest.xmacro.h"
35
3336 /* The original value of RLIMIT_CORE when i3 was started. We need to restore
3437 * this before starting any other process, since we set RLIMIT_CORE to
3538 * RLIM_INFINITY for i3 debugging versions. */
97100
98101 /* Define all atoms as global variables */
99102 #define xmacro(atom) xcb_atom_t A_##atom;
100 #include "atoms.xmacro"
103 I3_NET_SUPPORTED_ATOMS_XMACRO
104 I3_REST_ATOMS_XMACRO
101105 #undef xmacro
102106
103107 /*
558562 /* Place requests for the atoms we need as soon as possible */
559563 #define xmacro(atom) \
560564 xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);
561 #include "atoms.xmacro"
565 I3_NET_SUPPORTED_ATOMS_XMACRO
566 I3_REST_ATOMS_XMACRO
562567 #undef xmacro
563568
564569 root_depth = root_screen->root_depth;
604609 A_##name = reply->atom; \
605610 free(reply); \
606611 } while (0);
607 #include "atoms.xmacro"
612 I3_NET_SUPPORTED_ATOMS_XMACRO
613 I3_REST_ATOMS_XMACRO
608614 #undef xmacro
609615
610616 load_configuration(override_configpath, C_LOAD);