Adjust to KDecoration init API returning a bool

Will allow a fallback to client-side decoration when KDecoration init fails.
This commit is contained in:
Kai Uwe Broulik 2023-10-21 17:49:19 +02:00
parent 7e692c9cf0
commit 3eb90b2c60
3 changed files with 7 additions and 6 deletions

View file

@ -30,7 +30,7 @@ public:
}
public Q_SLOTS:
void init() override
bool init() override
{
const int shadowSize = 128;
const int offsetTop = 64;
@ -52,6 +52,7 @@ public Q_SLOTS:
decoShadow->setShadow(shadowTexture);
setShadow(decoShadow);
return true;
}
};

View file

@ -239,10 +239,9 @@ Decoration::~Decoration()
Helper::instance().unref();
}
void Decoration::init()
bool Decoration::init()
{
Helper::instance().rootContext()->setContextProperty(QStringLiteral("decorationSettings"), settings().get());
KDecoration2::Decoration::init();
auto s = settings();
connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::configChanged);
@ -250,7 +249,7 @@ void Decoration::init()
m_qmlContext->setContextProperty(QStringLiteral("decoration"), this);
auto component = Helper::instance().component(m_themeName);
if (!component) {
return;
return false;
}
if (component == Helper::instance().svgComponent()) {
// load SVG theme
@ -281,7 +280,7 @@ void Decoration::init()
qCWarning(AURORAE) << error;
}
}
return;
return false;
}
QVariant visualParent = property("visualParent");
@ -353,6 +352,7 @@ void Decoration::init()
setShadow(s);
}
}
return true;
}
QVariant Decoration::readConfig(const QString &key, const QVariant &defaultValue)

View file

@ -44,7 +44,7 @@ public:
QQuickItem *item() const;
public Q_SLOTS:
void init() override;
bool init() override;
void installTitleItem(QQuickItem *item);
void updateShadow();