27 :
X11EventFilter(QList<int>{XCB_KEY_PRESS, XCB_KEY_RELEASE, XCB_MOTION_NOTIFY, XCB_BUTTON_PRESS, XCB_BUTTON_RELEASE})
34 if (!tab->isGrabbed()) {
37 const uint8_t eventType =
event->response_type & ~0x80;
39 case XCB_BUTTON_PRESS:
40 case XCB_BUTTON_RELEASE: {
41 auto e =
reinterpret_cast<xcb_button_press_event_t *
>(
event);
42 xcb_allow_events(
connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
43 if (!tab->isShown() && tab->isDisplayed()) {
49 if (eventType == XCB_BUTTON_PRESS) {
50 return buttonPress(e);
54 case XCB_MOTION_NOTIFY: {
68bool X11Filter::buttonPress(xcb_button_press_event_t *event)
73 if ((!tab->isShown() && tab->isDisplayed())
78 if (
event->detail == XCB_BUTTON_INDEX_5 ||
event->detail == XCB_BUTTON_INDEX_4) {
81 if (index.isValid()) {
82 tab->setCurrentIndex(index);
89void X11Filter::motion(xcb_generic_event_t *event)
91 auto *mouseEvent =
reinterpret_cast<xcb_motion_notify_event_t *
>(
event);
92 const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y);
95 xcb_allow_events(
connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME);
98void X11Filter::keyPress(xcb_generic_event_t *event)
101 xcb_key_press_event_t *keyEvent =
reinterpret_cast<xcb_key_press_event_t *
>(
event);
102 KKeyServer::xcbKeyPressEventToQt(keyEvent, &keyQt);
106void X11Filter::keyRelease(xcb_generic_event_t *event)
108 const auto ev =
reinterpret_cast<xcb_key_release_event_t *
>(
event);
109 unsigned int mk = ev->state & (KKeyServer::modXShift() | KKeyServer::modXCtrl() | KKeyServer::modXAlt() | KKeyServer::modXMeta());
115 for (
int i = XCB_MAP_INDEX_SHIFT;
116 i <= XCB_MAP_INDEX_5;
118 if ((mk & (1 << i)) != 0) {
119 if (mod_index >= 0) {
125 bool release =
false;
126 if (mod_index == -1) {
129 Xcb::ModifierMapping xmk;
131 xcb_keycode_t *keycodes = xmk.keycodes();
132 const int maxIndex = xmk.size();
133 for (
int i = 0; i < xmk->keycodes_per_modifier; ++i) {
134 const int index = xmk->keycodes_per_modifier * mod_index + i;
135 if (index >= maxIndex) {
138 if (keycodes[index] == ev->detail) {
145 workspace()->tabbox()->modifiersReleased();
bool isMouseInterception() const
void check(const QPoint &pos, const QDateTime &now, bool forceNoPushBack=false)
bool containsPos(const QPoint &pos) const
QModelIndex nextPrev(bool forward) const
bool event(xcb_generic_event_t *event) override
ScreenEdges * screenEdges() const
KWIN_EXPORT xcb_timestamp_t xTime()
KWIN_EXPORT xcb_connection_t * connection()