From 55e55b9b150cb9a30190440de6f5e8e04a888447 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 21 Dec 2022 15:53:11 +0100 Subject: [PATCH] input: use WheelEvent instead of QWheelEvent --- src/dpmsinputeventfilter.cpp | 2 +- src/dpmsinputeventfilter.h | 2 +- src/input.cpp | 22 +++++++++++----------- src/input.h | 3 ++- src/placeholderinputeventfilter.cpp | 2 +- src/placeholderinputeventfilter.h | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/dpmsinputeventfilter.cpp b/src/dpmsinputeventfilter.cpp index 335b837a20..edc4a0ab3a 100644 --- a/src/dpmsinputeventfilter.cpp +++ b/src/dpmsinputeventfilter.cpp @@ -34,7 +34,7 @@ bool DpmsInputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) return true; } -bool DpmsInputEventFilter::wheelEvent(QWheelEvent *event) +bool DpmsInputEventFilter::wheelEvent(WheelEvent *event) { notify(); return true; diff --git a/src/dpmsinputeventfilter.h b/src/dpmsinputeventfilter.h index 577f453542..101702bfde 100644 --- a/src/dpmsinputeventfilter.h +++ b/src/dpmsinputeventfilter.h @@ -25,7 +25,7 @@ public: ~DpmsInputEventFilter() override; bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; - bool wheelEvent(QWheelEvent *event) override; + bool wheelEvent(WheelEvent *event) override; bool keyEvent(QKeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override; diff --git a/src/input.cpp b/src/input.cpp index fdc5b668bf..821a602933 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -110,7 +110,7 @@ bool InputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) return false; } -bool InputEventFilter::wheelEvent(QWheelEvent *event) +bool InputEventFilter::wheelEvent(WheelEvent *event) { return false; } @@ -336,7 +336,7 @@ public: } return true; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (!waylandServer()->isScreenLocked()) { return false; @@ -515,7 +515,7 @@ public: } return static_cast(effects)->checkInputWindowEvent(event); } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (!effects) { return false; @@ -613,7 +613,7 @@ public: } return true; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { // filter out while moving a window return workspace()->moveResizeWindow() != nullptr; @@ -723,7 +723,7 @@ public: } return true; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { // filter out while selecting a window return m_active; @@ -883,7 +883,7 @@ public: } return false; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (event->modifiers() == Qt::NoModifier) { return false; @@ -1189,7 +1189,7 @@ class InternalWindowEventFilter : public InputEventFilter QCoreApplication::sendEvent(internal, &mouseEvent); return mouseEvent.isAccepted(); } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (!input()->pointer()->focus() || !input()->pointer()->focus()->isInternal()) { return false; @@ -1383,7 +1383,7 @@ public: } return false; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { auto decoration = input()->pointer()->decoration(); if (!decoration) { @@ -1584,7 +1584,7 @@ public: } return true; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) { return false; @@ -1668,7 +1668,7 @@ public: } return false; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { if (event->angleDelta().y() == 0) { // only actions on vertical scroll @@ -1761,7 +1761,7 @@ public: } return true; } - bool wheelEvent(QWheelEvent *event) override + bool wheelEvent(WheelEvent *event) override { auto seat = waylandServer()->seat(); seat->setTimestamp(event->timestamp()); diff --git a/src/input.h b/src/input.h index 23963b9e63..ac38aa4de5 100644 --- a/src/input.h +++ b/src/input.h @@ -46,6 +46,7 @@ class TabletEvent; class TabletToolId; class TabletPadId; class MouseEvent; +class WheelEvent; namespace Decoration { @@ -391,7 +392,7 @@ public: * @param event The event information about the axis event * @return @c true to stop further event processing, @c false to pass to next filter */ - virtual bool wheelEvent(QWheelEvent *event); + virtual bool wheelEvent(WheelEvent *event); /** * Event filter for keyboard events. * diff --git a/src/placeholderinputeventfilter.cpp b/src/placeholderinputeventfilter.cpp index c3c273a320..ff202c6cf6 100644 --- a/src/placeholderinputeventfilter.cpp +++ b/src/placeholderinputeventfilter.cpp @@ -17,7 +17,7 @@ bool PlaceholderInputEventFilter::pointerEvent(MouseEvent *event, quint32 native return true; } -bool PlaceholderInputEventFilter::wheelEvent(QWheelEvent *event) +bool PlaceholderInputEventFilter::wheelEvent(WheelEvent *event) { return true; } diff --git a/src/placeholderinputeventfilter.h b/src/placeholderinputeventfilter.h index 49511e60a3..d2d6317d0a 100644 --- a/src/placeholderinputeventfilter.h +++ b/src/placeholderinputeventfilter.h @@ -17,7 +17,7 @@ class PlaceholderInputEventFilter : public InputEventFilter { public: bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; - bool wheelEvent(QWheelEvent *event) override; + bool wheelEvent(WheelEvent *event) override; bool keyEvent(QKeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override;