1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDSEAT_P_H |
5 | #define QWAYLANDSEAT_P_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 <stdint.h> |
19 | |
20 | #include <QtWaylandCompositor/private/qtwaylandcompositorglobal_p.h> |
21 | #include <QtWaylandCompositor/qwaylandseat.h> |
22 | |
23 | #include <QtCore/QList> |
24 | #include <QtCore/QPoint> |
25 | #include <QtCore/QScopedPointer> |
26 | #include <QtCore/private/qobject_p.h> |
27 | |
28 | #include <QtWaylandCompositor/private/qwayland-server-wayland.h> |
29 | |
30 | QT_BEGIN_NAMESPACE |
31 | |
32 | class QKeyEvent; |
33 | class QTouchEvent; |
34 | class QWaylandSeat; |
35 | class QWaylandDrag; |
36 | class QWaylandView; |
37 | |
38 | namespace QtWayland { |
39 | |
40 | class Compositor; |
41 | class DataDevice; |
42 | class Surface; |
43 | class DataDeviceManager; |
44 | class Pointer; |
45 | class Keyboard; |
46 | class Touch; |
47 | class InputMethod; |
48 | |
49 | } |
50 | |
51 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat |
52 | { |
53 | public: |
54 | Q_DECLARE_PUBLIC(QWaylandSeat) |
55 | |
56 | QWaylandSeatPrivate(QWaylandSeat *seat); |
57 | ~QWaylandSeatPrivate() override; |
58 | |
59 | void setCapabilities(QWaylandSeat::CapabilityFlags caps); |
60 | |
61 | static QWaylandSeatPrivate *get(QWaylandSeat *device) { return device->d_func(); } |
62 | |
63 | #if QT_CONFIG(wayland_datadevice) |
64 | void clientRequestedDataDevice(QtWayland::DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id); |
65 | QtWayland::DataDevice *dataDevice() const { return data_device.data(); } |
66 | #endif |
67 | |
68 | protected: |
69 | void seat_bind_resource(wl_seat::Resource *resource) override; |
70 | |
71 | void seat_get_pointer(wl_seat::Resource *resource, |
72 | uint32_t id) override; |
73 | void seat_get_keyboard(wl_seat::Resource *resource, |
74 | uint32_t id) override; |
75 | void seat_get_touch(wl_seat::Resource *resource, |
76 | uint32_t id) override; |
77 | |
78 | void seat_destroy_resource(wl_seat::Resource *resource) override; |
79 | |
80 | private: |
81 | bool isInitialized = false; |
82 | QWaylandCompositor *compositor = nullptr; |
83 | QWaylandView *mouseFocus = nullptr; |
84 | QWaylandSurface *keyboardFocus = nullptr; |
85 | QWaylandSeat::CapabilityFlags capabilities; |
86 | |
87 | QScopedPointer<QWaylandPointer> pointer; |
88 | QScopedPointer<QWaylandKeyboard> keyboard; |
89 | QScopedPointer<QWaylandTouch> touch; |
90 | #if QT_CONFIG(wayland_datadevice) |
91 | QScopedPointer<QtWayland::DataDevice> data_device; |
92 | # if QT_CONFIG(draganddrop) |
93 | QScopedPointer<QWaylandDrag> drag_handle; |
94 | # endif |
95 | #endif |
96 | QScopedPointer<QWaylandKeymap> keymap; |
97 | |
98 | }; |
99 | |
100 | QT_END_NAMESPACE |
101 | |
102 | #endif // QWAYLANDSEAT_P_H |
103 | |