File indexing completed on 2024-02-18 16:20:03

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 #include <kwin_export.h>
0011 
0012 #include <QtGlobal>
0013 #include <chrono>
0014 
0015 class QPointF;
0016 class QTabletEvent;
0017 
0018 namespace KWin
0019 {
0020 class KeyEvent;
0021 class MouseEvent;
0022 class WheelEvent;
0023 class SwitchEvent;
0024 class TabletEvent;
0025 class TabletToolId;
0026 class TabletPadId;
0027 
0028 /**
0029  * Base class for spying on input events inside InputRedirection.
0030  *
0031  * This class is quite similar to InputEventFilter, except that it does not
0032  * support event filtering. Each InputEventSpy gets to see all input events,
0033  * the processing happens prior to sending events through the InputEventFilters.
0034  *
0035  * Deleting an instance of InputEventSpy automatically uninstalls it from
0036  * InputRedirection.
0037  */
0038 class KWIN_EXPORT InputEventSpy
0039 {
0040 public:
0041     InputEventSpy();
0042     virtual ~InputEventSpy();
0043 
0044     /**
0045      * Event spy for pointer events which can be described by a MouseEvent.
0046      *
0047      * @param event The event information about the move or button press/release
0048      */
0049     virtual void pointerEvent(MouseEvent *event);
0050     /**
0051      * Event spy for pointer axis events.
0052      *
0053      * @param event The event information about the axis event
0054      */
0055     virtual void wheelEvent(WheelEvent *event);
0056     /**
0057      * Event spy for keyboard events.
0058      *
0059      * @param event The event information about the key event
0060      */
0061     virtual void keyEvent(KeyEvent *event);
0062     virtual void touchDown(qint32 id, const QPointF &pos, std::chrono::microseconds time);
0063     virtual void touchMotion(qint32 id, const QPointF &pos, std::chrono::microseconds time);
0064     virtual void touchUp(qint32 id, std::chrono::microseconds time);
0065 
0066     virtual void pinchGestureBegin(int fingerCount, std::chrono::microseconds time);
0067     virtual void pinchGestureUpdate(qreal scale, qreal angleDelta, const QPointF &delta, std::chrono::microseconds time);
0068     virtual void pinchGestureEnd(std::chrono::microseconds time);
0069     virtual void pinchGestureCancelled(std::chrono::microseconds time);
0070 
0071     virtual void swipeGestureBegin(int fingerCount, std::chrono::microseconds time);
0072     virtual void swipeGestureUpdate(const QPointF &delta, std::chrono::microseconds time);
0073     virtual void swipeGestureEnd(std::chrono::microseconds time);
0074     virtual void swipeGestureCancelled(std::chrono::microseconds time);
0075 
0076     virtual void holdGestureBegin(int fingerCount, std::chrono::microseconds time);
0077     virtual void holdGestureEnd(std::chrono::microseconds time);
0078     virtual void holdGestureCancelled(std::chrono::microseconds time);
0079 
0080     virtual void switchEvent(SwitchEvent *event);
0081 
0082     virtual void tabletToolEvent(TabletEvent *event);
0083     virtual void tabletToolButtonEvent(uint button, bool pressed, const TabletToolId &tabletToolId, std::chrono::microseconds time);
0084     virtual void tabletPadButtonEvent(uint button, bool pressed, const TabletPadId &tabletPadId, std::chrono::microseconds time);
0085     virtual void tabletPadStripEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId, std::chrono::microseconds time);
0086     virtual void tabletPadRingEvent(int number, int position, bool isFinger, const TabletPadId &tabletPadId, std::chrono::microseconds time);
0087 };
0088 
0089 } // namespace KWin