From 3d92f5b75fc5dcadb39ea205c371b42a4c862fe0 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 21 Dec 2022 15:35:38 +0100 Subject: [PATCH] input: use MouseEvent instead of QMouseEvent --- src/dpmsinputeventfilter.cpp | 2 +- src/dpmsinputeventfilter.h | 2 +- src/input.cpp | 26 +++++++++---------- src/input.h | 3 ++- src/placeholderinputeventfilter.cpp | 2 +- src/placeholderinputeventfilter.h | 2 +- .../buttonrebinds/buttonrebindsfilter.cpp | 2 +- .../buttonrebinds/buttonrebindsfilter.h | 2 +- src/popup_input_filter.cpp | 6 ++--- src/popup_input_filter.h | 2 +- 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/dpmsinputeventfilter.cpp b/src/dpmsinputeventfilter.cpp index bbb58aa64f..335b837a20 100644 --- a/src/dpmsinputeventfilter.cpp +++ b/src/dpmsinputeventfilter.cpp @@ -28,7 +28,7 @@ DpmsInputEventFilter::DpmsInputEventFilter() DpmsInputEventFilter::~DpmsInputEventFilter() = default; -bool DpmsInputEventFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton) +bool DpmsInputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) { notify(); return true; diff --git a/src/dpmsinputeventfilter.h b/src/dpmsinputeventfilter.h index eb3cd1dfdb..577f453542 100644 --- a/src/dpmsinputeventfilter.h +++ b/src/dpmsinputeventfilter.h @@ -24,7 +24,7 @@ public: DpmsInputEventFilter(); ~DpmsInputEventFilter() override; - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override; + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; bool wheelEvent(QWheelEvent *event) override; bool keyEvent(QKeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; diff --git a/src/input.cpp b/src/input.cpp index 0b8724b88b..fdc5b668bf 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -105,7 +105,7 @@ InputEventFilter::~InputEventFilter() } } -bool InputEventFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton) +bool InputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) { return false; } @@ -304,7 +304,7 @@ public: class LockScreenFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (!waylandServer()->isScreenLocked()) { return false; @@ -508,7 +508,7 @@ private: class EffectsFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (!effects) { return false; @@ -593,7 +593,7 @@ public: class MoveResizeFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { Window *window = workspace()->moveResizeWindow(); if (!window) { @@ -703,7 +703,7 @@ private: class WindowSelectorFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (!m_active) { return false; @@ -874,7 +874,7 @@ public: m_powerDown.setInterval(1000); } - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (event->type() == QEvent::MouseButtonPress) { if (input()->shortcuts()->processPointerPressed(event->modifiers(), event->buttons())) { @@ -1176,7 +1176,7 @@ std::pair performWindowWheelAction(QWheelEvent *event, Window *windo class InternalWindowEventFilter : public InputEventFilter { - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (!input()->pointer()->focus() || !input()->pointer()->focus()->isInternal()) { return false; @@ -1346,7 +1346,7 @@ private: class DecorationEventFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { auto decoration = input()->pointer()->decoration(); if (!decoration) { @@ -1558,7 +1558,7 @@ private: class TabBoxInputFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 button) override + bool pointerEvent(MouseEvent *event, quint32 button) override { if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) { return false; @@ -1597,7 +1597,7 @@ public: class ScreenEdgeInputFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { workspace()->screenEdges()->isEntered(event); // always forward @@ -1653,7 +1653,7 @@ private: class WindowActionInputFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { if (event->type() != QEvent::MouseButtonPress) { return false; @@ -1734,7 +1734,7 @@ public: class ForwardInputFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { auto seat = waylandServer()->seat(); seat->setTimestamp(event->timestamp()); @@ -2343,7 +2343,7 @@ public: connect(&m_raiseTimer, &QTimer::timeout, this, &DragAndDropInputFilter::raiseDragTarget); } - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override { auto seat = waylandServer()->seat(); if (!seat->isDragPointer()) { diff --git a/src/input.h b/src/input.h index f623a70475..23963b9e63 100644 --- a/src/input.h +++ b/src/input.h @@ -45,6 +45,7 @@ class SwitchEvent; class TabletEvent; class TabletToolId; class TabletPadId; +class MouseEvent; namespace Decoration { @@ -383,7 +384,7 @@ public: * @param nativeButton The native key code of the button, for move events 0 * @return @c true to stop further event processing, @c false to pass to next filter */ - virtual bool pointerEvent(QMouseEvent *event, quint32 nativeButton); + virtual bool pointerEvent(MouseEvent *event, quint32 nativeButton); /** * Event filter for pointer axis events. * diff --git a/src/placeholderinputeventfilter.cpp b/src/placeholderinputeventfilter.cpp index 4a43246bc2..c3c273a320 100644 --- a/src/placeholderinputeventfilter.cpp +++ b/src/placeholderinputeventfilter.cpp @@ -12,7 +12,7 @@ namespace KWin { -bool PlaceholderInputEventFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton) +bool PlaceholderInputEventFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) { return true; } diff --git a/src/placeholderinputeventfilter.h b/src/placeholderinputeventfilter.h index d2b5653ad0..49511e60a3 100644 --- a/src/placeholderinputeventfilter.h +++ b/src/placeholderinputeventfilter.h @@ -16,7 +16,7 @@ namespace KWin class PlaceholderInputEventFilter : public InputEventFilter { public: - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override; + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; bool wheelEvent(QWheelEvent *event) override; bool keyEvent(QKeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; diff --git a/src/plugins/buttonrebinds/buttonrebindsfilter.cpp b/src/plugins/buttonrebinds/buttonrebindsfilter.cpp index 4de9d83562..0f236d135a 100644 --- a/src/plugins/buttonrebinds/buttonrebindsfilter.cpp +++ b/src/plugins/buttonrebinds/buttonrebindsfilter.cpp @@ -196,7 +196,7 @@ void ButtonRebindsFilter::loadConfig(const KConfigGroup &group) } } -bool ButtonRebindsFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton) +bool ButtonRebindsFilter::pointerEvent(KWin::MouseEvent *event, quint32 nativeButton) { if (event->type() != QEvent::MouseButtonPress && event->type() != QEvent::MouseButtonRelease) { return false; diff --git a/src/plugins/buttonrebinds/buttonrebindsfilter.h b/src/plugins/buttonrebinds/buttonrebindsfilter.h index b50f28d655..b8b67ad344 100644 --- a/src/plugins/buttonrebinds/buttonrebindsfilter.h +++ b/src/plugins/buttonrebinds/buttonrebindsfilter.h @@ -71,7 +71,7 @@ public: }; explicit ButtonRebindsFilter(); - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override; + bool pointerEvent(KWin::MouseEvent *event, quint32 nativeButton) override; bool tabletPadButtonEvent(uint button, bool pressed, const KWin::TabletPadId &tabletPadId, uint time) override; bool tabletToolButtonEvent(uint button, bool pressed, const KWin::TabletToolId &tabletToolId, uint time) override; diff --git a/src/popup_input_filter.cpp b/src/popup_input_filter.cpp index a5a59b4b0f..644080e4d3 100644 --- a/src/popup_input_filter.cpp +++ b/src/popup_input_filter.cpp @@ -6,14 +6,13 @@ */ #include "popup_input_filter.h" #include "deleted.h" +#include "input_event.h" #include "internalwindow.h" #include "wayland/seat_interface.h" #include "wayland_server.h" #include "window.h" #include "workspace.h" -#include - namespace KWin { @@ -41,7 +40,8 @@ void PopupInputFilter::handleWindowRemoved(Window *window) { m_popupWindows.removeOne(window); } -bool PopupInputFilter::pointerEvent(QMouseEvent *event, quint32 nativeButton) + +bool PopupInputFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) { if (m_popupWindows.isEmpty()) { return false; diff --git a/src/popup_input_filter.h b/src/popup_input_filter.h index be6be50be6..cc62b3cd42 100644 --- a/src/popup_input_filter.h +++ b/src/popup_input_filter.h @@ -20,7 +20,7 @@ class PopupInputFilter : public QObject, public InputEventFilter Q_OBJECT public: explicit PopupInputFilter(); - bool pointerEvent(QMouseEvent *event, quint32 nativeButton) override; + bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; bool keyEvent(QKeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override;