effects/fallapart: Fix glitch

The WindowItem visibility reference must be dropped after, not before
starting painting. It also makes the fall apart effect code consistent
with other effects.

BUG: 454243
Tested-by: Merge Service <https://invent.kde.org/plasma/kwin/-/merge_requests/2455>
Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2455>
This commit is contained in:
Vlad Zahorodnii 2022-05-24 11:21:20 +03:00 committed by Merge Service
parent cfd3676e96
commit 80b9617bad

View file

@ -50,19 +50,14 @@ void FallApartEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data,
{
auto animationIt = windows.find(w);
if (animationIt != windows.end() && isRealWindow(w)) {
if (animationIt->progress < 1) {
int time = 0;
if (animationIt->lastPresentTime.count()) {
time = (presentTime - animationIt->lastPresentTime).count();
}
animationIt->lastPresentTime = presentTime;
animationIt->progress += time / animationTime(1000.);
data.setTransformed();
} else {
unredirect(w);
windows.remove(w);
int time = 0;
if (animationIt->lastPresentTime.count()) {
time = (presentTime - animationIt->lastPresentTime).count();
}
animationIt->lastPresentTime = presentTime;
animationIt->progress += time / animationTime(1000.);
data.setTransformed();
}
effects->prePaintWindow(w, data, presentTime);
}
@ -128,9 +123,16 @@ void FallApartEffect::deform(EffectWindow *w, int mask, WindowPaintData &data, W
void FallApartEffect::postPaintScreen()
{
if (!windows.isEmpty()) {
effects->addRepaintFull();
for (auto it = windows.begin(); it != windows.end();) {
if (it->progress < 1) {
++it;
} else {
unredirect(it.key());
it = windows.erase(it);
}
}
effects->addRepaintFull();
effects->postPaintScreen();
}