From a68e77a7113150814b126ded38133e1917f3482c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martina=20Fl=C3=B6ser?= Date: Fri, 30 Dec 2016 19:07:45 +0100 Subject: [PATCH] Add native button to MouseEvent Summary: This adds the nativeButton to the MouseEvent allowing the InputEventSpy to use this information. Also the InputEventFilter can be adjusted to make use of it. Reviewers: #kwin Subscribers: graesslin, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3875 --- input_event.h | 9 +++++++++ pointer_input.cpp | 1 + 2 files changed, 10 insertions(+) diff --git a/input_event.h b/input_event.h index f7a8e52531..548fcfd7f2 100644 --- a/input_event.h +++ b/input_event.h @@ -61,12 +61,21 @@ public: m_modifiersRelevantForShortcuts = mods; } + quint32 nativeButton() const { + return m_nativeButton; + } + + void setNativeButton(quint32 button) { + m_nativeButton = button; + } + private: QSizeF m_delta; QSizeF m_deltaUnccelerated; quint64 m_timestampMicroseconds; LibInput::Device *m_device; Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); + quint32 m_nativeButton = 0; }; class WheelEvent : public QWheelEvent diff --git a/pointer_input.cpp b/pointer_input.cpp index 3fb0719011..66463e4ef3 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -259,6 +259,7 @@ void PointerInputRedirection::processButton(uint32_t button, InputRedirection::P MouseEvent event(type, m_pos, buttonToQtMouseButton(button), m_qtButtons, m_input->keyboardModifiers(), time, QSizeF(), QSizeF(), 0, device); event.setModifiersRelevantForGlobalShortcuts(m_input->modifiersRelevantForGlobalShortcuts()); + event.setNativeButton(button); m_input->processSpies(std::bind(&InputEventSpy::pointerEvent, std::placeholders::_1, &event)); m_input->processFilters(std::bind(&InputEventFilter::pointerEvent, std::placeholders::_1, &event, button));