1// Copyright (C) 2018 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 QWAYLANDSUBSURFACE_H
5#define QWAYLANDSUBSURFACE_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 <QtCore/private/qglobal_p.h>
19#include <QtCore/qmutex.h>
20
21#include <QtWaylandClient/qtwaylandclientglobal.h>
22#include <QtWaylandClient/private/qwayland-wayland.h>
23
24QT_BEGIN_NAMESPACE
25
26namespace QtWaylandClient {
27
28class QWaylandDisplay;
29class QWaylandWindow;
30
31class Q_WAYLANDCLIENT_EXPORT QWaylandSubSurface : public QtWayland::wl_subsurface
32{
33public:
34 QWaylandSubSurface(QWaylandWindow *window, QWaylandWindow *parent, ::wl_subsurface *subsurface);
35 ~QWaylandSubSurface() override;
36
37 QWaylandWindow *window() const { return m_window; }
38 QWaylandWindow *parent() const { return m_parent; }
39
40 void setSync();
41 void setDeSync();
42 bool isSync() const { return m_synchronized; }
43 QMutex *syncMutex() { return &m_syncLock; }
44
45private:
46
47 // Intentionally hide public methods from ::wl_subsurface
48 // to keep track of the sync state
49 void set_sync();
50 void set_desync();
51 QWaylandWindow *m_window = nullptr;
52 QWaylandWindow *m_parent = nullptr;
53 bool m_synchronized = false;
54 QMutex m_syncLock;
55
56};
57
58QT_END_NAMESPACE
59
60}
61
62#endif // QWAYLANDSUBSURFACE_H
63

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