File indexing completed on 2024-02-25 17:31:03

0001 /*
0002     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QScreen>
0011 #include <QSharedPointer>
0012 #include <QVector>
0013 #include <optional>
0014 
0015 struct zkde_screencast_unstable_v1;
0016 
0017 namespace KWayland
0018 {
0019 namespace Client
0020 {
0021 class PlasmaWindow;
0022 class Registry;
0023 class Output;
0024 }
0025 }
0026 
0027 class ScreencastingPrivate;
0028 class ScreencastingSourcePrivate;
0029 class ScreencastingStreamPrivate;
0030 class ScreencastingStream : public QObject
0031 {
0032     Q_OBJECT
0033 public:
0034     ScreencastingStream(QObject *parent);
0035     ~ScreencastingStream() override;
0036 
0037     quint32 nodeid() const;
0038     QRect geometry() const;
0039 
0040 Q_SIGNALS:
0041     void created(quint32 nodeid);
0042     void failed(const QString &error);
0043     void closed();
0044 
0045 private:
0046     friend class Screencasting;
0047     QScopedPointer<ScreencastingStreamPrivate> d;
0048 };
0049 
0050 class Screencasting : public QObject
0051 {
0052     Q_OBJECT
0053 public:
0054     explicit Screencasting(QObject *parent = nullptr);
0055     explicit Screencasting(KWayland::Client::Registry *registry, int id, int version, QObject *parent = nullptr);
0056     ~Screencasting() override;
0057 
0058     enum CursorMode {
0059         Hidden = 1,
0060         Embedded = 2,
0061         Metadata = 4,
0062     };
0063     Q_ENUM(CursorMode)
0064 
0065     ScreencastingStream *createOutputStream(KWayland::Client::Output *output, CursorMode mode);
0066     ScreencastingStream *createOutputStream(QScreen *screen, CursorMode mode);
0067     ScreencastingStream *createWindowStream(const QString &uuid, CursorMode mode);
0068     ScreencastingStream *createRegionStream(const QRect &geometry, qreal scale, CursorMode mode);
0069     ScreencastingStream *createVirtualOutputStream(const QString &name, const QSize &size, qreal scale, CursorMode mode);
0070 
0071     void setup(zkde_screencast_unstable_v1 *screencasting);
0072     void destroy();
0073 
0074 Q_SIGNALS:
0075     void removed();
0076     void sourcesChanged();
0077 
0078 private:
0079     QScopedPointer<ScreencastingPrivate> d;
0080 };