1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDTOUCH_H |
5 | #define QWAYLANDTOUCH_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <qpa/qwindowsysteminterface.h> |
19 | |
20 | #include <QtWaylandClient/private/qwayland-touch-extension.h> |
21 | #include <QtWaylandClient/qtwaylandclientglobal.h> |
22 | #include <QtCore/private/qglobal_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | namespace QtWaylandClient { |
27 | |
28 | class QWaylandDisplay; |
29 | class QWaylandInputDevice; |
30 | |
31 | class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension |
32 | { |
33 | public: |
34 | QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id); |
35 | ~QWaylandTouchExtension() override; |
36 | |
37 | void touchCanceled(); |
38 | |
39 | private: |
40 | void registerDevice(int caps); |
41 | |
42 | QWaylandDisplay *mDisplay = nullptr; |
43 | |
44 | void touch_extension_touch(uint32_t time, |
45 | uint32_t id, |
46 | uint32_t state, |
47 | int32_t x, |
48 | int32_t y, |
49 | int32_t normalized_x, |
50 | int32_t normalized_y, |
51 | int32_t width, |
52 | int32_t height, |
53 | uint32_t pressure, |
54 | int32_t velocity_x, |
55 | int32_t velocity_y, |
56 | uint32_t flags, |
57 | struct wl_array *rawdata) override; |
58 | void touch_extension_configure(uint32_t flags) override; |
59 | |
60 | void sendTouchEvent(); |
61 | |
62 | QList<QWindowSystemInterface::TouchPoint> mTouchPoints; |
63 | QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints; |
64 | QPointingDevice *mTouchDevice = nullptr; |
65 | uint32_t mTimestamp; |
66 | int mPointsLeft; |
67 | uint32_t mFlags; |
68 | int mMouseSourceId; |
69 | QPointF mLastMouseLocal; |
70 | QPointF mLastMouseGlobal; |
71 | QWindow *mTargetWindow = nullptr; |
72 | QWaylandInputDevice *mInputDevice = nullptr; |
73 | }; |
74 | |
75 | } |
76 | |
77 | QT_END_NAMESPACE |
78 | |
79 | #endif // QWAYLANDTOUCH_H |
80 |