From a7b7ce9ec07a9f2e3f037fe2b382fd0f56073ccb Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 15 Mar 2017 17:47:13 +0100 Subject: [PATCH] new logout effect Summary: new logout effect: it's just a slow fade in of the logout greeter (window is usable immediately tough Test Plan: logout greeter now fades in without setting the window opacity manually Reviewers: graesslin, #plasma Reviewed By: graesslin, #plasma Subscribers: broulik, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D5045 --- autotests/test_plugin_effectloader.cpp | 1 + autotests/test_scripted_effectloader.cpp | 4 ++ effects/CMakeLists.txt | 1 + effects/logout/CMakeLists.txt | 1 + effects/logout/package/CMakeLists.txt | 6 ++ effects/logout/package/contents/code/main.js | 58 ++++++++++++++++++++ effects/logout/package/metadata.desktop | 22 ++++++++ 7 files changed, 93 insertions(+) create mode 100644 effects/logout/CMakeLists.txt create mode 100644 effects/logout/package/CMakeLists.txt create mode 100644 effects/logout/package/contents/code/main.js create mode 100644 effects/logout/package/metadata.desktop diff --git a/autotests/test_plugin_effectloader.cpp b/autotests/test_plugin_effectloader.cpp index ddea2cafff..38d7a6877a 100644 --- a/autotests/test_plugin_effectloader.cpp +++ b/autotests/test_plugin_effectloader.cpp @@ -116,6 +116,7 @@ void TestPluginEffectLoader::testHasEffect_data() QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << false; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << false; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << false; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << false; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << false; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << false; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << false; diff --git a/autotests/test_scripted_effectloader.cpp b/autotests/test_scripted_effectloader.cpp index 84b1e9051b..6a5962864e 100644 --- a/autotests/test_scripted_effectloader.cpp +++ b/autotests/test_scripted_effectloader.cpp @@ -135,6 +135,7 @@ void TestScriptedEffectLoader::testHasEffect_data() QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << true; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << true; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << true; @@ -165,6 +166,7 @@ void TestScriptedEffectLoader::testKnownEffects() << QStringLiteral("kwin4_effect_fade") << QStringLiteral("kwin4_effect_fadedesktop") << QStringLiteral("kwin4_effect_login") + << QStringLiteral("kwin4_effect_logout") << QStringLiteral("kwin4_effect_maximize") << QStringLiteral("kwin4_effect_scalein") << QStringLiteral("kwin4_effect_translucency"); @@ -190,6 +192,7 @@ void TestScriptedEffectLoader::testLoadEffect_data() QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true; QTest::newRow("DialogParent") << QStringLiteral("kwin4_effect_dialogparent") << true; QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true; + QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true; QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true; QTest::newRow("ScaleIn") << QStringLiteral("kwin4_effect_scalein") << true; QTest::newRow("Translucency") << QStringLiteral("kwin4_effect_translucency") << true; @@ -340,6 +343,7 @@ void TestScriptedEffectLoader::testLoadAllEffects() plugins.writeEntry(kwin4 + QStringLiteral("fadeEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("fadedesktopEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("loginEnabled"), false); + plugins.writeEntry(kwin4 + QStringLiteral("logoutEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("maximizeEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("minimizeanimationEnabled"), false); plugins.writeEntry(kwin4 + QStringLiteral("scaleinEnabled"), false); diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 74a0b1be07..91d8b33d9d 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -133,6 +133,7 @@ add_subdirectory( eyeonscreen ) add_subdirectory( fade ) add_subdirectory( fadedesktop ) add_subdirectory( login ) +add_subdirectory( logout ) add_subdirectory( maximize ) add_subdirectory( morphingpopups ) add_subdirectory( scalein ) diff --git a/effects/logout/CMakeLists.txt b/effects/logout/CMakeLists.txt new file mode 100644 index 0000000000..1242620d48 --- /dev/null +++ b/effects/logout/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(package) diff --git a/effects/logout/package/CMakeLists.txt b/effects/logout/package/CMakeLists.txt new file mode 100644 index 0000000000..885e3dbbe5 --- /dev/null +++ b/effects/logout/package/CMakeLists.txt @@ -0,0 +1,6 @@ +install(DIRECTORY contents DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_logout) +install(FILES metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/${KWIN_NAME}/effects/kwin4_effect_logout) + +install(FILES metadata.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/${KWIN_NAME} + RENAME kwin4_effect_logout.desktop) diff --git a/effects/logout/package/contents/code/main.js b/effects/logout/package/contents/code/main.js new file mode 100644 index 0000000000..b31a9355a9 --- /dev/null +++ b/effects/logout/package/contents/code/main.js @@ -0,0 +1,58 @@ +/******************************************************************** + KWin - the KDE window manager + This file is part of the KDE project. + + Copyright (C) 2007 Lubos Lunak + Copyright (C) 2013 Martin Gräßlin + Copyright (C) 2017 Marco Martin + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*********************************************************************/ +/*global effect, effects, animate, animationTime, Effect*/ +var logoutEffect = { + duration: animationTime(800), + loadConfig: function () { + "use strict"; + logoutEffect.duration = animationTime(800); + }, + isLogoutWindow: function (window) { + "use strict"; + var windowClass = window.windowClass; + if (windowClass === "ksmserver ksmserver") { + return true; + } + return false; + }, + opened: function (window) { + "use strict"; + if (!logoutEffect.isLogoutWindow(window)) { + return; + } + animate({ + window: window, + duration: logoutEffect.duration, + type: Effect.Opacity, + from: 0.0, + to: 1.0 + }); + }, + init: function () { + "use strict"; + logoutEffect.loadConfig(); + effects.windowAdded.connect(logoutEffect.opened); + effects.windowShown.connect(logoutEffect.opened); + } +}; +logoutEffect.init(); + diff --git a/effects/logout/package/metadata.desktop b/effects/logout/package/metadata.desktop new file mode 100644 index 0000000000..742d55116d --- /dev/null +++ b/effects/logout/package/metadata.desktop @@ -0,0 +1,22 @@ +[Desktop Entry] +Name=logout +Icon=preferences-system-windows-effect-logout +Comment=Smoothly fade to the desktop when logging in + +Type=Service +X-KDE-ServiceTypes=KWin/Effect,KCModule +X-KDE-PluginInfo-Author=Lubos Lunak, Kai Uwe Broulik, Martin Gräßlin, Marco MArtin +X-KDE-PluginInfo-Email=l.lunak@kde.org, kde@privat.broulik.de, mgraesslin@kde.org, mart@kde.org +X-KDE-PluginInfo-Name=kwin4_effect_logout +X-KDE-PluginInfo-Version=0.2.0 +X-KDE-PluginInfo-Category=Appearance +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +X-KDE-Ordering=40 +X-Plasma-API=javascript +X-Plasma-MainScript=code/main.js +X-KDE-PluginKeyword=kwin4_effect_logout +X-KDE-Library=kcm_kwin4_genericscripted +X-KDE-ParentComponents=kwin4_effect_logout +X-KWin-Config-TranslationDomain=kwin_effects