From 5336c9a1e2001aa7b46a42b73fdea42d0c101414 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Sat, 4 Aug 2018 12:04:58 +0300 Subject: [PATCH] [effects/logout] Animate the disappearing of the logout screen Summary: Currently, the fade effect animates both the appearing and the disappearing of the logout screen. We don't want that because the logout effect should do that. D14582 addresses that problem by adding "ksmserver ksmserver" window class to the blacklist of the fade effect. With that change, only the logout effect animates the appearing of the logout screen. But there is a problem... If user clicks the cancel button, the logout screen instantaneously disappears, instead of smoothly fading out. This change addresses that problem by adding "out" animation. Depends on D14582 Test Plan: {F6175011} //Now, only the logout effect animates the appearing and the disappearing of the logout screen.// {F6175013} //No smooth transitions when the logout effect is disabled.// Reviewers: #kwin, #plasma, #vdg, davidedmundson Reviewed By: #kwin, #plasma, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D14592 --- effects/logout/package/contents/code/main.js | 35 +++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/effects/logout/package/contents/code/main.js b/effects/logout/package/contents/code/main.js index b31a9355a9..1e28841d7a 100644 --- a/effects/logout/package/contents/code/main.js +++ b/effects/logout/package/contents/code/main.js @@ -21,10 +21,12 @@ along with this program. If not, see . *********************************************************************/ /*global effect, effects, animate, animationTime, Effect*/ var logoutEffect = { - duration: animationTime(800), + inDuration: animationTime(800), + outDuration: animationTime(400), loadConfig: function () { "use strict"; - logoutEffect.duration = animationTime(800); + logoutEffect.inDuration = animationTime(800); + logoutEffect.outDuration = animationTime(400); }, isLogoutWindow: function (window) { "use strict"; @@ -39,19 +41,44 @@ var logoutEffect = { if (!logoutEffect.isLogoutWindow(window)) { return; } - animate({ + // If the Out animation is still active, kill it. + if (window.outAnimation !== undefined) { + cancel(window.outAnimation); + delete window.outAnimation; + } + window.inAnimation = animate({ window: window, - duration: logoutEffect.duration, + duration: logoutEffect.inDuration, type: Effect.Opacity, from: 0.0, to: 1.0 }); }, + closed: function (window) { + "use strict"; + if (!logoutEffect.isLogoutWindow(window)) { + return; + } + // If the In animation is still active, kill it. + if (window.inAnimation !== undefined) { + cancel(window.inAnimation); + delete window.inAnimation; + } + window.outAnimation = animate({ + window: window, + duration: logoutEffect.outDuration, + type: Effect.Opacity, + from: 1.0, + to: 0.0 + }); + }, init: function () { "use strict"; logoutEffect.loadConfig(); effects.windowAdded.connect(logoutEffect.opened); effects.windowShown.connect(logoutEffect.opened); + effects.windowClosed.connect(logoutEffect.closed); + effects.windowHidden.connect(logoutEffect.closed); } }; logoutEffect.init();