diff options
author | David Edmundson <davidedmundson@kde.org> | 2023-01-18 13:44:46 +0000 |
---|---|---|
committer | David Edmundson <davidedmundson@kde.org> | 2023-09-29 11:39:19 +0100 |
commit | 6b8a99afa3c6dff60bd4096c2273f8db0e4d1247 (patch) | |
tree | f2aa6704f7889921977f91d7cdd28ea5c31e47da /src/client/qwaylandinputdevice_p.h | |
parent | 27026f5e992255165e208dbd1b49c91f904836ad (diff) |
client: Implement QWheelEvent::inverted
"Natural scrolling" is a setting that makes trackpads act in the
inverse; moving up moves content down to mimic behavior of
touchscreens.
However not all scroll events are used for scrolling, so it can be
useful to know the real direction. This was exposed in QWheelEvent it
just needs plumbing.
Change-Id: I050b8b3e55796beff33badb7c073c0b93589294e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
Diffstat (limited to 'src/client/qwaylandinputdevice_p.h')
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 31ce50f68..ddd23ad98 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -309,6 +309,7 @@ protected: 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; + void pointer_axis_relative_direction(uint32_t axis, uint32_t direction) override; private slots: void handleFocusDestroyed() { invalidateFocus(); } @@ -343,6 +344,8 @@ public: QPointF delta; QPoint delta120; axis_source axisSource = axis_source_wheel; + bool verticalAxisInverted = false; + bool horizontalAxisInverted = false; void resetScrollData(); bool hasPixelDelta() const; @@ -416,7 +419,7 @@ public: ulong timestamp, const QPointF &local, const QPointF &global, const QPoint &pixelDelta, const QPoint &angleDelta, Qt::MouseEventSource source, - Qt::KeyboardModifiers modifiers) + Qt::KeyboardModifiers modifiers, bool inverted) : type(type) , phase(phase) , timestamp(timestamp) @@ -427,6 +430,7 @@ public: , angleDelta(angleDelta) , source(source) , surface(surface) + , inverted(inverted) {} QEvent::Type type = QEvent::None; @@ -441,6 +445,7 @@ public: QPoint angleDelta; Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; QPointer<QWaylandWindow> surface; + bool inverted = false; }; #ifndef QT_NO_GESTURES |