1#include "HookUnixNativeEventFilter.h"
5#include <QLoggingCategory>
7static Q_LOGGING_CATEGORY(log,
"Client.Hook.Unix")
15print_modifiers (uint32_t mask)
17 const char **mod, *mods[] = {
18 "Shift",
"Lock",
"Ctrl",
"Alt",
19 "Mod2",
"Mod3",
"Mod4",
"Mod5",
20 "Button1",
"Button2",
"Button3",
"Button4",
"Button5"
22 qDebug() <<
"Modifier mask: ";
23 for (mod = mods ; mask; mask >>= 1, mod++)
29#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
30bool CHookUnixNativeEventFilter::nativeEventFilter(
const QByteArray &eventType,
void *message, qintptr *result)
32bool CHookUnixNativeEventFilter::nativeEventFilter(
const QByteArray &eventType,
void *message,
long *result)
35 qDebug(log) <<
"CClient::nativeEventFilter:" << eventType;
36 if (eventType ==
"xcb_generic_event_t") {
37 xcb_generic_event_t* e =
static_cast<xcb_generic_event_t *
>(message);
38 switch (e->response_type & ~0x80) {
40 xcb_key_press_event_t *ev = (xcb_key_press_event_t *)e;
41 print_modifiers(ev->state);
43 qDebug(
"Key [%ld] pressed in window %ld\n",
48 case XCB_KEY_RELEASE: {
49 xcb_key_release_event_t *ev = (xcb_key_release_event_t *)e;
50 print_modifiers(ev->state);
52 qDebug (
"Key released in window %ld\n",