1 | // Copyright (C) 2020 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef WLTOUCH_H |
5 | #define WLTOUCH_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 <QtWaylandCompositor/private/qwayland-server-touch-extension.h> |
19 | #include <QtWaylandCompositor/QWaylandCompositor> |
20 | #include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate> |
21 | #include <QtCore/private/qglobal_p.h> |
22 | |
23 | #include <wayland-util.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class Surface; |
28 | class QTouchEvent; |
29 | class QWaylandView; |
30 | |
31 | namespace QtWayland { |
32 | |
33 | class TouchExtensionGlobal : public QWaylandCompositorExtensionTemplate<TouchExtensionGlobal>, public QtWaylandServer::qt_touch_extension |
34 | { |
35 | Q_OBJECT |
36 | Q_PROPERTY(BehaviorFlags behaviorFlags READ behaviorFlags WRITE setBehviorFlags NOTIFY behaviorFlagsChanged) |
37 | public: |
38 | |
39 | enum BehaviorFlag{ |
40 | None = 0x00, |
41 | MouseFromTouch = 0x01 |
42 | }; |
43 | Q_DECLARE_FLAGS(BehaviorFlags, BehaviorFlag) |
44 | |
45 | TouchExtensionGlobal(QWaylandCompositor *compositor); |
46 | ~TouchExtensionGlobal() override; |
47 | |
48 | bool postTouchEvent(QTouchEvent *event, QWaylandSurface *surface); |
49 | |
50 | void setBehviorFlags(BehaviorFlags flags); |
51 | BehaviorFlags behaviorFlags() const { return m_flags; } |
52 | |
53 | Q_SIGNALS: |
54 | void behaviorFlagsChanged(); |
55 | |
56 | protected: |
57 | void touch_extension_bind_resource(Resource *resource) override; |
58 | void touch_extension_destroy_resource(Resource *resource) override; |
59 | |
60 | private: |
61 | QWaylandCompositor *m_compositor = nullptr; |
62 | BehaviorFlags m_flags = BehaviorFlag::None; |
63 | QList<Resource *> m_resources; |
64 | QList<float> m_posData; |
65 | }; |
66 | |
67 | Q_DECLARE_OPERATORS_FOR_FLAGS(TouchExtensionGlobal::BehaviorFlags) |
68 | |
69 | } |
70 | |
71 | QT_END_NAMESPACE |
72 | |
73 | #endif // WLTOUCH_H |
74 |