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 43 44 45 46 47 48 49 50 51 52 53
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef SHAREBUFFEREXTENSION_H
#define SHAREBUFFEREXTENSION_H
#include "wayland-util.h"
#include <QtCore/QMap>
#include <QtWaylandCompositor/QWaylandCompositorExtensionTemplate>
#include <QtWaylandCompositor/QWaylandQuickExtension>
#include <QtWaylandCompositor/QWaylandCompositor>
#include <QtWaylandCompositor/private/qwaylandcompositor_p.h>
#include <QtWaylandCompositor/private/qwlserverbufferintegration_p.h>
#include "qwayland-server-share-buffer.h"
QT_BEGIN_NAMESPACE
namespace QtWayland
{
class ServerBufferIntegration;
};
class ShareBufferExtension : public QWaylandCompositorExtensionTemplate<ShareBufferExtension>
, public QtWaylandServer::qt_share_buffer
{
Q_OBJECT
public:
ShareBufferExtension(QWaylandCompositor *compositor = nullptr);
void initialize() override;
protected slots:
QtWayland::ServerBuffer *addImage(const QImage &image);
protected:
void share_buffer_bind_resource(Resource *resource) override;
private:
void createServerBuffers();
QList<QtWayland::ServerBuffer *> m_server_buffers;
QtWayland::ServerBufferIntegration *m_server_buffer_integration = nullptr;
bool m_server_buffers_created = false;
};
Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(ShareBufferExtension)
QT_END_NAMESPACE
#endif // SHAREBUFFEREXTENSION_H
|