[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
This commit is contained in:
Vlad Zagorodniy 2019-05-07 12:07:02 +03:00
parent c438ecbb70
commit e8b45cce11
2 changed files with 25 additions and 0 deletions

View file

@ -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

View file

@ -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 {