--- src/waveform/vsyncthread.h.orig	2015-12-21 14:23:59.671910985 +0100
+++ src/waveform/vsyncthread.h	2015-12-21 14:24:38.067912746 +0100
@@ -18,10 +18,11 @@
     #include <GL/glx.h>
     //#include "GL/glxext.h"
     // clean up after Xlib.h, which #defines values that conflict with QT.
-    #undef Bool
-    #undef Unsorted
 #endif // QT_OPENGL_ES_2
 #endif // QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+    #include <X11/Xlib.h>
+    #undef Bool
+    #undef Unsorted
 #endif
 
 #include "util/performancetimer.h"
