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 | |
9 | QT_BEGIN_NAMESPACE |
10 | |
11 | namespace QtWaylandClient { |
12 | |
13 | QWaylandBuffer::QWaylandBuffer() |
14 | { |
15 | } |
16 | |
17 | QWaylandBuffer::~QWaylandBuffer() |
18 | { |
19 | if (mBuffer) |
20 | wl_buffer_destroy(mBuffer); |
21 | } |
22 | |
23 | void QWaylandBuffer::init(wl_buffer *buf) |
24 | { |
25 | mBuffer = buf; |
26 | wl_buffer_add_listener(buf, &listener, this); |
27 | } |
28 | |
29 | void QWaylandBuffer::release(void *data, wl_buffer *) |
30 | { |
31 | QWaylandBuffer *self = static_cast<QWaylandBuffer *>(data); |
32 | self->mBusy = false; |
33 | self->mCommitted = false; |
34 | } |
35 | |
36 | const wl_buffer_listener QWaylandBuffer::listener = { |
37 | QWaylandBuffer::release |
38 | }; |
39 | |
40 | } |
41 | |
42 | QT_END_NAMESPACE |
43 |