30
32
class QtEventFeeder : public mir::input::InputDispatcher
35
// Interface between QtEventFeeder and the actual QWindowSystemInterface functions
36
// and other related Qt methods and objects to enable replacing them with mocks in
38
// TODO - Make it work with multimonitor scenarios
39
class QtWindowSystemInterface {
41
virtual ~QtWindowSystemInterface() {}
42
virtual bool hasTargetWindow() = 0;
43
virtual QRect targetWindowGeometry() = 0;
44
virtual void registerTouchDevice(QTouchDevice *device) = 0;
45
virtual void handleExtendedKeyEvent(ulong timestamp, QEvent::Type type, int key,
46
Qt::KeyboardModifiers modifiers,
47
quint32 nativeScanCode, quint32 nativeVirtualKey,
48
quint32 nativeModifiers,
49
const QString& text = QString(), bool autorep = false,
50
ushort count = 1) = 0;
51
virtual void handleTouchEvent(ulong timestamp, QTouchDevice *device,
52
const QList<struct QWindowSystemInterface::TouchPoint> &points,
53
Qt::KeyboardModifiers mods = Qt::NoModifier) = 0;
56
QtEventFeeder(QtWindowSystemInterface *windowSystem = nullptr);
57
virtual ~QtEventFeeder();
35
59
static const int MirEventActionMask;
36
60
static const int MirEventActionPointerIndexMask;
46
70
void dispatchKey(MirKeyEvent const& event);
47
71
void dispatchMotion(MirMotionEvent const& event);
72
void validateTouches(QList<QWindowSystemInterface::TouchPoint> &touchPoints);
73
bool validateTouch(QWindowSystemInterface::TouchPoint &touchPoint);
49
75
QTouchDevice *mTouchDevice;
76
QtWindowSystemInterface *mQtWindowSystem;
78
// Maps the id of an active touch to its last known state
79
QHash<int, QWindowSystemInterface::TouchPoint> mActiveTouches;
52
82
#endif // MIR_QT_EVENT_FEEDER_H