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 QWAYLANDBUFFER_H |
5 | #define QWAYLANDBUFFER_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 <QtWaylandClient/qtwaylandclientglobal.h> |
19 | |
20 | #include <QtCore/QSize> |
21 | #include <QtCore/QRect> |
22 | |
23 | #include <QtWaylandClient/private/wayland-wayland-client-protocol.h> |
24 | #include <QtCore/private/qglobal_p.h> |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | namespace QtWaylandClient { |
29 | |
30 | class Q_WAYLANDCLIENT_EXPORT QWaylandBuffer { |
31 | public: |
32 | QWaylandBuffer(); |
33 | virtual ~QWaylandBuffer(); |
34 | void init(wl_buffer *buf); |
35 | |
36 | wl_buffer *buffer() {return mBuffer;} |
37 | virtual QSize size() const = 0; |
38 | virtual int scale() const { return 1; } |
39 | |
40 | void setBusy(bool busy) { mBusy = busy; } |
41 | bool busy() const { return mBusy; } |
42 | |
43 | void setCommitted() { mCommitted = true; } |
44 | bool committed() const { return mCommitted; } |
45 | |
46 | protected: |
47 | struct wl_buffer *mBuffer = nullptr; |
48 | |
49 | private: |
50 | bool mBusy = false; |
51 | bool mCommitted = false; |
52 | |
53 | static void release(void *data, wl_buffer *); |
54 | static const wl_buffer_listener listener; |
55 | }; |
56 | |
57 | } |
58 | |
59 | QT_END_NAMESPACE |
60 | |
61 | #endif // QWAYLANDBUFFER_H |
62 | |