Changeset View
Changeset View
Standalone View
Standalone View
src/ScrollState.cpp
Show All 19 Lines | |||||
20 | #include "ScrollState.h" | 20 | #include "ScrollState.h" | ||
21 | 21 | | |||
22 | #include <QWheelEvent> | 22 | #include <QWheelEvent> | ||
23 | 23 | | |||
24 | using namespace Konsole; | 24 | using namespace Konsole; | ||
25 | 25 | | |||
26 | void ScrollState::addWheelEvent(const QWheelEvent *wheel) | 26 | void ScrollState::addWheelEvent(const QWheelEvent *wheel) | ||
27 | { | 27 | { | ||
28 | // If the Libinput X server input driver is used we get a value for | ||||
29 | // pixelDelta for a physical mouse wheel scroll, so we check that | ||||
30 | // the source of the wheel event is actually a mouse, this has been | ||||
31 | // fixed upstream in Qt 5.9.5: https://bugreports.qt.io/browse/QTBUG-59261 | ||||
32 | // Fixes Konsole BUG: https://bugs.kde.org/show_bug.cgi?id=386762 | ||||
33 | #if (QT_VERSION < QT_VERSION_CHECK(5, 9, 5)) | ||||
34 | if (wheel->source() != Qt::MouseEventNotSynthesized) { | ||||
35 | #else | ||||
36 | if (true) { | ||||
37 | #endif | ||||
28 | if ((wheel->angleDelta().y() != 0) && (wheel->pixelDelta().y() == 0)) { | 38 | if ((wheel->angleDelta().y() != 0) && (wheel->pixelDelta().y() == 0)) { | ||
29 | _remainingScrollPixel = 0; | 39 | _remainingScrollPixel = 0; | ||
30 | } else { | 40 | } else { | ||
31 | _remainingScrollPixel += wheel->pixelDelta().y(); | 41 | _remainingScrollPixel += wheel->pixelDelta().y(); | ||
32 | } | 42 | } | ||
43 | } | ||||
33 | _remainingScrollAngle += wheel->angleDelta().y(); | 44 | _remainingScrollAngle += wheel->angleDelta().y(); | ||
34 | } | 45 | } | ||
35 | 46 | | |||
36 | void ScrollState::clearAll() | 47 | void ScrollState::clearAll() | ||
37 | { | 48 | { | ||
38 | _remainingScrollPixel = 0; | 49 | _remainingScrollPixel = 0; | ||
39 | _remainingScrollAngle = 0; | 50 | _remainingScrollAngle = 0; | ||
40 | } | 51 | } | ||
Show All 27 Lines |