summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandbuffer.cpp
blob: 1907d586487f2bf271a0548c3e8dc06b353cbd6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (C) 2017 The Qt Company Ltd.
// Copyright (C) 2017 Giulio Camuffo.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#include "qwaylandbuffer_p.h"

#include <QDebug>

QT_BEGIN_NAMESPACE

namespace QtWaylandClient {

QWaylandBuffer::QWaylandBuffer()
{
}

QWaylandBuffer::~QWaylandBuffer()
{
    if (mBuffer)
        wl_buffer_destroy(mBuffer);
}

void QWaylandBuffer::init(wl_buffer *buf)
{
    mBuffer = buf;
    wl_buffer_add_listener(buf, &listener, this);
}

void QWaylandBuffer::release(void *data, wl_buffer *)
{
    QWaylandBuffer *self = static_cast<QWaylandBuffer *>(data);
    self->mBusy = false;
    self->mCommitted = false;
}

const wl_buffer_listener QWaylandBuffer::listener = {
    QWaylandBuffer::release
};

}

QT_END_NAMESPACE