From 2f783dd6714204c54ba5647a376907f4de6799ff Mon Sep 17 00:00:00 2001 From: Gabriel Vogel Date: Thu, 20 Jan 2022 22:58:22 +0100 Subject: [PATCH] Fix #324840: Ctrl+Scrollwheel zoom on Linux X11 With recent libinput versions zooming with Ctrl+Scrollwheel would zoom in huge steps. This change enforces the previous behavior for Linux X11 only. Scrolling is left unchanged for Wayland --- src/notation/view/notationviewinputcontroller.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/notation/view/notationviewinputcontroller.cpp b/src/notation/view/notationviewinputcontroller.cpp index 4518e98fb197..195b5e113ee3 100644 --- a/src/notation/view/notationviewinputcontroller.cpp +++ b/src/notation/view/notationviewinputcontroller.cpp @@ -398,6 +398,15 @@ void NotationViewInputController::wheelEvent(QWheelEvent* event) qreal stepsX = 0.0; qreal stepsY = 0.0; +// pixelDelta is unreliable on X11 +#ifdef Q_OS_LINUX + if (std::getenv("WAYLAND_DISPLAY") == NULL) { + // Ignore pixelsScrolled unless Wayland is used + pixelsScrolled.setX(0); + pixelsScrolled.setY(0); + } +#endif + if (!pixelsScrolled.isNull()) { dx = pixelsScrolled.x(); dy = pixelsScrolled.y();