1
0
mirror of https://github.com/KDE/krfb synced 2026-07-01 07:41:17 -07:00

Allow passing plugin backends some arguments

WId is irrelevant on Wayland and it doesn't fully describe everything we
might be doing, we can pass a variant map to make sure all necessary
information is provided.
This commit is contained in:
Aleix Pol
2021-10-14 15:53:33 +02:00
committed by Aleix Pol Gonzalez
parent be01a1e42b
commit 608762c7ac
11 changed files with 19 additions and 13 deletions

View File

@@ -36,9 +36,10 @@ PWFrameBufferPlugin::~PWFrameBufferPlugin()
{ {
} }
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id)
{ {
//NOTE WId is irrelevant in Wayland
auto pwfb = new PWFrameBuffer(id); auto pwfb = new PWFrameBuffer(id);
// sanity check for dbus/wayland/pipewire errors // sanity check for dbus/wayland/pipewire errors

View File

@@ -35,7 +35,7 @@ public:
PWFrameBufferPlugin(QObject *parent, const QVariantList &args); PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
virtual ~PWFrameBufferPlugin() override; virtual ~PWFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override; FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private: private:
Q_DISABLE_COPY(PWFrameBufferPlugin) Q_DISABLE_COPY(PWFrameBufferPlugin)

View File

@@ -36,8 +36,9 @@ QtFrameBufferPlugin::~QtFrameBufferPlugin()
{ {
} }
FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id) FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
{ {
Q_UNUSED(args);
return new QtFrameBuffer(id); return new QtFrameBuffer(id);
} }

View File

@@ -35,7 +35,7 @@ public:
QtFrameBufferPlugin(QObject *parent, const QVariantList &args); QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
~QtFrameBufferPlugin() override; ~QtFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override; FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private: private:
Q_DISABLE_COPY(QtFrameBufferPlugin) Q_DISABLE_COPY(QtFrameBufferPlugin)

View File

@@ -37,8 +37,9 @@ XCBFrameBufferPlugin::~XCBFrameBufferPlugin()
} }
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id) FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
{ {
Q_UNUSED(args);
return new XCBFrameBuffer(id); return new XCBFrameBuffer(id);
} }

View File

@@ -35,7 +35,7 @@ public:
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args); XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
~XCBFrameBufferPlugin() override; ~XCBFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override; FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private: private:
Q_DISABLE_COPY(XCBFrameBufferPlugin) Q_DISABLE_COPY(XCBFrameBufferPlugin)

View File

@@ -93,7 +93,7 @@ void FrameBufferManager::loadPlugins()
} }
} }
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id) QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVariantMap &args)
{ {
//qDebug(); //qDebug();
@@ -118,7 +118,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) { if (iter.key() == KrfbConfig::preferredFrameBufferPlugin()) {
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin(); qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id)); QSharedPointer<FrameBuffer> frameBuffer(iter.value()->frameBuffer(id, args));
if (frameBuffer) { if (frameBuffer) {
m_frameBuffers.insert(id, frameBuffer.toWeakRef()); m_frameBuffers.insert(id, frameBuffer.toWeakRef());

View File

@@ -45,7 +45,7 @@ public:
~FrameBufferManager() override; ~FrameBufferManager() override;
QSharedPointer<FrameBuffer> frameBuffer(WId id); QSharedPointer<FrameBuffer> frameBuffer(WId id, const QVariantMap &args);
private: private:
Q_DISABLE_COPY(FrameBufferManager) Q_DISABLE_COPY(FrameBufferManager)

View File

@@ -37,7 +37,7 @@ public:
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args); explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
~FrameBufferPlugin() override; ~FrameBufferPlugin() override;
virtual FrameBuffer *frameBuffer(WId id) = 0; virtual FrameBuffer *frameBuffer(WId id, const QVariantMap &args) = 0;
}; };
#endif // Header guard #endif // Header guard

View File

@@ -120,11 +120,12 @@ QSharedPointer<FrameBuffer> RfbServerManager::framebuffer() const
return d->fb; return d->fb;
} }
QVariantMap RfbServerManager::s_pluginArgs;
void RfbServerManager::init() void RfbServerManager::init()
{ {
//qDebug(); //qDebug();
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId(), s_pluginArgs);
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask); d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
d->myCursor->cleanup = false; d->myCursor->cleanup = false;
d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8 d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8

View File

@@ -23,6 +23,7 @@
#include "rfb.h" #include "rfb.h"
#include "framebuffer.h" #include "framebuffer.h"
#include <QObject> #include <QObject>
#include <QVariantMap>
class RfbClient; class RfbClient;
struct RfbServerManagerStatic; struct RfbServerManagerStatic;
@@ -35,6 +36,7 @@ public:
static RfbServerManager *instance(); static RfbServerManager *instance();
QSharedPointer<FrameBuffer> framebuffer() const; QSharedPointer<FrameBuffer> framebuffer() const;
static QVariantMap s_pluginArgs;
Q_SIGNALS: Q_SIGNALS:
void clientConnected(RfbClient *cc); void clientConnected(RfbClient *cc);
void clientDisconnected(RfbClient *cc); void clientDisconnected(RfbClient *cc);