1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWAYLANDSURFACE_P_H
5#define QWAYLANDSURFACE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtGui/QScreen>
19
20#include <QtWaylandClient/private/qwayland-wayland.h>
21#include <QtCore/private/qglobal_p.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace QtWaylandClient {
26
27class QWaylandScreen;
28class QWaylandWindow;
29class QWaylandDisplay;
30
31class QWaylandSurface : public QObject, public QtWayland::wl_surface
32{
33 Q_OBJECT
34public:
35 explicit QWaylandSurface(QWaylandDisplay *display);
36 ~QWaylandSurface() override;
37 QWaylandScreen *oldestEnteredScreen();
38 QWaylandWindow *waylandWindow() const { return m_window; }
39 std::optional<int32_t> preferredBufferScale() const { return m_preferredBufferScale; }
40 std::optional<wl_output_transform> preferredBufferTransform() const { return m_preferredBufferTransform; }
41
42 static QWaylandSurface *fromWlSurface(::wl_surface *surface);
43
44Q_SIGNALS:
45 void screensChanged();
46 void preferredBufferScaleChanged();
47 void preferredBufferTransformChanged();
48
49private Q_SLOTS:
50 void handleScreenRemoved(QScreen *qScreen);
51
52protected:
53 void surface_enter(struct ::wl_output *output) override;
54 void surface_leave(struct ::wl_output *output) override;
55 void surface_preferred_buffer_scale(int32_t scale) override;
56 void surface_preferred_buffer_transform(uint32_t transform) override;
57
58 QList<QWaylandScreen *> m_screens; //As seen by wl_surface.enter/leave events. Chronological order.
59 QWaylandWindow *m_window = nullptr;
60 std::optional<int32_t> m_preferredBufferScale;
61 std::optional<wl_output_transform> m_preferredBufferTransform;
62
63 friend class QWaylandWindow; // TODO: shouldn't need to be friends
64};
65
66} // namespace QtWaylandClient
67
68QT_END_NAMESPACE
69
70#endif // QWAYLANDSURFACE_P_H
71

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtwayland/src/client/qwaylandsurface_p.h