Index: kaccess/kaccess.cpp =================================================================== --- kaccess/kaccess.cpp +++ kaccess/kaccess.cpp @@ -20,6 +20,7 @@ */ #include +#include #include "kaccess.h" @@ -437,7 +438,14 @@ xcb_generic_event_t* event = static_cast(message); if ((event->response_type & ~0x80) == XkbEventCode + xkb_opcode) { xkb_any_ *ev = reinterpret_cast(event); - switch (ev->xkbType) { + // Workaround for an XCB bug. xkbType comes from an EventType that is defined with bits, like + // 8 + // while the generated XCB event type enum is defined as a bitmask, like + // XCB_XKB_EVENT_TYPE_BELL_NOTIFY = 256 + // This means if xbkType is 8, we need to set the 8th bit to 1, thus raising 2 to power of 8. + // See also https://bugs.freedesktop.org/show_bug.cgi?id=51295 + const int eventType = pow(2, ev->xkbType); + switch (eventType) { case XCB_XKB_EVENT_TYPE_STATE_NOTIFY: xkbStateNotify(); break;