1 | // Copyright (C) 2018 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDVIEWPORTER_P_H |
5 | #define QWAYLANDVIEWPORTER_P_H |
6 | |
7 | #include "qwaylandviewporter.h" |
8 | |
9 | #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> |
10 | #include <QtWaylandCompositor/private/qwayland-server-viewporter.h> |
11 | |
12 | #include <QtCore/qpointer.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 QWaylandSurface; |
28 | |
29 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandViewporterPrivate |
30 | : public QWaylandCompositorExtensionPrivate |
31 | , public QtWaylandServer::wp_viewporter |
32 | { |
33 | Q_DECLARE_PUBLIC(QWaylandViewporter) |
34 | public: |
35 | explicit QWaylandViewporterPrivate() = default; |
36 | |
37 | class Q_WAYLANDCOMPOSITOR_EXPORT Viewport |
38 | : public QtWaylandServer::wp_viewport |
39 | { |
40 | public: |
41 | explicit Viewport(QWaylandSurface *surface, wl_client *client, int id); |
42 | ~Viewport() override; |
43 | void checkCommittedState(); |
44 | |
45 | protected: |
46 | void wp_viewport_destroy_resource(Resource *resource) override; |
47 | void wp_viewport_destroy(Resource *resource) override; |
48 | void wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override; |
49 | void wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height) override; |
50 | |
51 | private: |
52 | QPointer<QWaylandSurface> m_surface = nullptr; |
53 | }; |
54 | |
55 | protected: |
56 | void wp_viewporter_destroy(Resource *resource) override; |
57 | void wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override; |
58 | }; |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QWAYLANDVIEWPORTER_P_H |
63 | |