From dab45b94c2b8ec73f33e5c1c9bdc7797d43948a3 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sun, 22 Sep 2024 17:50:35 +0300 Subject: [PATCH] Deliver wheel events to internal windows using QWindowSystemInterface api --- src/input.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index ef83de9ab8..94ea6232ba 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1233,15 +1233,18 @@ public: return false; } QWindow *internal = static_cast(input()->pointer()->focus())->handle(); - const QPointF localPos = event->globalPosition() - internal->position(); - QWheelEvent wheelEvent(localPos, event->globalPosition(), QPoint(), - event->angleDelta() * -1, - event->buttons(), - event->modifiers(), - Qt::NoScrollPhase, - false); - QCoreApplication::sendEvent(internal, &wheelEvent); - return wheelEvent.isAccepted(); + const auto timestamp = std::chrono::duration_cast(event->timestamp()); + const bool isAccepted = QWindowSystemInterface::handleWheelEvent(internal, + timestamp.count(), + event->globalPosition() - internal->position(), + event->globalPosition(), + QPoint(), + event->angleDelta() * -1, + event->modifiers(), + Qt::NoScrollPhase, + Qt::MouseEventNotSynthesized, + event->inverted()); + return isAccepted; } bool keyEvent(KeyEvent *event) override {