split atoms.xmacro into 2 files to obtain _NET_SUPPORTED count

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
This commit is contained in:
Michael Stapelberg
2016-02-23 21:47:00 +01:00
parent eb631ce3c3
commit fdbbae56b2
4 changed files with 55 additions and 54 deletions

View File

@ -284,7 +284,7 @@ void ewmh_update_sticky(xcb_window_t window, bool sticky) {
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
};
@ -313,8 +313,7 @@ void ewmh_setup_hints(void) {
/* Im 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);