mirror of
https://github.com/KDE/krfb
synced 2026-07-01 07:41:17 -07:00
Don't pass unused window ids around
The wid is only relevant for the xcb framebuffer We can just query it there, no need to pass it around everywhere
This commit is contained in:
@@ -961,8 +961,8 @@ PWFrameBuffer::Private::~Private()
|
||||
}
|
||||
}
|
||||
|
||||
PWFrameBuffer::PWFrameBuffer(WId winid, QObject *parent)
|
||||
: FrameBuffer (winid, parent),
|
||||
PWFrameBuffer::PWFrameBuffer(QObject *parent)
|
||||
: FrameBuffer (parent),
|
||||
d(new Private(this))
|
||||
{
|
||||
fb = nullptr;
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
};
|
||||
using Streams = QList<Stream>;
|
||||
|
||||
PWFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
PWFrameBuffer(QObject *parent = nullptr);
|
||||
virtual ~PWFrameBuffer() override;
|
||||
|
||||
void initDBus();
|
||||
|
||||
@@ -30,11 +30,9 @@ PWFrameBufferPlugin::PWFrameBufferPlugin(QObject *parent, const QVariantList &ar
|
||||
}
|
||||
|
||||
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *PWFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
//NOTE WId is irrelevant in Wayland
|
||||
|
||||
auto pwfb = new PWFrameBuffer(id);
|
||||
auto pwfb = new PWFrameBuffer;
|
||||
if (args.contains(QLatin1String("name"))) {
|
||||
pwfb->startVirtualMonitor(args[QStringLiteral("name")].toString(), args[QStringLiteral("resolution")].toSize(), args[QStringLiteral("scale")].toDouble());
|
||||
} else {
|
||||
|
||||
@@ -34,7 +34,7 @@ class PWFrameBufferPlugin: public FrameBufferPlugin
|
||||
public:
|
||||
PWFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(PWFrameBufferPlugin)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
const int UPDATE_TIME = 500;
|
||||
|
||||
QtFrameBuffer::QtFrameBuffer(WId id, QObject *parent)
|
||||
: FrameBuffer(id, parent)
|
||||
QtFrameBuffer::QtFrameBuffer(QObject *parent)
|
||||
: FrameBuffer(parent)
|
||||
{
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
if (screen) {
|
||||
|
||||
@@ -22,7 +22,7 @@ class QtFrameBuffer : public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QtFrameBuffer(WId id, QObject *parent = nullptr);
|
||||
explicit QtFrameBuffer(QObject *parent = nullptr);
|
||||
|
||||
~QtFrameBuffer() override;
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ QtFrameBufferPlugin::QtFrameBufferPlugin(QObject *parent, const QVariantList &ar
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *QtFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new QtFrameBuffer(id);
|
||||
return new QtFrameBuffer;
|
||||
}
|
||||
|
||||
#include "qtframebufferplugin.moc"
|
||||
|
||||
@@ -34,7 +34,7 @@ class QtFrameBufferPlugin : public FrameBufferPlugin
|
||||
public:
|
||||
QtFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtFrameBufferPlugin)
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <QX11Info>
|
||||
#include <QCoreApplication>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
@@ -130,6 +131,7 @@ public:
|
||||
bool running;
|
||||
|
||||
QRect area; // capture area, primary monitor coordinates
|
||||
WId win;
|
||||
};
|
||||
|
||||
|
||||
@@ -144,8 +146,8 @@ static xcb_screen_t *get_xcb_screen(xcb_connection_t *conn, int screen_num) {
|
||||
|
||||
|
||||
|
||||
XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
FrameBuffer(winid, parent), d(new XCBFrameBuffer::P)
|
||||
XCBFrameBuffer::XCBFrameBuffer(QObject *parent):
|
||||
FrameBuffer(parent), d(new XCBFrameBuffer::P)
|
||||
{
|
||||
d->running = false;
|
||||
d->damage = XCB_NONE;
|
||||
@@ -157,6 +159,7 @@ XCBFrameBuffer::XCBFrameBuffer(WId winid, QObject *parent):
|
||||
d->area.setRect(0, 0, 0, 0);
|
||||
d->x11EvtFilter = new KrfbXCBEventFilter(this);
|
||||
d->rootScreen = get_xcb_screen(QX11Info::connection(), QX11Info::appScreen());
|
||||
d->win = QApplication::desktop()->winId();
|
||||
|
||||
this->fb = nullptr;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class XCBFrameBuffer: public FrameBuffer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit XCBFrameBuffer(WId winid, QObject *parent = nullptr);
|
||||
explicit XCBFrameBuffer(QObject *parent = nullptr);
|
||||
~XCBFrameBuffer() override;
|
||||
|
||||
public:
|
||||
|
||||
@@ -29,10 +29,10 @@ XCBFrameBufferPlugin::XCBFrameBufferPlugin(QObject *parent, const QVariantList &
|
||||
{
|
||||
}
|
||||
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(WId id, const QVariantMap &args)
|
||||
FrameBuffer *XCBFrameBufferPlugin::frameBuffer(const QVariantMap &args)
|
||||
{
|
||||
Q_UNUSED(args);
|
||||
return new XCBFrameBuffer(id);
|
||||
return new XCBFrameBuffer;
|
||||
}
|
||||
|
||||
#include "xcb_framebufferplugin.moc"
|
||||
|
||||
@@ -34,7 +34,7 @@ class XCBFrameBufferPlugin: public FrameBufferPlugin
|
||||
public:
|
||||
XCBFrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
|
||||
FrameBuffer *frameBuffer(WId id, const QVariantMap &args) override;
|
||||
FrameBuffer *frameBuffer(const QVariantMap &args) override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(XCBFrameBufferPlugin)
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
#include <QCursor>
|
||||
|
||||
|
||||
FrameBuffer::FrameBuffer(WId id, QObject *parent)
|
||||
: QObject(parent), win(id)
|
||||
FrameBuffer::FrameBuffer(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class KRFBPRIVATE_EXPORT FrameBuffer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FrameBuffer(WId id, QObject *parent = nullptr);
|
||||
explicit FrameBuffer(QObject *parent = nullptr);
|
||||
|
||||
~FrameBuffer() override;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ QSharedPointer<FrameBuffer> FrameBufferManager::frameBuffer(WId id, const QVaria
|
||||
if (it.key() == KrfbConfig::preferredFrameBufferPlugin()) {
|
||||
qCDebug(KRFB) << "Using FrameBuffer:" << KrfbConfig::preferredFrameBufferPlugin();
|
||||
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(id, args));
|
||||
QSharedPointer<FrameBuffer> frameBuffer(it.value()->frameBuffer(args));
|
||||
if (frameBuffer) {
|
||||
m_frameBuffers.insert(id, frameBuffer.toWeakRef());
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
explicit FrameBufferPlugin(QObject *parent, const QVariantList &args);
|
||||
~FrameBufferPlugin() override;
|
||||
|
||||
virtual FrameBuffer *frameBuffer(WId id, const QVariantMap &args) = 0;
|
||||
virtual FrameBuffer *frameBuffer(const QVariantMap &args) = 0;
|
||||
};
|
||||
|
||||
#endif // Header guard
|
||||
|
||||
Reference in New Issue
Block a user