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
40 static QWaylandSurface *fromWlSurface(::wl_surface *surface);
41
42signals:
43 void screensChanged();
44
45private slots:
46 void handleScreenRemoved(QScreen *qScreen);
47
48protected:
49 void surface_enter(struct ::wl_output *output) override;
50 void surface_leave(struct ::wl_output *output) override;
51
52 QList<QWaylandScreen *> m_screens; //As seen by wl_surface.enter/leave events. Chronological order.
53 QWaylandWindow *m_window = nullptr;
54
55 friend class QWaylandWindow; // TODO: shouldn't need to be friends
56};
57
58} // namespace QtWaylandClient
59
60QT_END_NAMESPACE
61
62#endif // QWAYLANDSURFACE_P_H
63

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