| 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 | QWaylandXdgOutputV1 *xdgOutput(QWaylandOutput *output) const; | 
| 38 | |
| 39 | static QWaylandXdgOutputManagerV1Private *get(QWaylandXdgOutputManagerV1 *manager) { return manager ? manager->d_func() : nullptr; } | 
| 40 | |
| 41 | protected: | 
| 42 | void zxdg_output_manager_v1_get_xdg_output(Resource *resource, uint32_t id, | 
| 43 | wl_resource *outputResource) override; | 
| 44 | |
| 45 | private: | 
| 46 | QHash<QWaylandOutput *, QWaylandXdgOutputV1 *> xdgOutputs; | 
| 47 | }; | 
| 48 | |
| 49 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgOutputV1Private | 
| 50 | : public QObjectPrivate | 
| 51 | , public QtWaylandServer::zxdg_output_v1 | 
| 52 | { | 
| 53 | Q_DECLARE_PUBLIC(QWaylandXdgOutputV1) | 
| 54 | public: | 
| 55 | explicit QWaylandXdgOutputV1Private() = default; | 
| 56 | |
| 57 | void sendLogicalPosition(const QPoint &position); | 
| 58 | void sendLogicalSize(const QSize &size); | 
| 59 | void sendDone(); | 
| 60 | |
| 61 | void setManager(QWaylandXdgOutputManagerV1 *manager); | 
| 62 | void setOutput(QWaylandOutput *output); | 
| 63 | |
| 64 | static QWaylandXdgOutputV1Private *get(QWaylandXdgOutputV1 *xdgOutput) { return xdgOutput ? xdgOutput->d_func() : nullptr; } | 
| 65 | |
| 66 | bool initialized = false; | 
| 67 | QWaylandOutput *output = nullptr; | 
| 68 | QWaylandXdgOutputManagerV1 *manager = nullptr; | 
| 69 | QPoint logicalPos; | 
| 70 | QSize logicalSize; | 
| 71 | QString name; | 
| 72 | QString description; | 
| 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 | 
