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:
Nicolas Fella
2022-08-03 22:00:16 +02:00
parent 5173e7ff29
commit 4169a9f50a
16 changed files with 27 additions and 26 deletions

View File

@@ -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;

View File

@@ -30,7 +30,7 @@ public:
};
using Streams = QList<Stream>;
PWFrameBuffer(WId winid, QObject *parent = nullptr);
PWFrameBuffer(QObject *parent = nullptr);
virtual ~PWFrameBuffer() override;
void initDBus();

View File

@@ -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 {

View File

@@ -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)

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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"

View File

@@ -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)

View File

@@ -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;

View File

@@ -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:

View File

@@ -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"

View File

@@ -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)