1 #include "xlib_wrapper.h"
2 #include <QApplication>
9 #include <X11/XKBlib.h>
11 XlibWrapper::XlibWrapper()
13 timer = new QTimer(this);
14 timer->setSingleShot(true);
15 connect(timer, SIGNAL(timeout()),
16 this, SLOT(XlibWrapperSlot()));
20 void XlibWrapper::XlibWrapperSlot()
30 qDebug() << "Timer...";
31 dpy = XkbOpenDisplay(NULL,
33 &error_rtrn, NULL, NULL, &reason_rtrn);
35 qDebug() << "Cannot open display";
39 /* We would like receive the only Xkb event: XkbStateNotify. And only
40 * when XkbLockGroup happens. */
41 if (False == XkbSelectEvents(dpy,
45 qDebug() << "Cannot XkbSelectEvents.";
49 if (False == XkbSelectEventDetails(dpy,
54 qDebug() << "Cannot XkbSelectEventDetails.";
59 XNextEvent(dpy, &labuda.core);
60 state = labuda.state.group;
61 /* Should not be necessary, here works only with 2 keyboard dispositions */
62 if ((state < 0) || (state > 1))
64 qDebug() << "XNextEvent";
65 /* TODO: update flag depending on state */