diff --git a/autotests/libinput/input_event_test.cpp b/autotests/libinput/input_event_test.cpp --- a/autotests/libinput/input_event_test.cpp +++ b/autotests/libinput/input_event_test.cpp @@ -121,10 +121,11 @@ { QTest::addColumn("orientation"); QTest::addColumn("delta"); + QTest::addColumn("discreteDelta"); QTest::addColumn("expectedAngleDelta"); - QTest::newRow("horiz") << Qt::Horizontal << 3.0 << QPoint(3, 0); - QTest::newRow("vert") << Qt::Vertical << 2.0 << QPoint(0, 2); + QTest::newRow("horiz") << Qt::Horizontal << 3.3 << 1 << QPoint(3, 0); + QTest::newRow("vert") << Qt::Vertical << 2.4 << 2 << QPoint(0, 2); } void InputEventsTest::testInitWheelEvent() @@ -138,16 +139,21 @@ // setup event QFETCH(Qt::Orientation, orientation); QFETCH(qreal, delta); - WheelEvent event(QPointF(100, 200), delta, orientation, Qt::LeftButton | Qt::RightButton, - Qt::ShiftModifier | Qt::ControlModifier, 300, &d); + QFETCH(qint32, discreteDelta); + WheelEvent event(QPointF(100, 200), delta, discreteDelta, orientation, Qt::LeftButton | Qt::RightButton, + Qt::ShiftModifier | Qt::ControlModifier, PointerAxisSource::Wheel, 300, &d); // compare QWheelEvent contract QCOMPARE(event.type(), QEvent::Wheel); QCOMPARE(event.posF(), QPointF(100, 200)); QCOMPARE(event.globalPosF(), QPointF(100, 200)); QCOMPARE(event.buttons(), Qt::LeftButton | Qt::RightButton); QCOMPARE(event.modifiers(), Qt::ShiftModifier | Qt::ControlModifier); QCOMPARE(event.timestamp(), 300ul); QTEST(event.angleDelta(), "expectedAngleDelta"); + QTEST(event.orientation(), "orientation"); + QTEST(event.delta(), "delta"); + QTEST(event.discreteDelta(), "discreteDelta"); + QCOMPARE(event.axisSource(), PointerAxisSource::Wheel); // and our custom argument QCOMPARE(event.device(), &d); diff --git a/autotests/libinput/mock_libinput.h b/autotests/libinput/mock_libinput.h --- a/autotests/libinput/mock_libinput.h +++ b/autotests/libinput/mock_libinput.h @@ -128,6 +128,9 @@ bool horizontalAxis = false; qreal horizontalAxisValue = 0.0; qreal verticalAxisValue = 0.0; + qreal horizontalDiscreteAxisValue = 0.0; + qreal verticalDiscreteAxisValue = 0.0; + libinput_pointer_axis_source axisSource = {}; QSizeF delta; QPointF absolutePos; }; diff --git a/autotests/libinput/mock_libinput.cpp b/autotests/libinput/mock_libinput.cpp --- a/autotests/libinput/mock_libinput.cpp +++ b/autotests/libinput/mock_libinput.cpp @@ -602,6 +602,20 @@ } } +double libinput_event_pointer_get_axis_value_discrete(struct libinput_event_pointer *event, enum libinput_pointer_axis axis) +{ + if (axis == LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL) { + return event->verticalDiscreteAxisValue; + } else { + return event->horizontalDiscreteAxisValue; + } +} + +enum libinput_pointer_axis_source libinput_event_pointer_get_axis_source(struct libinput_event_pointer *event) +{ + return event->axisSource; +} + uint32_t libinput_event_touch_get_time(struct libinput_event_touch *event) { return event->time; diff --git a/autotests/libinput/pointer_event_test.cpp b/autotests/libinput/pointer_event_test.cpp --- a/autotests/libinput/pointer_event_test.cpp +++ b/autotests/libinput/pointer_event_test.cpp @@ -27,6 +27,9 @@ Q_DECLARE_METATYPE(libinput_event_type) Q_DECLARE_METATYPE(libinput_button_state) +Q_DECLARE_METATYPE(libinput_pointer_axis_source) + +Q_DECLARE_METATYPE(KWin::PointerAxisSource) using namespace KWin::LibInput; @@ -136,11 +139,25 @@ QTest::addColumn("horizontal"); QTest::addColumn("vertical"); QTest::addColumn("value"); + QTest::addColumn("discreteValue"); + QTest::addColumn("axisSource"); + QTest::addColumn("expectedAxisSource"); QTest::addColumn("time"); - QTest::newRow("horizontal") << true << false << QPointF(3.0, 0.0) << 100u; - QTest::newRow("vertical") << false << true << QPointF(0.0, 2.5) << 200u; - QTest::newRow("both") << true << true << QPointF(1.1, 4.2) << 300u; + QTest::newRow("wheel/horizontal") << true << false << QPointF(3.0, 0.0) << QPoint(1, 0) << LIBINPUT_POINTER_AXIS_SOURCE_WHEEL << KWin::PointerAxisSource::Wheel << 100u; + QTest::newRow("wheel/vertical") << false << true << QPointF(0.0, 2.5) << QPoint(0, 1) << LIBINPUT_POINTER_AXIS_SOURCE_WHEEL << KWin::PointerAxisSource::Wheel << 200u; + QTest::newRow("wheel/both") << true << true << QPointF(1.1, 4.2) << QPoint(1, 1) << LIBINPUT_POINTER_AXIS_SOURCE_WHEEL << KWin::PointerAxisSource::Wheel << 300u; + + QTest::newRow("finger/horizontal") << true << false << QPointF(3.0, 0.0) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 400u; + QTest::newRow("stop finger/horizontal") << true << false << QPointF(0.0, 0.0) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 500u; + QTest::newRow("finger/vertical") << false << true << QPointF(0.0, 2.5) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 600u; + QTest::newRow("stop finger/vertical") << false << true << QPointF(0.0, 0.0) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 700u; + QTest::newRow("finger/both") << true << true << QPointF(1.1, 4.2) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 800u; + QTest::newRow("stop finger/both") << true << true << QPointF(0.0, 0.0) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_FINGER << KWin::PointerAxisSource::Finger << 900u; + + QTest::newRow("continuous/horizontal") << true << false << QPointF(3.0, 0.0) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS << KWin::PointerAxisSource::Continuous << 1000u; + QTest::newRow("continuous/vertical") << false << true << QPointF(0.0, 2.5) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS << KWin::PointerAxisSource::Continuous << 1100u; + QTest::newRow("continuous/both") << true << true << QPointF(1.1, 4.2) << QPoint(0, 0) << LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS << KWin::PointerAxisSource::Continuous << 1200u; } void TestLibinputPointerEvent::testAxis() @@ -152,11 +169,16 @@ QFETCH(bool, horizontal); QFETCH(bool, vertical); QFETCH(QPointF, value); + QFETCH(QPoint, discreteValue); + QFETCH(libinput_pointer_axis_source, axisSource); QFETCH(quint32, time); pointerEvent->horizontalAxis = horizontal; pointerEvent->verticalAxis = vertical; pointerEvent->horizontalAxisValue = value.x(); pointerEvent->verticalAxisValue = value.y(); + pointerEvent->horizontalDiscreteAxisValue = discreteValue.x(); + pointerEvent->verticalDiscreteAxisValue = discreteValue.y(); + pointerEvent->axisSource = axisSource; pointerEvent->time = time; QScopedPointer event(Event::create(pointerEvent)); @@ -167,6 +189,9 @@ QCOMPARE(pe->axis().contains(KWin::InputRedirection::PointerAxisVertical), vertical); QCOMPARE(pe->axisValue(KWin::InputRedirection::PointerAxisHorizontal), value.x()); QCOMPARE(pe->axisValue(KWin::InputRedirection::PointerAxisVertical), value.y()); + QCOMPARE(pe->discreteAxisValue(KWin::InputRedirection::PointerAxisHorizontal), discreteValue.x()); + QCOMPARE(pe->discreteAxisValue(KWin::InputRedirection::PointerAxisVertical), discreteValue.y()); + QTEST(pe->axisSource(), "expectedAxisSource"); QCOMPARE(pe->time(), time); } diff --git a/input.h b/input.h --- a/input.h +++ b/input.h @@ -49,6 +49,8 @@ class WindowSelectorFilter; class SwitchEvent; +enum class PointerAxisSource; + namespace Decoration { class DecoratedClientImpl; @@ -122,7 +124,7 @@ /** * @internal **/ - void processPointerAxis(PointerAxis axis, qreal delta, uint32_t time); + void processPointerAxis(PointerAxis axis, qreal delta, qint32 discreteDelta, PointerAxisSource source, uint32_t time); /** * @internal **/ diff --git a/input.cpp b/input.cpp --- a/input.cpp +++ b/input.cpp @@ -22,6 +22,7 @@ #include "input_event.h" #include "input_event_spy.h" #include "keyboard_input.h" +#include "kwinnamespace.h" #include "pointer_input.h" #include "touch_input.h" #include "touch_hide_cursor_spy.h" @@ -1330,8 +1331,27 @@ bool wheelEvent(QWheelEvent *event) override { auto seat = waylandServer()->seat(); seat->setTimestamp(event->timestamp()); - const Qt::Orientation orientation = event->angleDelta().x() == 0 ? Qt::Vertical : Qt::Horizontal; - seat->pointerAxis(orientation, orientation == Qt::Horizontal ? event->angleDelta().x() : event->angleDelta().y()); + auto event_ = static_cast(event); + KWayland::Server::PointerAxisSource source; + switch (event_->axisSource()) { + case KWin::PointerAxisSource::Wheel: + source = KWayland::Server::PointerAxisSource::Wheel; + break; + case KWin::PointerAxisSource::Finger: + source = KWayland::Server::PointerAxisSource::Finger; + break; + case KWin::PointerAxisSource::Continuous: + source = KWayland::Server::PointerAxisSource::Continuous; + break; + case KWin::PointerAxisSource::WheelTilt: + source = KWayland::Server::PointerAxisSource::WheelTilt; + break; + case KWin::PointerAxisSource::Unknown: + default: + source = KWayland::Server::PointerAxisSource::Unknown; + break; + } + seat->pointerAxisV5(event_->orientation(), event_->delta(), event_->discreteDelta(), source); return true; } bool keyEvent(QKeyEvent *event) override { @@ -1703,7 +1723,7 @@ break; } // TODO: Fix time - m_pointer->processAxis(axis, delta, 0); + m_pointer->processAxis(axis, delta, 0, PointerAxisSource::Unknown, 0); waylandServer()->simulateUserActivity(); } ); @@ -1997,9 +2017,9 @@ m_pointer->processButton(button, state, time); } -void InputRedirection::processPointerAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time) +void InputRedirection::processPointerAxis(InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta, PointerAxisSource source, uint32_t time) { - m_pointer->processAxis(axis, delta, time); + m_pointer->processAxis(axis, delta, discreteDelta, source, time); } void InputRedirection::processKeyboardKey(uint32_t key, InputRedirection::KeyboardKeyState state, uint32_t time) diff --git a/input_event.h b/input_event.h --- a/input_event.h +++ b/input_event.h @@ -19,6 +19,9 @@ *********************************************************************/ #ifndef KWIN_INPUT_EVENT_H #define KWIN_INPUT_EVENT_H + +#include "kwinnamespace.h" + #include namespace KWin @@ -78,11 +81,29 @@ quint32 m_nativeButton = 0; }; +// TODO: Don't derive from QWheelEvent, this event is quite domain specific. class WheelEvent : public QWheelEvent { public: - explicit WheelEvent(const QPointF &pos, qreal delta, Qt::Orientation orientation, Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device); + explicit WheelEvent(const QPointF &pos, qreal delta, qint32 discreteDelta, Qt::Orientation orientation, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, PointerAxisSource source, + quint32 timestamp, LibInput::Device *device); + + Qt::Orientation orientation() const { + return m_orientation; + } + + qreal delta() const { + return m_delta; + } + + qint32 discreteDelta() const { + return m_discreteDelta; + } + + PointerAxisSource axisSource() const { + return m_source; + } LibInput::Device *device() const { return m_device; @@ -98,6 +119,10 @@ private: LibInput::Device *m_device; + Qt::Orientation m_orientation; + qreal m_delta; + qint32 m_discreteDelta; + PointerAxisSource m_source; Qt::KeyboardModifiers m_modifiersRelevantForShortcuts = Qt::KeyboardModifiers(); }; diff --git a/input_event.cpp b/input_event.cpp --- a/input_event.cpp +++ b/input_event.cpp @@ -35,10 +35,15 @@ setTimestamp(timestamp); } -WheelEvent::WheelEvent(const QPointF &pos, qreal delta, Qt::Orientation orientation, Qt::MouseButtons buttons, - Qt::KeyboardModifiers modifiers, quint32 timestamp, LibInput::Device *device) +WheelEvent::WheelEvent(const QPointF &pos, qreal delta, qint32 discreteDelta, Qt::Orientation orientation, + Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, PointerAxisSource source, + quint32 timestamp, LibInput::Device *device) : QWheelEvent(pos, pos, QPoint(), (orientation == Qt::Horizontal) ? QPoint(delta, 0) : QPoint(0, delta), delta, orientation, buttons, modifiers) , m_device(device) + , m_orientation(orientation) + , m_delta(delta) + , m_discreteDelta(discreteDelta) + , m_source(source) { setTimestamp(timestamp); } diff --git a/kwinnamespace.h b/kwinnamespace.h new file mode 100644 --- /dev/null +++ b/kwinnamespace.h @@ -0,0 +1,40 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + +Copyright (C) 2019 Vlad Zagorodniy + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ + +#ifndef KWINNAMESPACE_H +#define KWINNAMESPACE_H + +namespace KWin +{ + +/** + * This enum type is used to specify how an axis event was generated. + **/ +enum class PointerAxisSource { + Unknown, + Wheel, + Finger, + Continuous, + WheelTilt +}; + +} // namespace KWin + +#endif // KWINNAMESPACE_H diff --git a/libinput/connection.h b/libinput/connection.h --- a/libinput/connection.h +++ b/libinput/connection.h @@ -104,7 +104,7 @@ void pointerButtonChanged(quint32 button, KWin::InputRedirection::PointerButtonState state, quint32 time, KWin::LibInput::Device *device); void pointerMotionAbsolute(QPointF orig, QPointF screen, quint32 time, KWin::LibInput::Device *device); void pointerMotion(const QSizeF &delta, const QSizeF &deltaNonAccelerated, quint32 time, quint64 timeMicroseconds, KWin::LibInput::Device *device); - void pointerAxisChanged(KWin::InputRedirection::PointerAxis axis, qreal delta, quint32 time, KWin::LibInput::Device *device); + void pointerAxisChanged(KWin::InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta, PointerAxisSource source, quint32 time, KWin::LibInput::Device *device); void touchFrame(KWin::LibInput::Device *device); void touchCanceled(KWin::LibInput::Device *device); void touchDown(qint32 id, const QPointF &absolutePos, quint32 time, KWin::LibInput::Device *device); diff --git a/libinput/connection.cpp b/libinput/connection.cpp --- a/libinput/connection.cpp +++ b/libinput/connection.cpp @@ -343,31 +343,10 @@ } case LIBINPUT_EVENT_POINTER_AXIS: { PointerEvent *pe = static_cast(event.data()); - struct Axis { - qreal delta = 0.0; - quint32 time = 0; - }; - QMap deltas; - auto update = [&deltas] (PointerEvent *pe) { - const auto axis = pe->axis(); - for (auto it = axis.begin(); it != axis.end(); ++it) { - deltas[*it].delta += pe->axisValue(*it); - deltas[*it].time = pe->time(); - } - }; - update(pe); - auto it = m_eventQueue.begin(); - while (it != m_eventQueue.end()) { - if ((*it)->type() == LIBINPUT_EVENT_POINTER_AXIS) { - QScopedPointer p(static_cast(*it)); - update(p.data()); - it = m_eventQueue.erase(it); - } else { - break; - } - } - for (auto it = deltas.constBegin(); it != deltas.constEnd(); ++it) { - emit pointerAxisChanged(it.key(), it.value().delta, it.value().time, pe->device()); + const auto axes = pe->axis(); + for (const InputRedirection::PointerAxis &axis : axes) { + emit pointerAxisChanged(axis, pe->axisValue(axis), pe->discreteAxisValue(axis), + pe->axisSource(), pe->time(), pe->device()); } break; } diff --git a/libinput/events.h b/libinput/events.h --- a/libinput/events.h +++ b/libinput/events.h @@ -21,6 +21,7 @@ #define KWIN_LIBINPUT_EVENTS_H #include "../input.h" +#include "../kwinnamespace.h" #include @@ -95,6 +96,8 @@ quint64 timeMicroseconds() const; QVector axis() const; qreal axisValue(InputRedirection::PointerAxis a) const; + qint32 discreteAxisValue(InputRedirection::PointerAxis axis) const; + PointerAxisSource axisSource() const; operator libinput_event_pointer*() { return m_pointerEvent; diff --git a/libinput/events.cpp b/libinput/events.cpp --- a/libinput/events.cpp +++ b/libinput/events.cpp @@ -205,6 +205,32 @@ return libinput_event_pointer_get_axis_value(m_pointerEvent, a); } +qint32 PointerEvent::discreteAxisValue(InputRedirection::PointerAxis axis) const +{ + Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS); + const libinput_pointer_axis a = (axis == InputRedirection::PointerAxisHorizontal) + ? LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL + : LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL; + return libinput_event_pointer_get_axis_value_discrete(m_pointerEvent, a); +} + +PointerAxisSource PointerEvent::axisSource() const +{ + Q_ASSERT(type() == LIBINPUT_EVENT_POINTER_AXIS); + switch (libinput_event_pointer_get_axis_source(m_pointerEvent)) { + case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL: + return PointerAxisSource::Wheel; + case LIBINPUT_POINTER_AXIS_SOURCE_FINGER: + return PointerAxisSource::Finger; + case LIBINPUT_POINTER_AXIS_SOURCE_CONTINUOUS: + return PointerAxisSource::Continuous; + case LIBINPUT_POINTER_AXIS_SOURCE_WHEEL_TILT: + return PointerAxisSource::WheelTilt; + default: + return PointerAxisSource::Unknown; + } +} + TouchEvent::TouchEvent(libinput_event *event, libinput_event_type type) : Event(event, type) , m_touchEvent(libinput_event_get_touch_event(event)) diff --git a/platform.h b/platform.h --- a/platform.h +++ b/platform.h @@ -23,6 +23,7 @@ #include #include #include "fixqopengl.h" +#include "kwinnamespace.h" #include #include @@ -434,8 +435,8 @@ void pointerMotion(const QPointF &position, quint32 time); void pointerButtonPressed(quint32 button, quint32 time); void pointerButtonReleased(quint32 button, quint32 time); - void pointerAxisHorizontal(qreal delta, quint32 time); - void pointerAxisVertical(qreal delta, quint32 time); + void pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta = 0, PointerAxisSource source = PointerAxisSource::Unknown); + void pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta = 0, PointerAxisSource source = PointerAxisSource::Unknown); void keyboardKeyPressed(quint32 key, quint32 time); void keyboardKeyReleased(quint32 key, quint32 time); void keyboardModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group); diff --git a/platform.cpp b/platform.cpp --- a/platform.cpp +++ b/platform.cpp @@ -193,20 +193,20 @@ input()->processKeymapChange(fd, size); } -void Platform::pointerAxisHorizontal(qreal delta, quint32 time) +void Platform::pointerAxisHorizontal(qreal delta, quint32 time, qint32 discreteDelta, PointerAxisSource source) { if (!input()) { return; } - input()->processPointerAxis(InputRedirection::PointerAxisHorizontal, delta, time); + input()->processPointerAxis(InputRedirection::PointerAxisHorizontal, delta, discreteDelta, source, time); } -void Platform::pointerAxisVertical(qreal delta, quint32 time) +void Platform::pointerAxisVertical(qreal delta, quint32 time, qint32 discreteDelta, PointerAxisSource source) { if (!input()) { return; } - input()->processPointerAxis(InputRedirection::PointerAxisVertical, delta, time); + input()->processPointerAxis(InputRedirection::PointerAxisVertical, delta, discreteDelta, source, time); } void Platform::pointerButtonPressed(quint32 button, quint32 time) diff --git a/plugins/platforms/wayland/wayland_backend.cpp b/plugins/platforms/wayland/wayland_backend.cpp --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -151,6 +151,7 @@ } } ); + // TODO: Send discreteDelta and source as well. connect(m_pointer, &Pointer::axisChanged, this, [this](quint32 time, Pointer::Axis axis, qreal delta) { switch (axis) { diff --git a/plugins/platforms/x11/windowed/x11windowed_backend.cpp b/plugins/platforms/x11/windowed/x11windowed_backend.cpp --- a/plugins/platforms/x11/windowed/x11windowed_backend.cpp +++ b/plugins/platforms/x11/windowed/x11windowed_backend.cpp @@ -459,9 +459,9 @@ const int delta = (event->detail == XCB_BUTTON_INDEX_4 || event->detail == 6) ? -1 : 1; static const qreal s_defaultAxisStepDistance = 10.0; if (event->detail > 5) { - pointerAxisHorizontal(delta * s_defaultAxisStepDistance, event->time); + pointerAxisHorizontal(delta * s_defaultAxisStepDistance, event->time, delta); } else { - pointerAxisVertical(delta * s_defaultAxisStepDistance, event->time); + pointerAxisVertical(delta * s_defaultAxisStepDistance, event->time, delta); } return; } diff --git a/pointer_input.h b/pointer_input.h --- a/pointer_input.h +++ b/pointer_input.h @@ -110,7 +110,7 @@ /** * @internal **/ - void processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device = nullptr); + void processAxis(InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta, PointerAxisSource source, uint32_t time, LibInput::Device *device = nullptr); /** * @internal **/ diff --git a/pointer_input.cpp b/pointer_input.cpp --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -319,18 +319,15 @@ } } -void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, uint32_t time, LibInput::Device *device) +void PointerInputRedirection::processAxis(InputRedirection::PointerAxis axis, qreal delta, qint32 discreteDelta, PointerAxisSource source, uint32_t time, LibInput::Device *device) { - if (delta == 0) { - return; - } update(); emit input()->pointerAxisChanged(axis, delta); - WheelEvent wheelEvent(m_pos, delta, + WheelEvent wheelEvent(m_pos, delta, discreteDelta, (axis == InputRedirection::PointerAxisHorizontal) ? Qt::Horizontal : Qt::Vertical, - m_qtButtons, input()->keyboardModifiers(), time, device); + m_qtButtons, input()->keyboardModifiers(), source, time, device); wheelEvent.setModifiersRelevantForGlobalShortcuts(input()->modifiersRelevantForGlobalShortcuts()); input()->processSpies(std::bind(&InputEventSpy::wheelEvent, std::placeholders::_1, &wheelEvent));