don't delete and recreate wallpaperinterface if not needed

Summary:
the wallpaperinterface instance already reacts to wallpaper package
change and loads the current one.
containemtninterface deleted it every time the wallpaper changed
and recreated, effectively loading the wallpaper two times every time
the plugin was changed

Test Plan: switching plugins still works, but it's actually visible faster on slow hardware

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D25217
This commit is contained in:
Marco Martin 2019-11-08 16:13:46 +01:00
parent 000022b668
commit b58d7c7752

View File

@ -851,10 +851,9 @@ void ContainmentInterface::loadWallpaper()
return;
}
if (!m_containment->wallpaper().isEmpty()) {
delete m_wallpaperInterface;
if (!m_wallpaperInterface && !m_containment->wallpaper().isEmpty()) {
m_wallpaperInterface = new WallpaperInterface(this);
m_wallpaperInterface->setZ(-1000);
//Qml seems happier if the parent gets set in this way
m_wallpaperInterface->setProperty("parent", QVariant::fromValue(this));
@ -867,11 +866,9 @@ void ContainmentInterface::loadWallpaper()
prop.write(expr.evaluate());
m_containment->setProperty("wallpaperGraphicsObject", QVariant::fromValue(m_wallpaperInterface));
} else {
if (m_wallpaperInterface) {
m_wallpaperInterface->deleteLater();
m_wallpaperInterface = nullptr;
}
} else if (m_wallpaperInterface && m_containment->wallpaper().isEmpty()) {
m_wallpaperInterface->deleteLater();
m_wallpaperInterface = nullptr;
}
}