fix event filter
authorGuillaume Castagnino <casta@xwing.info>
Thu, 12 Mar 2020 20:58:23 +0000 (21:58 +0100)
committerGuillaume Castagnino <casta@xwing.info>
Thu, 12 Mar 2020 20:58:23 +0000 (21:58 +0100)
xcbEventFilter.cpp

index 0141f77469f6b69ef77d32d59c9f43612778d722..f7289c16e11e67553b9efbe0d546fb4073d69ab4 100644 (file)
@@ -18,16 +18,13 @@ XcbEventFilter::~XcbEventFilter()
 bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *)
 {
     if (eventType == "xcb_generic_event_t") {
-        xcb_generic_event_t *event = static_cast<xcb_generic_event_t *>(message);
-        uint response_type = event->response_type & ~0x80;
-
-        qDebug() << "XCB Event";
         /* We are only interested in XCB_XKB_STATE_NOTIFY */
-        if (response_type ==  XCB_XKB_STATE_NOTIFY)
-        {
-            xcb_xkb_state_notify_event_t *kbd_event = reinterpret_cast<xcb_xkb_state_notify_event_t *>(event);
-
-            qDebug() << "XCB Mapping Event - group: " << kbd_event->group;
+        xcb_xkb_state_notify_event_t *xkb_event = static_cast<xcb_xkb_state_notify_event_t *>(message);
+        //qDebug() << "XCB Event: " << xkb_event->any.response_type;
+        if (xkb_event->xkbType == XCB_XKB_STATE_NOTIFY) {
+            /* We get the event twice here. Not critical, but to investigate */
+            qDebug() << "XCB Mapping Event - group: " << xkb_event->group << " - eventType: " << xkb_event->eventType;
+            // TODO: update QML flag
         }
     }
     return false;