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
icc-effect-5.14.5
Martina Flöser 2016-12-30 19:07:45 +01:00 committed by Martin Gräßlin
parent 84e3308149
commit a68e77a711
2 changed files with 10 additions and 0 deletions

View File

@ -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

View File

@ -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));