input: use KeyEvent instead of QKeyEvent

This commit is contained in:
Xaver Hugl 2022-12-21 16:50:42 +01:00
parent 55e55b9b15
commit 3390904c19
8 changed files with 22 additions and 20 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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<EffectsHandlerImpl *>(effects)->checkInputWindowEvent(event);
}
bool keyEvent(QKeyEvent *event) override
bool keyEvent(KeyEvent *event) override
{
if (!effects || !static_cast<EffectsHandlerImpl *>(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<KeyEvent *>(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<InternalWindow *> &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;

View file

@ -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);

View file

@ -22,7 +22,7 @@ bool PlaceholderInputEventFilter::wheelEvent(WheelEvent *event)
return true;
}
bool PlaceholderInputEventFilter::keyEvent(QKeyEvent *event)
bool PlaceholderInputEventFilter::keyEvent(KeyEvent *event)
{
return true;
}

View file

@ -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;

View file

@ -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;

View file

@ -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: