$OpenBSD: patch-awesome_c,v 1.10 2013/10/15 09:28:41 dcoppa Exp $

Revert to libXcursor

Revert to the old xcb-util-0.3.6 API

--- awesome.c.orig	Tue Oct 15 10:18:34 2013
+++ awesome.c	Tue Oct 15 10:18:16 2013
@@ -33,6 +33,9 @@
 #include <xcb/xtest.h>
 #include <xcb/shape.h>
 
+#include <X11/Xlib-xcb.h>
+#include <X11/XKBlib.h>
+
 #include <glib-unix.h>
 
 #include "awesome.h"
@@ -83,7 +86,6 @@ awesome_atexit(bool restart)
     xcb_aux_sync(globalconf.connection);
 
     /* Disconnect *after* closing lua */
-    xcb_cursor_context_free(globalconf.cursor_ctx);
     xcb_disconnect(globalconf.connection);
 }
 
@@ -134,7 +136,7 @@ scan(xcb_query_tree_cookie_t tree_c)
 
         if(!attr_r || attr_r->override_redirect
            || attr_r->map_state == XCB_MAP_STATE_UNMAPPED
-           || state == XCB_ICCCM_WM_STATE_WITHDRAWN)
+           || state == XCB_WM_STATE_WITHDRAWN)
         {
             geom_wins[i] = NULL;
             p_delete(&attr_r);
@@ -375,11 +377,21 @@ main(int argc, char **argv)
     sigemptyset(&sa.sa_mask);
     sigaction(SIGSEGV, &sa, 0);
 
+    /* XLib sucks */
+    XkbIgnoreExtension(True);
+
+    /* X stuff */
+    globalconf.display = XOpenDisplay(NULL);
+    if (globalconf.display == NULL) {
+        fatal("cannot open display");
+    }
+    XSetEventQueueOwner(globalconf.display, XCBOwnsEventQueue);
+    globalconf.default_screen = XDefaultScreen(globalconf.display);
+    globalconf.connection = XGetXCBConnection(globalconf.display);
     /* We have no clue where the input focus is right now */
     globalconf.focus.need_update = true;
 
-    /* X stuff */
-    globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
+    /* Double checking that connection is good and operatable with xcb */
     if(xcb_connection_has_error(globalconf.connection))
         fatal("cannot open display");
 
@@ -406,9 +418,6 @@ main(int argc, char **argv)
     xcb_prefetch_extension_data(globalconf.connection, &xcb_randr_id);
     xcb_prefetch_extension_data(globalconf.connection, &xcb_xinerama_id);
     xcb_prefetch_extension_data(globalconf.connection, &xcb_shape_id);
-
-    if (xcb_cursor_context_new(globalconf.connection, globalconf.screen, &globalconf.cursor_ctx) < 0)
-        fatal("Failed to initialize xcb-cursor");
 
     /* Setup the main context */
     g_main_context_set_poll_func(g_main_context_default(), &a_glib_poll);
