diff options
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 37 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 3 |
2 files changed, 32 insertions, 8 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 56c89688..4b4e54bd 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -375,7 +375,7 @@ QWaylandInputDevice::Touch::~Touch() } QWaylandInputDevice::QWaylandInputDevice(QWaylandDisplay *display, int version, uint32_t id) - : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 7)) + : QtWayland::wl_seat(display->wl_registry(), id, qMin(version, 8)) , mQDisplay(display) , mDisplay(display->wl_display()) { @@ -982,14 +982,16 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t if (!focusWindow()) return; + const int32_t delta120 = value * 15 * 8; + switch (axis) { case axis_vertical_scroll: qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete vertical:" << value; - mFrameData.discreteDelta.ry() += value; + mFrameData.delta120.ry() += delta120; break; case axis_horizontal_scroll: qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_discrete horizontal:" << value; - mFrameData.discreteDelta.rx() += value; + mFrameData.delta120.rx() += delta120; break; default: //TODO: is this really needed? @@ -998,6 +1000,26 @@ void QWaylandInputDevice::Pointer::pointer_axis_discrete(uint32_t axis, int32_t } } +void QWaylandInputDevice::Pointer::pointer_axis_value120(uint32_t axis, int32_t value) +{ + if (!focusWindow()) + return; + + switch (axis) { + case axis_vertical_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 vertical:" << value; + mFrameData.delta120.ry() += value; + break; + case axis_horizontal_scroll: + qCDebug(lcQpaWaylandInput) << "wl_pointer.axis_value120 horizontal:" << value; + mFrameData.delta120.rx() += value; + break; + default: + qCWarning(lcQpaWaylandInput) << "wl_pointer.axis_value120: Unknown axis:" << axis; + return; + } +} + void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) { qCDebug(lcQpaWaylandInput) << "Setting frame event " << event->type; @@ -1016,7 +1038,7 @@ void QWaylandInputDevice::Pointer::setFrameEvent(QWaylandPointerEvent *event) void QWaylandInputDevice::Pointer::FrameData::resetScrollData() { - discreteDelta = QPoint(); + delta120 = QPoint(); delta = QPointF(); axisSource = axis_source_wheel; } @@ -1060,15 +1082,16 @@ QPoint QWaylandInputDevice::Pointer::FrameData::pixelDeltaAndError(QPointF *accu QPoint QWaylandInputDevice::Pointer::FrameData::angleDelta() const { - if (discreteDelta.isNull()) { + if (delta120.isNull()) { // If we didn't get any discrete events, then we need to fall back to // the continuous information. return (delta * -12).toPoint(); //TODO: why multiply by 12? } // The angle delta is in eights of degrees, and our docs says most mice have - // 1 click = 15 degrees. It's also in the opposite direction of surface space. - return -discreteDelta * 15 * 8; + // 1 click = 15 degrees, i.e. 120 is one click. It's also in the opposite + // direction of surface space. + return -delta120; } Qt::MouseEventSource QWaylandInputDevice::Pointer::FrameData::wheelEventSource() const diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index b9c69ee1..fbc26008 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -308,6 +308,7 @@ protected: void pointer_axis_stop(uint32_t time, uint32_t axis) override; void pointer_axis_discrete(uint32_t axis, int32_t value) override; void pointer_frame() override; + void pointer_axis_value120(uint32_t axis, int32_t value120) override; private slots: void handleFocusDestroyed() { invalidateFocus(); } @@ -343,7 +344,7 @@ public: QWaylandPointerEvent *event = nullptr; QPointF delta; - QPoint discreteDelta; + QPoint delta120; axis_source axisSource = axis_source_wheel; void resetScrollData(); |