1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef QWLBUFFERMANAGER_H
5#define QWLBUFFERMANAGER_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/QObject>
19#include <QtCore/QHash>
20#include "qwlclientbuffer_p.h"
21QT_BEGIN_NAMESPACE
22
23class QWaylandCompositor;
24
25namespace QtWayland {
26
27class ClientBuffer;
28
29class Q_WAYLANDCOMPOSITOR_EXPORT BufferManager : public QObject
30{
31public:
32 BufferManager(QWaylandCompositor *compositor);
33 ClientBuffer *getBuffer(struct ::wl_resource *buffer_resource);
34 void registerBuffer(struct ::wl_resource *buffer_resource, ClientBuffer *clientBuffer);
35private:
36 friend struct buffer_manager_destroy_listener;
37 static void destroy_listener_callback(wl_listener *listener, void *data);
38
39 QHash<struct ::wl_resource *, ClientBuffer*> m_buffers;
40 QWaylandCompositor *m_compositor = nullptr;
41};
42
43}
44QT_END_NAMESPACE
45
46#endif // QWLBUFFERMANAGER_H
47

source code of qtwayland/src/compositor/wayland_wrapper/qwlbuffermanager_p.h