| 1 | // Copyright (C) 2018 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only | 
| 3 | |
| 4 | #ifndef QWAYLANDXDGDECORATIONV1_P_H | 
| 5 | #define QWAYLANDXDGDECORATIONV1_P_H | 
| 6 | |
| 7 | #include "qwaylandxdgdecorationv1.h" | 
| 8 | |
| 9 | #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> | 
| 10 | #include <QtWaylandCompositor/private/qwayland-server-xdg-decoration-unstable-v1.h> | 
| 11 | |
| 12 | #include <QtWaylandCompositor/QWaylandXdgToplevel> | 
| 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 QWaylandXdgToplevel; | 
| 28 | |
| 29 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgDecorationManagerV1Private | 
| 30 | : public QWaylandCompositorExtensionPrivate | 
| 31 | , public QtWaylandServer::zxdg_decoration_manager_v1 | 
| 32 | { | 
| 33 | Q_DECLARE_PUBLIC(QWaylandXdgDecorationManagerV1) | 
| 34 | public: | 
| 35 | using DecorationMode = QWaylandXdgToplevel::DecorationMode; | 
| 36 | explicit QWaylandXdgDecorationManagerV1Private() {} | 
| 37 | |
| 38 | protected: | 
| 39 | void zxdg_decoration_manager_v1_get_toplevel_decoration(Resource *resource, uint id, ::wl_resource *toplevelResource) override; | 
| 40 | |
| 41 | private: | 
| 42 | DecorationMode m_preferredMode = DecorationMode::ClientSideDecoration; | 
| 43 | }; | 
| 44 | |
| 45 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandXdgToplevelDecorationV1 | 
| 46 | : public QtWaylandServer::zxdg_toplevel_decoration_v1 | 
| 47 | { | 
| 48 | public: | 
| 49 | using DecorationMode = QWaylandXdgToplevel::DecorationMode; | 
| 50 | explicit QWaylandXdgToplevelDecorationV1(QWaylandXdgToplevel *toplevel, | 
| 51 | QWaylandXdgDecorationManagerV1 *manager, | 
| 52 | wl_client *client, int id); | 
| 53 | ~QWaylandXdgToplevelDecorationV1() override; | 
| 54 | |
| 55 | DecorationMode configuredMode() const { return DecorationMode(m_configuredMode); } | 
| 56 | void sendConfigure(DecorationMode mode); | 
| 57 | |
| 58 | protected: | 
| 59 | void zxdg_toplevel_decoration_v1_destroy_resource(Resource *resource) override; | 
| 60 | void zxdg_toplevel_decoration_v1_destroy(Resource *resource) override; | 
| 61 | void zxdg_toplevel_decoration_v1_set_mode(Resource *resource, uint32_t mode) override; | 
| 62 | void zxdg_toplevel_decoration_v1_unset_mode(Resource *resource) override; | 
| 63 | |
| 64 | private: | 
| 65 | void handleClientPreferredModeChanged(); | 
| 66 | |
| 67 | QWaylandXdgToplevel *m_toplevel = nullptr; | 
| 68 | QWaylandXdgDecorationManagerV1 *m_manager = nullptr; | 
| 69 | uint m_configuredMode = 0; | 
| 70 | uint m_clientPreferredMode = 0; | 
| 71 | }; | 
| 72 | |
| 73 | QT_END_NAMESPACE | 
| 74 | |
| 75 | #endif // QWAYLANDXDGDECORATIONV1_P_H | 
| 76 | 
