diff --git a/effects.h b/effects.h --- a/effects.h +++ b/effects.h @@ -165,8 +165,6 @@ WindowQuadType newWindowQuadType() override; void defineCursor(Qt::CursorShape shape) override; - bool checkInputWindowEvent(xcb_button_press_event_t *e); - bool checkInputWindowEvent(xcb_motion_notify_event_t *e); bool checkInputWindowEvent(QMouseEvent *e); bool checkInputWindowEvent(QWheelEvent *e); void checkInputWindowStacking(); diff --git a/effects.cpp b/effects.cpp --- a/effects.cpp +++ b/effects.cpp @@ -1230,41 +1230,6 @@ } } -bool EffectsHandlerImpl::checkInputWindowEvent(xcb_button_press_event_t *e) -{ - if (m_grabbedMouseEffects.isEmpty() || m_mouseInterceptionWindow != e->event) { - return false; - } - for (Effect *effect : m_grabbedMouseEffects) { - Qt::MouseButton button = x11ToQtMouseButton(e->detail); - Qt::MouseButtons buttons = x11ToQtMouseButtons(e->state); - const QEvent::Type type = ((e->response_type & ~0x80) == XCB_BUTTON_PRESS) ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease; - if (type == QEvent::MouseButtonPress) { - buttons |= button; - } else { - buttons &= ~button; - } - QMouseEvent ev(type, - QPoint(e->event_x, e->event_y), QPoint(e->root_x, e->root_y), - button, buttons, x11ToQtKeyboardModifiers(e->state)); - effect->windowInputMouseEvent(&ev); - } - return true; // eat event -} - -bool EffectsHandlerImpl::checkInputWindowEvent(xcb_motion_notify_event_t *e) -{ - if (m_grabbedMouseEffects.isEmpty() || m_mouseInterceptionWindow != e->event) { - return false; - } - for (Effect *effect : m_grabbedMouseEffects) { - QMouseEvent ev(QEvent::MouseMove, QPoint(e->event_x, e->event_y), QPoint(e->root_x, e->root_y), - Qt::NoButton, x11ToQtMouseButtons(e->state), x11ToQtKeyboardModifiers(e->state)); - effect->windowInputMouseEvent(&ev); - } - return true; // eat event -} - bool EffectsHandlerImpl::checkInputWindowEvent(QMouseEvent *e) { if (m_grabbedMouseEffects.isEmpty()) { diff --git a/tabbox/x11_filter.h b/tabbox/x11_filter.h --- a/tabbox/x11_filter.h +++ b/tabbox/x11_filter.h @@ -35,7 +35,7 @@ private: bool buttonPress(xcb_button_press_event_t *event); - bool motion(xcb_generic_event_t *event); + void motion(xcb_generic_event_t *event); void keyPress(xcb_generic_event_t *event); void keyRelease(xcb_generic_event_t *event); }; diff --git a/tabbox/x11_filter.cpp b/tabbox/x11_filter.cpp --- a/tabbox/x11_filter.cpp +++ b/tabbox/x11_filter.cpp @@ -37,18 +37,6 @@ { } -template -static bool passToEffects(T *e) -{ - const auto tab = TabBox::TabBox::self(); - if (!tab->isShown() && tab->isDisplayed()) { - if (effects && static_cast(effects)->checkInputWindowEvent(e)) { - return true; - } - } - return false; -} - bool X11Filter::event(xcb_generic_event_t *event) { if (!TabBox::TabBox::self()->isGrabbed()) { @@ -60,16 +48,21 @@ case XCB_BUTTON_RELEASE: { auto e = reinterpret_cast(event); xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME); - if (passToEffects(e)) { - return true; + const auto tab = TabBox::TabBox::self(); + if (!tab->isShown() && tab->isDisplayed()) { + if (effects && static_cast(effects)->isMouseInterception()) { + // pass on to effects, effects will filter out the event + return false; + } } if (eventType == XCB_BUTTON_PRESS) { return buttonPress(e); } return false; } case XCB_MOTION_NOTIFY: { - return motion(event); + motion(event); + break; } case XCB_KEY_PRESS: { keyPress(event); @@ -103,17 +96,13 @@ return false; } -bool X11Filter::motion(xcb_generic_event_t *event) +void X11Filter::motion(xcb_generic_event_t *event) { auto *mouseEvent = reinterpret_cast(event); const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y); // TODO: this should be in ScreenEdges directly ScreenEdges::self()->check(rootPos, QDateTime::fromMSecsSinceEpoch(xTime()), true); xcb_allow_events(connection(), XCB_ALLOW_ASYNC_POINTER, XCB_CURRENT_TIME); - if (passToEffects(mouseEvent)) { - return true; - } - return false; } void X11Filter::keyPress(xcb_generic_event_t *event)