1// Copyright (C) 2017 The Qt Company Ltd.
2// Copyright (C) 2017 Giulio Camuffo.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qwaylandbuffer_p.h"
6
7#include <QDebug>
8
9QT_BEGIN_NAMESPACE
10
11namespace QtWaylandClient {
12
13QWaylandBuffer::QWaylandBuffer()
14{
15}
16
17QWaylandBuffer::~QWaylandBuffer()
18{
19 if (mBuffer)
20 wl_buffer_destroy(mBuffer);
21}
22
23void QWaylandBuffer::init(wl_buffer *buf)
24{
25 mBuffer = buf;
26 wl_buffer_add_listener(buf, &listener, this);
27}
28
29void QWaylandBuffer::release(void *data, wl_buffer *)
30{
31 QWaylandBuffer *self = static_cast<QWaylandBuffer *>(data);
32 self->mBusy = false;
33 self->mCommitted = false;
34}
35
36const wl_buffer_listener QWaylandBuffer::listener = {
37 QWaylandBuffer::release
38};
39
40}
41
42QT_END_NAMESPACE
43

source code of qtwayland/src/client/qwaylandbuffer.cpp