From 334a08dd2dafaa3784ab9430437266df521e4657 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Mon, 16 Aug 2021 13:22:37 +0200 Subject: [PATCH] Temporary work-around for #394 (mouse wheel issue with Alt-modifier). --- src/contour/helper.cpp | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/contour/helper.cpp b/src/contour/helper.cpp index d389ef42c0..c365854489 100644 --- a/src/contour/helper.cpp +++ b/src/contour/helper.cpp @@ -183,16 +183,34 @@ void sendWheelEvent(QWheelEvent* _event, TerminalSession& _session) { auto const yDelta = [&]() -> int { -// switch (_event->orientation()) -// { -// case Qt::Orientation::Horizontal: -// return _event->pixelDelta().x() ? _event->pixelDelta().x() -// : _event->angleDelta().x(); -// case Qt::Orientation::Vertical: -// return _event->pixelDelta().y() ? _event->pixelDelta().y() -// : _event->angleDelta().y(); -// } + #if 1 // FIXME: Temporarily addressing a really bad Qt implementation detail + // as tracked here: + // https://github.com/contour-terminal/contour/issues/394 + + if (_event->pixelDelta().y()) + return _event->pixelDelta().y(); + if (_event->angleDelta().y()) + return _event->angleDelta().y(); + + if (_event->pixelDelta().x()) + return _event->pixelDelta().x(); + if (_event->angleDelta().x()) + return _event->angleDelta().x(); + + return 0; + + #else + // switch (_event->orientation()) + // { + // case Qt::Orientation::Horizontal: + // return _event->pixelDelta().x() ? _event->pixelDelta().x() + // : _event->angleDelta().x(); + // case Qt::Orientation::Vertical: + // return _event->pixelDelta().y() ? _event->pixelDelta().y() + // : _event->angleDelta().y(); + // } return _event->angleDelta().y(); + #endif }(); if (yDelta)