[effects/squash] Try to reverse previous active animations

Summary:
If a window is unminimized and the minimize animation is still active,
don't cancel the latter and start a new animation. Instead, try to
reverse already active animation and if that attempt failed, start a new
animation. This results in more smoother animations.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16451
master
Vlad Zagorodniy 6 years ago
parent 396d528075
commit 900f242a39

@ -37,11 +37,20 @@ var squashEffect = {
}
if (window.unminimizeAnimation) {
// TODO: Try to reverse it instead.
if (redirect(window.unminimizeAnimation, Effect.Backward)) {
return;
}
cancel(window.unminimizeAnimation);
delete window.unminimizeAnimation;
}
if (window.minimizeAnimation) {
if (redirect(window.minimizeAnimation, Effect.Forward)) {
return;
}
cancel(window.minimizeAnimation);
}
var windowRect = window.geometry;
window.minimizeAnimation = animate({
@ -94,11 +103,20 @@ var squashEffect = {
}
if (window.minimizeAnimation) {
// TODO: Try to reverse it instead.
if (redirect(window.minimizeAnimation, Effect.Backward)) {
return;
}
cancel(window.minimizeAnimation);
delete window.minimizeAnimation;
}
if (window.unminimizeAnimation) {
if (redirect(window.unminimizeAnimation, Effect.Forward)) {
return;
}
cancel(window.unminimizeAnimation);
}
var windowRect = window.geometry;
window.unminimizeAnimation = animate({

Loading…
Cancel
Save