From 2eac53fada7a8ac8fc28b0b9e894c5f2899b8aa2 Mon Sep 17 00:00:00 2001
From: Orestis Floros <orestisflo@gmail.com>
Date: Sat, 1 Feb 2020 17:29:44 +0100
Subject: [PATCH] atoms: Properly declare as global variables

See #3914
---
 include/xcb.h | 2 +-
 src/main.c    | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/xcb.h b/include/xcb.h
index 53c932bf..32110c7d 100644
--- a/include/xcb.h
+++ b/include/xcb.h
@@ -56,7 +56,7 @@
                          XCB_EVENT_MASK_FOCUS_CHANGE |                                                \
                          XCB_EVENT_MASK_ENTER_WINDOW)
 
-#define xmacro(atom) xcb_atom_t A_##atom;
+#define xmacro(atom) extern xcb_atom_t A_##atom;
 #include "atoms.xmacro"
 #undef xmacro
 
diff --git a/src/main.c b/src/main.c
index 42d15735..e4c6b2c9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -93,6 +93,11 @@ bool shape_supported = true;
 
 bool force_xinerama = false;
 
+/* Define all atoms as global variables */
+#define xmacro(atom) xcb_atom_t A_##atom;
+#include "atoms.xmacro"
+#undef xmacro
+
 /*
  * This callback is only a dummy, see xcb_prepare_cb.
  * See also man libev(3): "ev_prepare" and "ev_check" - customise your event loop