Commit 900f242a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

[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
parent 396d5280
......@@ -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({
......
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