Commit 608762c7 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

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.
parent be01a1e4
......@@ -36,9 +36,10 @@ PWFrameBufferPlugin::~PWFrameBufferPlugin()
{
}
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id)
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
{
//NOTE WId is irrelevant in Wayland
auto pwfb = new PWFrameBuffer(id);
// sanity check for dbus/wayland/pipewire errors
......
......@@ -35,7 +35,7 @@ public:
PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
virtual ~PWFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override;
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private:
Q_DISABLE_COPY(PWFrameBufferPlugin)
......
......@@ -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);
}
......
......@@ -35,7 +35,7 @@ public:
QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
~QtFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override;
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private:
Q_DISABLE_COPY(QtFrameBufferPlugin)
......
......@@ -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);
}
......
......@@ -35,7 +35,7 @@ public:
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
~XCBFrameBufferPlugin() override;
FrameBuffer *frameBuffer(WId id) override;
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
private:
Q_DISABLE_COPY(XCBFrameBufferPlugin)
......
......@@ -93,7 +93,7 @@ void FrameBufferManager::loadPlugins()
}
}
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVariantMap &args)
{
//qDebug();
......@@ -118,7 +118,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id)
if (iter.key() == 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) {
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
......
......@@ -45,7 +45,7 @@ public:
~FrameBufferManager() override;
QSharedPointer<FrameBuffer> frameBuffer(WId id);
QSharedPointer<FrameBuffer> frameBuffer(WId id, const QVariantMap &args);
private:
Q_DISABLE_COPY(FrameBufferManager)
......
......@@ -37,7 +37,7 @@ public:
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
~FrameBufferPlugin() override;
virtual FrameBuffer *frameBuffer(WId id) = 0;
virtual FrameBuffer *frameBuffer(WId id, const QVariantMap &args) = 0;
};
#endif // Header guard
......
......@@ -120,11 +120,12 @@ QSharedPointer<FrameBuffer> RfbServerManager::framebuffer() const
return d->fb;
}
QVariantMap RfbServerManager::s_pluginArgs;
void RfbServerManager::init()
{
//qDebug();
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId());
d->fb = FrameBufferManager::instance()->frameBuffer(QApplication::desktop()->winId(), s_pluginArgs);
d->myCursor = rfbMakeXCursor(19, 19, (char *) cur, (char *) mask);
d->myCursor->cleanup = false;
d->desktopName = QStringLiteral("%1@%2 (shared desktop)") //FIXME check if we can use utf8
......
......@@ -23,6 +23,7 @@
#include "rfb.h"
#include "framebuffer.h"
#include <QObject>
#include <QVariantMap>
class RfbClient;
struct RfbServerManagerStatic;
......@@ -35,6 +36,7 @@ public:
static RfbServerManager *instance();
QSharedPointer<FrameBuffer> framebuffer() const;
static QVariantMap s_pluginArgs;
Q_SIGNALS:
void clientConnected(RfbClient *cc);
void clientDisconnected(RfbClient *cc);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment