diff --git a/autotests/test_xrandr_screens.cpp b/autotests/test_xrandr_screens.cpp index 9d8630ea02..9ee401e0ed 100644 --- a/autotests/test_xrandr_screens.cpp +++ b/autotests/test_xrandr_screens.cpp @@ -138,7 +138,7 @@ void TestXRandRScreens::testStartup() QVERIFY(screens->eventType() != 0); QCOMPARE(screens->eventType(), Xcb::Extensions::self()->randrNotifyEvent()); QCOMPARE(screens->extension(), 0); - QCOMPARE(screens->genericEventType(), 0); + QCOMPARE(screens->genericEventTypes(), QVector{0}); screens->init(); QRect xephyrDefault = QRect(0, 0, 640, 480); QCOMPARE(screens->count(), 1); diff --git a/cursor.cpp b/cursor.cpp index bb97760f47..bdc0b480b0 100644 --- a/cursor.cpp +++ b/cursor.cpp @@ -263,7 +263,7 @@ class XInputEventFilter : public X11EventFilter { public: XInputEventFilter(X11Cursor *parent, int xi_opcode) - : X11EventFilter(XCB_GE_GENERIC, xi_opcode, XI_RawMotion) + : X11EventFilter(XCB_GE_GENERIC, xi_opcode, QVector{XI_RawMotion, XI_RawButtonPress, XI_RawButtonRelease}) , m_x11Cursor(parent) {} virtual ~XInputEventFilter() = default; @@ -389,6 +389,8 @@ void X11Cursor::doStartMousePolling() memset(mask1, 0, sizeof(mask1)); XISetMask(mask1, XI_RawMotion); + XISetMask(mask1, XI_RawButtonPress); + XISetMask(mask1, XI_RawButtonRelease); evmasks[0].deviceid = XIAllMasterDevices; evmasks[0].mask_len = sizeof(mask1); diff --git a/events.cpp b/events.cpp index 4d3fe80831..ae48a93ccc 100644 --- a/events.cpp +++ b/events.cpp @@ -237,7 +237,7 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e) xcb_ge_generic_event_t *ge = reinterpret_cast(e); foreach (X11EventFilter *filter, m_genericEventFilters) { - if (filter->extension() == ge->extension && filter->genericEventType() == ge->event_type && filter->event(e)) { + if (filter->extension() == ge->extension && filter->genericEventTypes().contains(ge->event_type) && filter->event(e)) { return true; } } diff --git a/x11eventfilter.cpp b/x11eventfilter.cpp index f88711fbd9..643ca0ee10 100644 --- a/x11eventfilter.cpp +++ b/x11eventfilter.cpp @@ -25,7 +25,12 @@ namespace KWin { X11EventFilter::X11EventFilter(int eventType, int opcode, int genericEventType) - : m_eventType(eventType), m_extension(opcode), m_genericEventType(genericEventType) + : X11EventFilter(eventType, opcode, QVector{genericEventType}) +{ +} + +X11EventFilter::X11EventFilter(int eventType, int opcode, const QVector< int > &genericEventTypes) + : m_eventType(eventType), m_extension(opcode), m_genericEventTypes(genericEventTypes) { Workspace::self()->registerEventFilter(this); } diff --git a/x11eventfilter.h b/x11eventfilter.h index 0a25ec896d..f352fdc307 100644 --- a/x11eventfilter.h +++ b/x11eventfilter.h @@ -23,6 +23,8 @@ along with this program. If not, see . #include +#include + #include namespace KWin @@ -35,6 +37,7 @@ public: * Creates an event filter for the given event type. */ X11EventFilter(int eventType, int opcode = 0, int genericEventType = 0); + X11EventFilter(int eventType, int opcode, const QVector &genericEventTypes); /** * Destroys the event filter. @@ -54,11 +57,11 @@ public: int extension() const { return m_extension; } /** - * Returns the type of generic events to filter. + * Returns the types of generic events to filter. * * Only used when the event type is XCB_GE_GENERIC. */ - int genericEventType() const { return m_genericEventType; } + QVector genericEventTypes() const { return m_genericEventTypes; } /** * This method is called for every event of the filtered type. @@ -70,7 +73,7 @@ public: private: int m_eventType; int m_extension; - int m_genericEventType; + QVector m_genericEventTypes; }; } // namespace KWin