Debian Codegraph @

src/plugins/logout/package/contents/code/main.js

raw
1 /*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 2007 Lubos Lunak <[email protected]>
6 SPDX-FileCopyrightText: 2013 Martin Gräßlin <[email protected]>
7 SPDX-FileCopyrightText: 2017 Marco Martin <[email protected]>
8
9 SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12 "use strict";
13
14 var logoutEffect = {
15 isLogoutWindow: function (window) {
16 if (window.windowClass === "ksmserver-logout-greeter ksmserver-logout-greeter") {
17 return true;
18 }
19 return false;
20 },
21 opened: function (window) {
22 if (!logoutEffect.isLogoutWindow(window)) {
23 return;
24 }
25 // If the Out animation is still active, kill it.
26 if (window.outAnimation !== undefined) {
27 cancel(window.outAnimation);
28 delete window.outAnimation;
29 }
30 window.inAnimation = animate({
31 window: window,
32 duration: animationTime(800),
33 type: Effect.Opacity,
34 from: 0.0,
35 to: 1.0
36 });
37 },
38 closed: function (window) {
39 if (!logoutEffect.isLogoutWindow(window)) {
40 return;
41 }
42 // If the In animation is still active, kill it.
43 if (window.inAnimation !== undefined) {
44 cancel(window.inAnimation);
45 delete window.inAnimation;
46 }
47 window.outAnimation = animate({
48 window: window,
49 duration: animationTime(400),
50 type: Effect.Opacity,
51 from: 1.0,
52 to: 0.0
53 });
54 },
55 init: function () {
56 effects.windowAdded.connect(logoutEffect.opened);
57 effects.windowClosed.connect(logoutEffect.closed);
58 }
59 };
60 logoutEffect.init();
61