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
30QT_BEGIN_NAMESPACE
31
32class QKeyEvent;
33class QTouchEvent;
34class QWaylandSeat;
35class QWaylandDrag;
36class QWaylandView;
37
38namespace QtWayland {
39
40class Compositor;
41class DataDevice;
42class Surface;
43class DataDeviceManager;
44class Pointer;
45class Keyboard;
46class Touch;
47class InputMethod;
48
49}
50
51class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat
52{
53public:
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
68protected:
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
80private:
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
100QT_END_NAMESPACE
101
102#endif // QWAYLANDSEAT_P_H
103

source code of qtwayland/src/compositor/compositor_api/qwaylandseat_p.h