Commit d25e5ac7 authored by Kurt Hindenburg's avatar Kurt Hindenburg

Fix mouse wheel scrolling with libinput

If the Libinput X server input driver is used we get a value for
pixelDelta for a physical mouse wheel scroll, so we check that the
source of the wheel event is actually a mouse, this was fixed in
Qt 5.9.5
https://bugreports.qt.io/browse/QTBUG-59261

Patch by ahmadsamir

BUG: 386762
Differential Revision: https://phabricator.kde.org/D9008
parent 9666799e
......@@ -25,10 +25,21 @@ using namespace Konsole;
void ScrollState::addWheelEvent(const QWheelEvent *wheel)
{
if ((wheel->angleDelta().y() != 0) && (wheel->pixelDelta().y() == 0)) {
_remainingScrollPixel = 0;
} else {
_remainingScrollPixel += wheel->pixelDelta().y();
// If the Libinput X server input driver is used we get a value for
// pixelDelta for a physical mouse wheel scroll, so we check that
// the source of the wheel event is actually a mouse, this has been
// fixed upstream in Qt 5.9.5: https://bugreports.qt.io/browse/QTBUG-59261
// Fixes Konsole BUG: https://bugs.kde.org/show_bug.cgi?id=386762
#if (QT_VERSION < QT_VERSION_CHECK(5, 9, 5))
if (wheel->source() != Qt::MouseEventNotSynthesized) {
#else
if (true) {
#endif
if ((wheel->angleDelta().y() != 0) && (wheel->pixelDelta().y() == 0)) {
_remainingScrollPixel = 0;
} else {
_remainingScrollPixel += wheel->pixelDelta().y();
}
}
_remainingScrollAngle += wheel->angleDelta().y();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment