/* Authorization systems for the X protocol. */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <assert.h>
#include <X11/Xauth.h>
#include <sys/param.h>
#include <rpc/types.h>
#endif
+#ifdef _WIN32
#ifdef HASXDMAUTH
-#include <X11/Xdmcp.h>
+/* We must include the wrapped windows.h before any system header which includes
+ it unwrapped, to avoid conflicts with types defined in X headers */
+#include <X11/Xwindows.h>
#endif
-
-#ifdef _WIN32
#include "xcb_windefs.h"
#else
#include <arpa/inet.h>
#include "xcb.h"
#include "xcbint.h"
+#ifdef HASXDMAUTH
+#include <X11/Xdmcp.h>
+#endif
enum auth_protos {
#ifdef HASXDMAUTH