--- JXGrabKey/C++/src/JXGrabKey.cpp	2010-02-28 10:11:49.000000000 -0500
+++ JXGrabKey/C++/src/JXGrabKey.cpp	2016-06-30 03:15:41.718599000 -0400
@@ -24,4 +24,6 @@
 #include <X11/Xlib.h>
 #include <X11/keysym.h>
+#include <X11/XKBlib.h>
 
+#include <unistd.h>
 #include <pthread.h>
@@ -319,5 +320,5 @@
 
 	XSetErrorHandler((XErrorHandler) xErrorHandler);
-	pthread_spin_init(&x_lock, NULL); // init here bcoz of the returns
+	pthread_spin_init(&x_lock, PTHREAD_PROCESS_SHARED); // init here bcoz of the returns
 
 	doListen = true;
@@ -347,6 +348,6 @@
 									<< keys.at(i).id
 									<< "; type = KeyPress; x11Keycode = '"
-									<< XKeysymToString(XKeycodeToKeysym(dpy,
-											ev.xkey.keycode, 0)) << "' (0x"
+									<< XKeysymToString(XkbKeycodeToKeysym(dpy,
+										ev.xkey.keycode, 0, 0)) << "' (0x"
 									<< std::hex << ev.xkey.keycode
 									<< "); x11Mask = 0x" << std::hex
