Avoid destroying effects if animation speed changes

It makes little sense to destroy effects if the animation speed changes.
The effects are written with the assumption that the animation time can
change and therefore they handle this case in reconfigure().
master
Vlad Zahorodnii 11 months ago
parent f22da5f62a
commit 49b84ddf8c

@ -42,7 +42,6 @@ Compositor::Compositor(QObject *workspace)
: QObject(workspace)
{
connect(options, &Options::configChanged, this, &Compositor::configChanged);
connect(options, &Options::animationSpeedChanged, this, &Compositor::configChanged);
// 2 sec which should be enough to restart the compositor.
static const int compositorLostMessageDelay = 2000;

@ -140,6 +140,8 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, WorkspaceScene *s
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject(QStringLiteral("/Effects"), this);
connect(options, &Options::animationSpeedChanged, this, &EffectsHandlerImpl::reconfigureEffects);
Workspace *ws = Workspace::self();
VirtualDesktopManager *vds = VirtualDesktopManager::self();
connect(ws, &Workspace::showingDesktopChanged, this, [this](bool showing, bool animated) {
@ -1240,6 +1242,14 @@ void EffectsHandlerImpl::destroyEffect(Effect *effect)
delete effect;
}
void EffectsHandlerImpl::reconfigureEffects()
{
makeOpenGLContextCurrent();
for (const EffectPair &pair : loaded_effects) {
pair.second->reconfigure(Effect::ReconfigureAll);
}
}
void EffectsHandlerImpl::reconfigureEffect(const QString &name)
{
for (QList<EffectPair>::const_iterator it = loaded_effects.constBegin(); it != loaded_effects.constEnd(); ++it) {

@ -304,6 +304,7 @@ protected:
private:
void registerPropertyType(long atom, bool reg);
void destroyEffect(Effect *effect);
void reconfigureEffects();
typedef QList<Effect *> EffectsList;
typedef EffectsList::const_iterator EffectsIterator;

Loading…
Cancel
Save