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
24QT_BEGIN_NAMESPACE
25
26namespace QtWaylandClient {
27
28class QWaylandDisplay;
29class QWaylandInputDevice;
30
31class Q_WAYLANDCLIENT_EXPORT QWaylandTouchExtension : public QtWayland::qt_touch_extension
32{
33public:
34 QWaylandTouchExtension(QWaylandDisplay *display, uint32_t id);
35
36 void touchCanceled();
37
38private:
39 void registerDevice(int caps);
40
41 QWaylandDisplay *mDisplay = nullptr;
42
43 void touch_extension_touch(uint32_t time,
44 uint32_t id,
45 uint32_t state,
46 int32_t x,
47 int32_t y,
48 int32_t normalized_x,
49 int32_t normalized_y,
50 int32_t width,
51 int32_t height,
52 uint32_t pressure,
53 int32_t velocity_x,
54 int32_t velocity_y,
55 uint32_t flags,
56 struct wl_array *rawdata) override;
57 void touch_extension_configure(uint32_t flags) override;
58
59 void sendTouchEvent();
60
61 QList<QWindowSystemInterface::TouchPoint> mTouchPoints;
62 QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints;
63 QPointingDevice *mTouchDevice = nullptr;
64 uint32_t mTimestamp;
65 int mPointsLeft;
66 uint32_t mFlags;
67 int mMouseSourceId;
68 QPointF mLastMouseLocal;
69 QPointF mLastMouseGlobal;
70 QWindow *mTargetWindow = nullptr;
71 QWaylandInputDevice *mInputDevice = nullptr;
72};
73
74}
75
76QT_END_NAMESPACE
77
78#endif // QWAYLANDTOUCH_H
79

source code of qtwayland/src/client/qwaylandtouch_p.h