Commit 207c5900 authored by Marco Martin's avatar Marco Martin Committed by Vlad Zahorodnii
Browse files

Properly reset offToCornerId and apertureCorner when the effect closes

When the effect closes, all the extra data attached to the window
(offToCornerId and apertureCorner properties) are not valid anymore
and need to be reset right after the animation end.
also manage the two edge cases where a window either appeared or
got minimized while the effect was running to either show it or not

BUG: 454280
parent 1f6d9d48
Pipeline #181367 passed with stage
in 13 minutes and 29 seconds
......@@ -43,8 +43,16 @@ var badBadWindowsEffect = {
}
// ignore invisible windows and such that do not have to be restored
if (!w.visible)
if (!w.visible) {
if (w.offToCornerId) {
// if it was visible when the effect was activated delete its animation data
effects.setElevatedWindow(w, false);
cancel(w.offToCornerId);
delete w.offToCornerId;
delete w.apertureCorner;
}
continue;
}
// Don't touch docks
if (w.dock) {
......@@ -159,30 +167,39 @@ var badBadWindowsEffect = {
});
}
} else {
if (!w.offToCornerId || !redirect(w.offToCornerId, Effect.Backward) || !freezeInTime(w.offToCornerId, frozenTime)) {
// Reset if the window has become invisible in the meantime
if (!w.visible) {
cancel(w.offToCornerId);
delete w.offToCornerId;
delete w.apertureCorner;
if (w.visible) { // could meanwhile have been hidden
animate({
window: w,
duration: badBadWindowsEffect.duration,
curve: QEasingCurve.InOutCubic,
animations: [{
type: Effect.Position,
sourceAnchor: anchor,
gesture: true,
from: { value1: tx, value2: ty }
},{
type: Effect.Opacity,
from: 0.0
}]
});
}
// This if the window was invisible and has become visible in the meantime
} else if (!w.offToCornerId || !redirect(w.offToCornerId, Effect.Backward) || !freezeInTime(w.offToCornerId, frozenTime)) {
animate({
window: w,
duration: badBadWindowsEffect.duration,
curve: QEasingCurve.InOutCubic,
animations: [{
type: Effect.Position,
sourceAnchor: anchor,
gesture: true,
from: { value1: tx, value2: ty }
},{
type: Effect.Opacity,
from: 0.0
}]
});
}
}
}
},
animationEnded: function (w, a, meta) {
// After the animation that closes the effect, reset all the parameters
if (!badBadWindowsEffect.showingDesktop) {
cancel(w.offToCornerId);
delete w.offToCornerId;
delete w.apertureCorner;
}
},
realtimeScreenEdgeCallback: function (border, deltaProgress, effectScreen) {
if (!deltaProgress || !effectScreen) {
badBadWindowsEffect.offToCorners(badBadWindowsEffect.showingDesktop, -1);
......@@ -212,6 +229,7 @@ var badBadWindowsEffect = {
badBadWindowsEffect.loadConfig();
effects.showingDesktopChanged.connect(badBadWindowsEffect.setShowingDesktop);
effects.showingDesktopChanged.connect(badBadWindowsEffect.offToCorners);
effect.animationEnded.connect(badBadWindowsEffect.animationEnded);
let edges = effect.touchEdgesForAction("show-desktop");
......
Supports Markdown
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