| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org> |
| 3 | SPDX-FileCopyrightText: 2023 David Redondo <kde@david-redondo.de> |
| 4 | |
| 5 | SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include "logging.h" |
| 11 | |
| 12 | #include <qwayland-wayland.h> |
| 13 | |
| 14 | #include <QSize> |
| 15 | #include <QWaylandClientExtensionTemplate> |
| 16 | |
| 17 | #include <memory> |
| 18 | |
| 19 | class ShmBuffer : public QtWayland::wl_buffer |
| 20 | { |
| 21 | public: |
| 22 | ShmBuffer(::wl_buffer *buffer); |
| 23 | ~ShmBuffer(); |
| 24 | }; |
| 25 | |
| 26 | class Shm : public QWaylandClientExtensionTemplate<Shm>, public QtWayland::wl_shm |
| 27 | { |
| 28 | public: |
| 29 | static Shm *instance(); |
| 30 | ~Shm(); |
| 31 | std::unique_ptr<ShmBuffer> createBuffer(const QImage &image); |
| 32 | |
| 33 | private: |
| 34 | Shm(QObject *parent); |
| 35 | }; |
| 36 | |