libkwineffects: Make parent optional in OffscreenQuickView

The parent argument is redundant if the view is managed with a smart
pointer.
master
Vlad Zahorodnii 11 months ago
parent 1ca4c23db1
commit 98eecafe29

@ -60,12 +60,12 @@ public:
* Construct a new KWinQuickView
* Export mode will be determined by the current effectsHandler
*/
OffscreenQuickView(QObject *parent);
explicit OffscreenQuickView(QObject *parent = nullptr);
/**
* Construct a new KWinQuickView explicitly stating an export mode
*/
OffscreenQuickView(ExportMode exportMode, QObject *parent);
explicit OffscreenQuickView(ExportMode exportMode, QObject *parent = nullptr);
/**
* Note that this may change the current GL Context
@ -164,8 +164,8 @@ private:
class KWINEFFECTS_EXPORT OffscreenQuickScene : public OffscreenQuickView
{
public:
OffscreenQuickScene(QObject *parent);
OffscreenQuickScene(ExportMode exportMode, QObject *parent);
explicit OffscreenQuickScene(QObject *parent = nullptr);
explicit OffscreenQuickScene(ExportMode exportMode, QObject *parent = nullptr);
~OffscreenQuickScene();
/** top level item in the given source*/

@ -288,7 +288,7 @@ bool Decoration::init()
m_item->setParentItem(visualParent.value<QQuickItem *>());
visualParent.value<QQuickItem *>()->setProperty("drawBackground", false);
} else {
m_view = std::make_unique<KWin::OffscreenQuickView>(KWin::OffscreenQuickView::ExportMode::Image, this);
m_view = std::make_unique<KWin::OffscreenQuickView>(KWin::OffscreenQuickView::ExportMode::Image);
m_item->setParentItem(m_view->contentItem());
auto updateSize = [this]() {
m_item->setSize(m_view->contentItem()->size());

@ -69,7 +69,7 @@ void ShowFpsEffect::prePaintScreen(ScreenPrePaintData &data, std::chrono::millis
}
if (!m_scene) {
m_scene = std::make_unique<OffscreenQuickScene>(nullptr);
m_scene = std::make_unique<OffscreenQuickScene>();
const auto url = QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/showfps/qml/main.qml")));
m_scene->setSource(url, {{QStringLiteral("effect"), QVariant::fromValue(this)}});
}

Loading…
Cancel
Save