Commit e8b45cce authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[effects/cubeslide] Cancel active animation when number of desktops has changed

Summary:
If a virtual desktop is removed, then desktopChanged will be followed by
numberDesktopsChanged signal. In which case, we have to cancel the
active animation because front_desktop might be no longer valid when
it's time to perform compositing.

BUG: 406452

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21064
parent c438ecbb
......@@ -49,6 +49,8 @@ CubeSlideEffect::CubeSlideEffect()
this, &CubeSlideEffect::slotWindowStepUserMovedResized);
connect(effects, &EffectsHandler::windowFinishUserMovedResized,
this, &CubeSlideEffect::slotWindowFinishUserMovedResized);
connect(effects, &EffectsHandler::numberDesktopsChanged,
this, &CubeSlideEffect::slotNumberDesktopsChanged);
reconfigure(ReconfigureAll);
}
......@@ -644,4 +646,26 @@ bool CubeSlideEffect::isActive() const
return !slideRotations.isEmpty();
}
void CubeSlideEffect::slotNumberDesktopsChanged()
{
// This effect animates only aftermaths of desktop switching. There is no any
// way to reference removed desktops for animation purposes. So our the best
// shot is just to do nothing. It doesn't look nice and we probaby have to
// find more proper way to handle this case.
if (!isActive()) {
return;
}
for (EffectWindow *w : staticWindows) {
w->setData(WindowForceBlurRole, QVariant());
w->setData(WindowForceBackgroundContrastRole, QVariant());
}
slideRotations.clear();
staticWindows.clear();
effects->setActiveFullScreenEffect(nullptr);
}
} // namespace
......@@ -78,6 +78,7 @@ private Q_SLOTS:
void slotDesktopChanged(int old, int current, EffectWindow* w);
void slotWindowStepUserMovedResized(KWin::EffectWindow *w);
void slotWindowFinishUserMovedResized(KWin::EffectWindow *w);
void slotNumberDesktopsChanged();
private:
enum RotationDirection {
......
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