From 3390904c19579a382fd5a122eda340b2745a9396 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 21 Dec 2022 16:50:42 +0100 Subject: [PATCH] input: use KeyEvent instead of QKeyEvent --- src/dpmsinputeventfilter.cpp | 3 ++- src/dpmsinputeventfilter.h | 2 +- src/input.cpp | 26 +++++++++++++------------- src/input.h | 3 ++- src/placeholderinputeventfilter.cpp | 2 +- src/placeholderinputeventfilter.h | 2 +- src/popup_input_filter.cpp | 2 +- src/popup_input_filter.h | 2 +- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/dpmsinputeventfilter.cpp b/src/dpmsinputeventfilter.cpp index edc4a0ab3a..67e0585b58 100644 --- a/src/dpmsinputeventfilter.cpp +++ b/src/dpmsinputeventfilter.cpp @@ -8,6 +8,7 @@ */ #include "dpmsinputeventfilter.h" #include "core/output.h" +#include "input_event.h" #include "main.h" #include "wayland/seat_interface.h" #include "wayland_server.h" @@ -40,7 +41,7 @@ bool DpmsInputEventFilter::wheelEvent(WheelEvent *event) return true; } -bool DpmsInputEventFilter::keyEvent(QKeyEvent *event) +bool DpmsInputEventFilter::keyEvent(KeyEvent *event) { if (event->type() == QKeyEvent::KeyPress) { notify(); diff --git a/src/dpmsinputeventfilter.h b/src/dpmsinputeventfilter.h index 101702bfde..2fc12ca6a3 100644 --- a/src/dpmsinputeventfilter.h +++ b/src/dpmsinputeventfilter.h @@ -26,7 +26,7 @@ public: bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; bool wheelEvent(WheelEvent *event) override; - bool keyEvent(QKeyEvent *event) override; + bool keyEvent(KeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override; bool touchUp(qint32 id, quint32 time) override; diff --git a/src/input.cpp b/src/input.cpp index 821a602933..60d825afa5 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -115,7 +115,7 @@ bool InputEventFilter::wheelEvent(WheelEvent *event) return false; } -bool InputEventFilter::keyEvent(QKeyEvent *event) +bool InputEventFilter::keyEvent(KeyEvent *event) { return false; } @@ -271,7 +271,7 @@ bool InputEventFilter::passToInputMethod(QKeyEvent *event) class VirtualTerminalFilter : public InputEventFilter { public: - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { // really on press and not on release? X11 switches on press. if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) { @@ -288,7 +288,7 @@ public: class TerminateServerFilter : public InputEventFilter { public: - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (event->type() == QEvent::KeyPress && !event->isAutoRepeat()) { if (event->nativeVirtualKey() == XKB_KEY_Terminate_Server) { @@ -352,7 +352,7 @@ public: } return true; } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (!waylandServer()->isScreenLocked()) { return false; @@ -522,7 +522,7 @@ public: } return static_cast(effects)->checkInputWindowEvent(event); } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (!effects || !static_cast(effects)->hasKeyboardGrab()) { return false; @@ -618,7 +618,7 @@ public: // filter out while moving a window return workspace()->moveResizeWindow() != nullptr; } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { Window *window = workspace()->moveResizeWindow(); if (!window) { @@ -728,7 +728,7 @@ public: // filter out while selecting a window return m_active; } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (!m_active) { return false; @@ -900,7 +900,7 @@ public: } return input()->shortcuts()->processAxis(event->modifiers(), direction); } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (event->key() == Qt::Key_PowerOff) { const auto modifiers = static_cast(event)->modifiersRelevantForGlobalShortcuts(); @@ -1205,7 +1205,7 @@ class InternalWindowEventFilter : public InputEventFilter QCoreApplication::sendEvent(internal, &wheelEvent); return wheelEvent.isAccepted(); } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { const QList &windows = workspace()->internalWindows(); QWindow *found = nullptr; @@ -1565,7 +1565,7 @@ public: } return workspace()->tabbox()->handleMouseEvent(event); } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (!workspace()->tabbox() || !workspace()->tabbox()->isGrabbed()) { return false; @@ -1722,7 +1722,7 @@ public: class InputKeyboardFilter : public InputEventFilter { public: - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { return passToInputMethod(event); } @@ -1771,7 +1771,7 @@ public: seat->notifyPointerFrame(); return true; } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (event->isAutoRepeat()) { // handled by Wayland client @@ -2487,7 +2487,7 @@ public: } return true; } - bool keyEvent(QKeyEvent *event) override + bool keyEvent(KeyEvent *event) override { if (event->key() != Qt::Key_Escape) { return false; diff --git a/src/input.h b/src/input.h index ac38aa4de5..5c8ca0202f 100644 --- a/src/input.h +++ b/src/input.h @@ -47,6 +47,7 @@ class TabletToolId; class TabletPadId; class MouseEvent; class WheelEvent; +class KeyEvent; namespace Decoration { @@ -399,7 +400,7 @@ public: * @param event The event information about the key event * @return @c true to stop further event processing, @c false to pass to next filter. */ - virtual bool keyEvent(QKeyEvent *event); + virtual bool keyEvent(KeyEvent *event); virtual bool touchDown(qint32 id, const QPointF &pos, quint32 time); virtual bool touchMotion(qint32 id, const QPointF &pos, quint32 time); virtual bool touchUp(qint32 id, quint32 time); diff --git a/src/placeholderinputeventfilter.cpp b/src/placeholderinputeventfilter.cpp index ff202c6cf6..4420311a08 100644 --- a/src/placeholderinputeventfilter.cpp +++ b/src/placeholderinputeventfilter.cpp @@ -22,7 +22,7 @@ bool PlaceholderInputEventFilter::wheelEvent(WheelEvent *event) return true; } -bool PlaceholderInputEventFilter::keyEvent(QKeyEvent *event) +bool PlaceholderInputEventFilter::keyEvent(KeyEvent *event) { return true; } diff --git a/src/placeholderinputeventfilter.h b/src/placeholderinputeventfilter.h index d2d6317d0a..57cb6c5da0 100644 --- a/src/placeholderinputeventfilter.h +++ b/src/placeholderinputeventfilter.h @@ -18,7 +18,7 @@ class PlaceholderInputEventFilter : public InputEventFilter public: bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; bool wheelEvent(WheelEvent *event) override; - bool keyEvent(QKeyEvent *event) override; + bool keyEvent(KeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; bool touchMotion(qint32 id, const QPointF &pos, quint32 time) override; bool touchUp(qint32 id, quint32 time) override; diff --git a/src/popup_input_filter.cpp b/src/popup_input_filter.cpp index 644080e4d3..7ee0f7e8ca 100644 --- a/src/popup_input_filter.cpp +++ b/src/popup_input_filter.cpp @@ -65,7 +65,7 @@ bool PopupInputFilter::pointerEvent(MouseEvent *event, quint32 nativeButton) return false; } -bool PopupInputFilter::keyEvent(QKeyEvent *event) +bool PopupInputFilter::keyEvent(KeyEvent *event) { if (m_popupWindows.isEmpty()) { return false; diff --git a/src/popup_input_filter.h b/src/popup_input_filter.h index cc62b3cd42..07cdcdfec8 100644 --- a/src/popup_input_filter.h +++ b/src/popup_input_filter.h @@ -21,7 +21,7 @@ class PopupInputFilter : public QObject, public InputEventFilter public: explicit PopupInputFilter(); bool pointerEvent(MouseEvent *event, quint32 nativeButton) override; - bool keyEvent(QKeyEvent *event) override; + bool keyEvent(KeyEvent *event) override; bool touchDown(qint32 id, const QPointF &pos, quint32 time) override; private: