1 | // Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDXDGOUTPUTV1_P_H |
5 | #define QWAYLANDXDGOUTPUTV1_P_H |
6 | |
7 | #include <QtCore/QHash> |
8 | |
9 | #include <QWaylandOutput> |
10 | #include <QWaylandXdgOutputV1> |
11 | #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> |
12 | #include <QtWaylandCompositor/private/qwayland-server-xdg-output-unstable-v1.h> |
13 | |
14 | // |
15 | // W A R N I N G |
16 | // ------------- |
17 | // |
18 | // This file is not part of the Qt API. It exists purely as an |
19 | // implementation detail. This header file may change from version to |
20 | // version without notice, or even be removed. |
21 | // |
22 | // We mean it. |
23 | // |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputManagerV1Private |
28 | : public QWaylandCompositorExtensionPrivate |
29 | , public QtWaylandServer::zxdg_output_manager_v1 |
30 | { |
31 | Q_DECLARE_PUBLIC(QWaylandXdgOutputManagerV1) |
32 | public: |
33 | explicit QWaylandXdgOutputManagerV1Private() = default; |
34 | |
35 | void registerXdgOutput(QWaylandOutput *output, QWaylandXdgOutputV1 *xdgOutput); |
36 | void unregisterXdgOutput(QWaylandOutput *output); |
37 | |
38 | static QWaylandXdgOutputManagerV1Private *get(QWaylandXdgOutputManagerV1 *manager) { return manager ? manager->d_func() : nullptr; } |
39 | |
40 | protected: |
41 | void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, |
42 | wl_resource *outputResource) override; |
43 | |
44 | private: |
45 | QHash<QWaylandOutput *, QWaylandXdgOutputV1 *> xdgOutputs; |
46 | }; |
47 | |
48 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputV1Private |
49 | : public QObjectPrivate |
50 | , public QtWaylandServer::zxdg_output_v1 |
51 | { |
52 | Q_DECLARE_PUBLIC(QWaylandXdgOutputV1) |
53 | public: |
54 | explicit QWaylandXdgOutputV1Private() = default; |
55 | |
56 | void sendLogicalPosition(const QPoint &position); |
57 | void sendLogicalSize(const QSize &size); |
58 | void sendDone(); |
59 | |
60 | void setManager(QWaylandXdgOutputManagerV1 *manager); |
61 | void setOutput(QWaylandOutput *output); |
62 | |
63 | static QWaylandXdgOutputV1Private *get(QWaylandXdgOutputV1 *xdgOutput) { return xdgOutput ? xdgOutput->d_func() : nullptr; } |
64 | |
65 | bool initialized = false; |
66 | QWaylandOutput *output = nullptr; |
67 | QWaylandXdgOutputManagerV1 *manager = nullptr; |
68 | QPoint logicalPos; |
69 | QSize logicalSize; |
70 | QString name; |
71 | QString description; |
72 | bool needToSendDone = false; |
73 | |
74 | protected: |
75 | void zxdg_output_v1_bind_resource(Resource *resource) override; |
76 | void zxdg_output_v1_destroy(Resource *resource) override; |
77 | }; |
78 | |
79 | QT_END_NAMESPACE |
80 | |
81 | #endif // QWAYLANDXDGOUTPUTV1_P_H |
82 |