Commit 7af241ba authored by Mikhail Zolotukhin's avatar Mikhail Zolotukhin

Disable global animations for the time decoration is being rendered

For the short period of time we disable the animation for various
effects that can occur when decoration is being rendered to file.

This should prevent the decoration to render itself at the beginning
of the animation (i.e. first "frame").

BUG: 426687
parent 60641a0d
......@@ -29,7 +29,6 @@ namespace KDecoration2
DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QObject *parent)
: DecorationBridge(parent)
, m_decorationsConfigFileName()
, m_wereAnimationsEnabled()
, m_loader()
, m_factory()
, m_decoration()
......@@ -69,7 +68,6 @@ DummyDecorationBridge::DummyDecorationBridge(const QString &decorationTheme, QOb
DummyDecorationBridge::~DummyDecorationBridge()
{
m_loader->unload();
enableAnimationsIfTheyWereEnabled();
}
std::unique_ptr< KDecoration2::DecorationSettingsPrivate > DummyDecorationBridge::settings(KDecoration2::DecorationSettings *parent)
......@@ -143,19 +141,14 @@ void DummyDecorationBridge::disableAnimations()
KSharedConfig::Ptr decorationConfig = KSharedConfig::openConfig(m_decorationsConfigFileName, KConfig::NoGlobals);
if (decorationConfig) {
KConfigGroup group = decorationConfig->group(QStringLiteral("Windeco"));
m_wereAnimationsEnabled = group.readEntry(QStringLiteral("AnimationsEnabled"), true);
group.writeEntry(QStringLiteral("AnimationsEnabled"), false);
group.sync();
group.writeEntry(QStringLiteral("AnimationsEnabled"), false, KConfig::WriteConfigFlags());
}
}
void DummyDecorationBridge::enableAnimationsIfTheyWereEnabled()
{
KSharedConfig::Ptr decorationConfig = KSharedConfig::openConfig(m_decorationsConfigFileName, KConfig::NoGlobals);
if (decorationConfig) {
KConfigGroup group = decorationConfig->group(QStringLiteral("Windeco"));
group.writeEntry(QStringLiteral("AnimationsEnabled"), m_wereAnimationsEnabled);
group.sync();
// In case decoration is using global animation settings
KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig();
if (globalConfig) {
auto group = globalConfig->group(QStringLiteral("KDE"));
group.writeEntry(QStringLiteral("AnimationDurationFactor"), 0, KConfig::WriteConfigFlags());
}
}
......
......@@ -40,7 +40,6 @@ public:
private:
void disableAnimations();
void enableAnimationsIfTheyWereEnabled();
QString windowDecorationPluginPath(const QString &decorationTheme) const;
......@@ -50,7 +49,6 @@ private:
KDecoration2::DecorationButtonType strToButtonType(const QString &type) const;
QString m_decorationsConfigFileName;
bool m_wereAnimationsEnabled;
std::unique_ptr<KPluginLoader> m_loader;
KPluginFactory *m_factory;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment