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//
13// W A R N I N G
14// -------------
15//
16// This file is not part of the Qt API. It exists purely as an
17// implementation detail. This header file may change from version to
18// version without notice, or even be removed.
19//
20// We mean it.
21//
22
23QT_BEGIN_NAMESPACE
24
25class QWaylandSurface;
26
27class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandViewporterPrivate
28 : public QWaylandCompositorExtensionPrivate
29 , public QtWaylandServer::wp_viewporter
30{
31 Q_DECLARE_PUBLIC(QWaylandViewporter)
32public:
33 explicit QWaylandViewporterPrivate() = default;
34
35 class Q_WAYLANDCOMPOSITOR_EXPORT Viewport
36 : public QtWaylandServer::wp_viewport
37 {
38 public:
39 explicit Viewport(QWaylandSurface *surface, wl_client *client, int id);
40 ~Viewport() override;
41 void checkCommittedState();
42
43 protected:
44 void wp_viewport_destroy_resource(Resource *resource) override;
45 void wp_viewport_destroy(Resource *resource) override;
46 void wp_viewport_set_source(Resource *resource, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height) override;
47 void wp_viewport_set_destination(Resource *resource, int32_t width, int32_t height) override;
48
49 private:
50 QPointer<QWaylandSurface> m_surface = nullptr;
51 };
52
53protected:
54 void wp_viewporter_destroy(Resource *resource) override;
55 void wp_viewporter_get_viewport(Resource *resource, uint32_t id, wl_resource *surface) override;
56};
57
58QT_END_NAMESPACE
59
60#endif // QWAYLANDVIEWPORTER_P_H
61

source code of qtwayland/src/compositor/extensions/qwaylandviewporter_p.h