Skip to content

Instantly share code, notes, and snippets.

@psychon
Created June 20, 2015 08:50
Show Gist options
  • Save psychon/13189654af8cafb3838b to your computer and use it in GitHub Desktop.
Save psychon/13189654af8cafb3838b to your computer and use it in GitHub Desktop.
diff --git a/awesome.c b/awesome.c
index 046ea3f..49c3d71 100644
--- a/awesome.c
+++ b/awesome.c
@@ -53,6 +53,9 @@
#include <xcb/xtest.h>
#include <xcb/shape.h>
+#include <X11/Xlib-xcb.h>
+#include <X11/XKBlib.h>
+
#include <glib-unix.h>
awesome_t globalconf;
@@ -408,8 +411,16 @@ main(int argc, char **argv)
/* We have no clue where the input focus is right now */
globalconf.focus.need_update = true;
+ /* XLib sucks */
+ XkbIgnoreExtension(True);
+
/* X stuff */
- globalconf.connection = xcb_connect(NULL, &globalconf.default_screen);
+ 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);;
if(xcb_connection_has_error(globalconf.connection))
fatal("cannot open display (error %d)", xcb_connection_has_error(globalconf.connection));
diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake
index 620c2b4..d826abb 100644
--- a/awesomeConfig.cmake
+++ b/awesomeConfig.cmake
@@ -132,6 +132,7 @@ pkg_check_modules(AWESOME_REQUIRED REQUIRED
gdk-pixbuf-2.0
cairo
x11
+ x11-xcb
xcb-cursor
xcb-randr
xcb-xtest
diff --git a/globalconf.h b/globalconf.h
index 5aa635f..73fc81b 100644
--- a/globalconf.h
+++ b/globalconf.h
@@ -65,6 +65,8 @@ ARRAY_TYPE(xproperty_t, xproperty)
/** Main configuration structure */
typedef struct
{
+ /** Xlib Display */
+ Display *display;
/** Connection ref */
xcb_connection_t *connection;
/** Default screen number */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment