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 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 0011 "use strict"; 0012 0013 var loginEffect = { 0014 duration: animationTime(1000), 0015 isFadeToBlack: false, 0016 loadConfig: function () { 0017 loginEffect.isFadeToBlack = effect.readConfig("FadeToBlack", false); 0018 }, 0019 isLoginSplash: function (window) { 0020 return window.windowClass === "ksplashqml ksplashqml"; 0021 }, 0022 fadeOut: function (window) { 0023 animate({ 0024 window: window, 0025 duration: loginEffect.duration, 0026 type: Effect.Opacity, 0027 from: 1.0, 0028 to: 0.0 0029 }); 0030 }, 0031 fadeToBlack: function (window) { 0032 animate({ 0033 window: window, 0034 duration: loginEffect.duration / 2, 0035 animations: [{ 0036 type: Effect.Brightness, 0037 from: 1.0, 0038 to: 0.0 0039 }, { 0040 type: Effect.Opacity, 0041 from: 1.0, 0042 to: 0.0, 0043 delay: loginEffect.duration / 2 0044 }, { 0045 // TODO: is there a better way to keep brightness constant? 0046 type: Effect.Brightness, 0047 from: 0.0, 0048 to: 0.0, 0049 delay: loginEffect.duration / 2 0050 }] 0051 }); 0052 }, 0053 closed: function (window) { 0054 if (!loginEffect.isLoginSplash(window)) { 0055 return; 0056 } 0057 if (loginEffect.isFadeToBlack === true) { 0058 loginEffect.fadeToBlack(window); 0059 } else { 0060 loginEffect.fadeOut(window); 0061 } 0062 }, 0063 init: function () { 0064 effect.configChanged.connect(loginEffect.loadConfig); 0065 effects.windowClosed.connect(loginEffect.closed); 0066 loginEffect.loadConfig(); 0067 } 0068 }; 0069 loginEffect.init();