Manually updating a magic number doesn’t work in the long run.
With this change, the number of atoms contained in
include/atoms_NET_SUPPORTED.xmacro is used.
fixes #2230
-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)
-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_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(_NET_REQUEST_FRAME_EXTENTS)
-xmacro(_NET_FRAME_EXTENTS)
-xmacro(_MOTIF_WM_HINTS)
+#include "atoms_NET_SUPPORTED.xmacro"
+#include "atoms_rest.xmacro"
--- /dev/null
+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)
+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)
--- /dev/null
+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(_NET_REQUEST_FRAME_EXTENTS)
+xmacro(_NET_FRAME_EXTENTS)
+xmacro(_MOTIF_WM_HINTS)
void ewmh_setup_hints(void) {
xcb_atom_t supported_atoms[] = {
#define xmacro(atom) A_##atom,
-#include "atoms.xmacro"
+#include "atoms_NET_SUPPORTED.xmacro"
#undef xmacro
};
/* I’m not entirely sure if we need to keep _NET_WM_NAME on root. */
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3");
- /* only send the first 32 atoms (last one is _NET_CLOSE_WINDOW) increment that number when adding supported atoms */
- xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, /* number of atoms */ 32, supported_atoms);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTED, XCB_ATOM_ATOM, 32, /* number of atoms */ sizeof(supported_atoms) / sizeof(xcb_atom_t), supported_atoms);
/* We need to map this window to be able to set the input focus to it if no other window is available to be focused. */
xcb_map_window(conn, ewmh_window);