[effects/fullscreen] Add effect that animates full screen changes
Just a slightly altered copy of the maximize effect
This commit is contained in:
parent
3aca5bfa68
commit
e14a011165
4 changed files with 112 additions and 0 deletions
|
@ -133,6 +133,7 @@ void TestScriptedEffectLoader::testHasEffect_data()
|
||||||
QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true;
|
QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true;
|
||||||
QTest::newRow("FadingPopups") << QStringLiteral("kwin4_effect_fadingpopups") << true;
|
QTest::newRow("FadingPopups") << QStringLiteral("kwin4_effect_fadingpopups") << true;
|
||||||
QTest::newRow("FrozenApp") << QStringLiteral("kwin4_effect_frozenapp") << true;
|
QTest::newRow("FrozenApp") << QStringLiteral("kwin4_effect_frozenapp") << true;
|
||||||
|
QTest::newRow("FullScreen") << QStringLiteral("kwin4_effect_fullscreen") << true;
|
||||||
QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true;
|
QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true;
|
||||||
QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true;
|
QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true;
|
||||||
QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true;
|
QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true;
|
||||||
|
@ -205,6 +206,7 @@ void TestScriptedEffectLoader::testLoadEffect_data()
|
||||||
QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true;
|
QTest::newRow("FadeDesktop") << QStringLiteral("kwin4_effect_fadedesktop") << true;
|
||||||
QTest::newRow("FadingPopups") << QStringLiteral("kwin4_effect_fadingpopups") << true;
|
QTest::newRow("FadingPopups") << QStringLiteral("kwin4_effect_fadingpopups") << true;
|
||||||
QTest::newRow("FrozenApp") << QStringLiteral("kwin4_effect_frozenapp") << true;
|
QTest::newRow("FrozenApp") << QStringLiteral("kwin4_effect_frozenapp") << true;
|
||||||
|
QTest::newRow("FullScreen") << QStringLiteral("kwin4_effect_fullscreen") << true;
|
||||||
QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true;
|
QTest::newRow("Login") << QStringLiteral("kwin4_effect_login") << true;
|
||||||
QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true;
|
QTest::newRow("Logout") << QStringLiteral("kwin4_effect_logout") << true;
|
||||||
QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true;
|
QTest::newRow("Maximize") << QStringLiteral("kwin4_effect_maximize") << true;
|
||||||
|
@ -364,6 +366,7 @@ void TestScriptedEffectLoader::testLoadAllEffects()
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("fadedesktopEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("fadedesktopEnabled"), false);
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("fadingpopupsEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("fadingpopupsEnabled"), false);
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("frozenappEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("frozenappEnabled"), false);
|
||||||
|
plugins.writeEntry(kwin4 + QStringLiteral("fullscreenEnabled"), false);
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("loginEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("loginEnabled"), false);
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("logoutEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("logoutEnabled"), false);
|
||||||
plugins.writeEntry(kwin4 + QStringLiteral("maximizeEnabled"), false);
|
plugins.writeEntry(kwin4 + QStringLiteral("maximizeEnabled"), false);
|
||||||
|
|
|
@ -164,6 +164,7 @@ install_scripted_effect(fade)
|
||||||
install_scripted_effect(fadedesktop)
|
install_scripted_effect(fadedesktop)
|
||||||
install_scripted_effect(fadingpopups)
|
install_scripted_effect(fadingpopups)
|
||||||
install_scripted_effect(frozenapp)
|
install_scripted_effect(frozenapp)
|
||||||
|
install_scripted_effect(fullscreen)
|
||||||
install_scripted_effect(login)
|
install_scripted_effect(login)
|
||||||
install_scripted_effect(logout)
|
install_scripted_effect(logout)
|
||||||
install_scripted_effect(maximize)
|
install_scripted_effect(maximize)
|
||||||
|
|
90
effects/fullscreen/package/contents/code/fullscreen.js
Normal file
90
effects/fullscreen/package/contents/code/fullscreen.js
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
This file is part of the KDE project.
|
||||||
|
|
||||||
|
SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
|
||||||
|
|
||||||
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var fullScreenEffect = {
|
||||||
|
duration: animationTime(250),
|
||||||
|
loadConfig: function () {
|
||||||
|
fullScreenEffect.duration = animationTime(250);
|
||||||
|
},
|
||||||
|
fullScreenChanged: function (window) {
|
||||||
|
if (!window.oldGeometry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.setData(Effect.WindowForceBlurRole, true);
|
||||||
|
var oldGeometry, newGeometry;
|
||||||
|
oldGeometry = window.oldGeometry;
|
||||||
|
newGeometry = window.geometry;
|
||||||
|
if (oldGeometry.width == newGeometry.width && oldGeometry.height == newGeometry.height)
|
||||||
|
oldGeometry = window.olderGeometry;
|
||||||
|
window.olderGeometry = window.oldGeometry;
|
||||||
|
window.oldGeometry = newGeometry;
|
||||||
|
window.fullScreenAnimation1 = animate({
|
||||||
|
window: window,
|
||||||
|
duration: fullScreenEffect.duration,
|
||||||
|
animations: [{
|
||||||
|
type: Effect.Size,
|
||||||
|
to: {
|
||||||
|
value1: newGeometry.width,
|
||||||
|
value2: newGeometry.height
|
||||||
|
},
|
||||||
|
from: {
|
||||||
|
value1: oldGeometry.width,
|
||||||
|
value2: oldGeometry.height
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
type: Effect.Translation,
|
||||||
|
to: {
|
||||||
|
value1: 0,
|
||||||
|
value2: 0
|
||||||
|
},
|
||||||
|
from: {
|
||||||
|
value1: oldGeometry.x - newGeometry.x - (newGeometry.width / 2 - oldGeometry.width / 2),
|
||||||
|
value2: oldGeometry.y - newGeometry.y - (newGeometry.height / 2 - oldGeometry.height / 2)
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
if (!window.resize) {
|
||||||
|
window.fullScreenAnimation2 =animate({
|
||||||
|
window: window,
|
||||||
|
duration: fullScreenEffect.duration,
|
||||||
|
animations: [{
|
||||||
|
type: Effect.CrossFadePrevious,
|
||||||
|
to: 1.0,
|
||||||
|
from: 0.0
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
restoreForceBlurState: function(window) {
|
||||||
|
window.setData(Effect.WindowForceBlurRole, null);
|
||||||
|
},
|
||||||
|
geometryChange: function (window, oldGeometry) {
|
||||||
|
if (window.fullScreenAnimation1) {
|
||||||
|
if (window.geometry.width != window.oldGeometry.width ||
|
||||||
|
window.geometry.height != window.oldGeometry.height) {
|
||||||
|
cancel(window.fullScreenAnimation1);
|
||||||
|
delete window.fullScreenAnimation1;
|
||||||
|
if (window.fullScreenAnimation2) {
|
||||||
|
cancel(window.fullScreenAnimation2);
|
||||||
|
delete window.fullScreenAnimation2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.oldGeometry = window.geometry;
|
||||||
|
window.olderGeometry = oldGeometry;
|
||||||
|
},
|
||||||
|
init: function () {
|
||||||
|
effect.configChanged.connect(fullScreenEffect.loadConfig);
|
||||||
|
effects.windowFrameGeometryChanged.connect(fullScreenEffect.geometryChange);
|
||||||
|
effects.windowFullScreenChanged.connect(fullScreenEffect.fullScreenChanged);
|
||||||
|
effect.animationEnded.connect(fullScreenEffect.restoreForceBlurState);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fullScreenEffect.init();
|
18
effects/fullscreen/package/metadata.desktop
Normal file
18
effects/fullscreen/package/metadata.desktop
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Comment=Animation for a window going to and leaving full screen mode
|
||||||
|
Icon=preferences-system-windows-effect-fullscreen
|
||||||
|
Name=Full Screen
|
||||||
|
Type=Service
|
||||||
|
X-KDE-ParentApp=
|
||||||
|
X-KDE-PluginInfo-Author=Martin Gräßlin
|
||||||
|
X-KDE-PluginInfo-Category=Appearance
|
||||||
|
X-KDE-PluginInfo-Email=mgraesslin@kde.org
|
||||||
|
X-KDE-PluginInfo-License=GPL
|
||||||
|
X-KDE-PluginInfo-Name=kwin4_effect_fullscreen
|
||||||
|
X-KDE-PluginInfo-Version=1
|
||||||
|
X-KDE-PluginInfo-Website=
|
||||||
|
X-KDE-ServiceTypes=KWin/Effect
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
||||||
|
X-KDE-Ordering=60
|
||||||
|
X-Plasma-API=javascript
|
||||||
|
X-Plasma-MainScript=code/fullscreen.js
|
Loading…
Reference in a new issue