File indexing completed on 2024-11-10 04:57:02

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2007 Lubos Lunak <l.lunak@kde.org>
0006     SPDX-FileCopyrightText: 2013 Martin Gräßlin <mgraesslin@kde.org>
0007     SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 */
0011 
0012 "use strict";
0013 
0014 var logoutEffect = {
0015     inDuration: animationTime(800),
0016     outDuration: animationTime(400),
0017     loadConfig: function () {
0018         logoutEffect.inDuration = animationTime(800);
0019         logoutEffect.outDuration = animationTime(400);
0020     },
0021     isLogoutWindow: function (window) {
0022         if (window.windowClass === "ksmserver-logout-greeter ksmserver-logout-greeter") {
0023             return true;
0024         }
0025         return false;
0026     },
0027     opened: function (window) {
0028         if (!logoutEffect.isLogoutWindow(window)) {
0029             return;
0030         }
0031         // If the Out animation is still active, kill it.
0032         if (window.outAnimation !== undefined) {
0033             cancel(window.outAnimation);
0034             delete window.outAnimation;
0035         }
0036         window.inAnimation = animate({
0037             window: window,
0038             duration: logoutEffect.inDuration,
0039             type: Effect.Opacity,
0040             from: 0.0,
0041             to: 1.0
0042         });
0043     },
0044     closed: function (window) {
0045         if (!logoutEffect.isLogoutWindow(window)) {
0046             return;
0047         }
0048         // If the In animation is still active, kill it.
0049         if (window.inAnimation !== undefined) {
0050             cancel(window.inAnimation);
0051             delete window.inAnimation;
0052         }
0053         window.outAnimation = animate({
0054             window: window,
0055             duration: logoutEffect.outDuration,
0056             type: Effect.Opacity,
0057             from: 1.0,
0058             to: 0.0
0059         });
0060     },
0061     init: function () {
0062         logoutEffect.loadConfig();
0063         effects.windowAdded.connect(logoutEffect.opened);
0064         effects.windowClosed.connect(logoutEffect.closed);
0065     }
0066 };
0067 logoutEffect.init();
0068