libkwineffects: Make parent optional in OffscreenQuickView

The parent argument is redundant if the view is managed with a smart
pointer.
This commit is contained in:
Vlad Zahorodnii 2023-10-23 15:57:00 +03:00
parent 1ca4c23db1
commit 98eecafe29
3 changed files with 6 additions and 6 deletions

View file

@ -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*/

View file

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

View file

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