2012-02-02 13:39:39 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2007 Philip Falkner <philip.falkner@gmail.com>
|
|
|
|
Copyright (C) 2012 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2018-08-03 14:02:23 +00:00
|
|
|
|
|
|
|
var blacklist = [
|
|
|
|
// The logout screen has to be animated only by the logout effect.
|
|
|
|
"ksmserver ksmserver",
|
2018-08-14 16:38:10 +00:00
|
|
|
"ksmserver-logout-greeter ksmserver-logout-greeter",
|
2018-08-03 14:02:23 +00:00
|
|
|
|
|
|
|
// The splash screen has to be animated only by the login effect.
|
|
|
|
"ksplashqml ksplashqml",
|
|
|
|
"ksplashsimple ksplashsimple",
|
|
|
|
"ksplashx ksplashx"
|
|
|
|
];
|
|
|
|
|
2012-02-02 13:39:39 +00:00
|
|
|
function isFadeWindow(w) {
|
2018-08-03 14:02:23 +00:00
|
|
|
if (blacklist.indexOf(w.windowClass) != -1) {
|
|
|
|
return false;
|
|
|
|
}
|
2018-12-11 10:22:42 +00:00
|
|
|
if (w.popupWindow) {
|
[effects] Split the Fade effect
Summary:
Currently, we have three effects that can be used to animate the
appearing of toplevel windows(fade, glide, scale) and one can enable
all three of them, which seems to be wrong. It doesn't make sense to have
glide and scale effect enabled, for example.
We couldn't put all three effects into an exclusive group before because
the fade effect animates not only toplevel windows but also popups. So,
if all three effects are in an exclusive group and you enable glide effect,
for example, then tooltips and other popups won't be faded in/out.
This patch splits the fade effect into two: the first effect (called Fade)
animates toplevel windows and the other one (called Fading Popups) animates
popup windows.
Test Plan:
Have been using the Fading Popups effect in combination with the Scale
effect for a couple of days. Haven't noticed any significant differences between
the new combination (Fading Popups + Scale) and the old combination
(Fade + Scale).
Reviewers: #kwin, #plasma, #vdg, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, abetts, ngraham, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16836
2018-11-03 15:42:31 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (w.x11Client && !w.managed) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!w.visible) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-03-19 14:01:29 +00:00
|
|
|
if (w.outline) {
|
|
|
|
return false;
|
|
|
|
}
|
2012-02-02 13:39:39 +00:00
|
|
|
if (w.deleted && effect.isGrabbed(w, Effect.WindowClosedGrabRole)) {
|
|
|
|
return false;
|
|
|
|
} else if (!w.deleted && effect.isGrabbed(w, Effect.WindowAddedGrabRole)) {
|
|
|
|
return false;
|
|
|
|
}
|
[effects] Split the Fade effect
Summary:
Currently, we have three effects that can be used to animate the
appearing of toplevel windows(fade, glide, scale) and one can enable
all three of them, which seems to be wrong. It doesn't make sense to have
glide and scale effect enabled, for example.
We couldn't put all three effects into an exclusive group before because
the fade effect animates not only toplevel windows but also popups. So,
if all three effects are in an exclusive group and you enable glide effect,
for example, then tooltips and other popups won't be faded in/out.
This patch splits the fade effect into two: the first effect (called Fade)
animates toplevel windows and the other one (called Fading Popups) animates
popup windows.
Test Plan:
Have been using the Fading Popups effect in combination with the Scale
effect for a couple of days. Haven't noticed any significant differences between
the new combination (Fading Popups + Scale) and the old combination
(Fade + Scale).
Reviewers: #kwin, #plasma, #vdg, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, abetts, ngraham, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16836
2018-11-03 15:42:31 +00:00
|
|
|
return w.normalWindow || w.dialog;
|
2012-02-02 13:39:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var fadeInTime, fadeOutTime, fadeWindows;
|
|
|
|
function loadConfig() {
|
2012-04-09 09:25:31 +00:00
|
|
|
fadeInTime = animationTime(effect.readConfig("FadeInTime", 150));
|
2013-09-25 19:57:44 +00:00
|
|
|
fadeOutTime = animationTime(effect.readConfig("FadeOutTime", 150)) * 4;
|
2012-04-09 09:25:31 +00:00
|
|
|
fadeWindows = effect.readConfig("FadeWindows", true);
|
2012-02-02 13:39:39 +00:00
|
|
|
}
|
|
|
|
loadConfig();
|
|
|
|
effect.configChanged.connect(function() {
|
|
|
|
loadConfig();
|
|
|
|
});
|
2016-11-18 14:27:34 +00:00
|
|
|
function fadeInHandler(w) {
|
2018-10-04 12:05:51 +00:00
|
|
|
if (effects.hasActiveFullScreenEffect) {
|
|
|
|
return;
|
|
|
|
}
|
2012-02-02 13:39:39 +00:00
|
|
|
if (fadeWindows && isFadeWindow(w)) {
|
2016-11-18 14:27:34 +00:00
|
|
|
if (w.fadeOutWindowTypeAnimation !== undefined) {
|
|
|
|
cancel(w.fadeOutWindowTypeAnimation);
|
|
|
|
w.fadeOutWindowTypeAnimation = undefined;
|
|
|
|
}
|
2016-10-31 10:22:24 +00:00
|
|
|
w.fadeInWindowTypeAnimation = effect.animate(w, Effect.Opacity, fadeInTime, 1.0, 0.0);
|
2012-02-02 13:39:39 +00:00
|
|
|
}
|
2016-11-18 14:27:34 +00:00
|
|
|
}
|
|
|
|
function fadeOutHandler(w) {
|
2018-10-04 12:05:51 +00:00
|
|
|
if (effects.hasActiveFullScreenEffect) {
|
|
|
|
return;
|
|
|
|
}
|
2012-02-02 13:39:39 +00:00
|
|
|
if (fadeWindows && isFadeWindow(w)) {
|
2016-11-18 14:27:34 +00:00
|
|
|
if (w.fadeOutWindowTypeAnimation !== undefined) {
|
|
|
|
// don't animate again as it was already animated through window hidden
|
|
|
|
return;
|
|
|
|
}
|
2016-10-31 10:22:24 +00:00
|
|
|
w.fadeOutWindowTypeAnimation = animate({
|
2013-09-25 19:57:44 +00:00
|
|
|
window: w,
|
|
|
|
duration: fadeOutTime,
|
|
|
|
animations: [{
|
|
|
|
type: Effect.Opacity,
|
|
|
|
curve: QEasingCurve.OutQuart,
|
|
|
|
to: 0.0
|
|
|
|
}]
|
|
|
|
});
|
2012-02-02 13:39:39 +00:00
|
|
|
}
|
2016-11-18 14:27:34 +00:00
|
|
|
}
|
|
|
|
effects.windowAdded.connect(fadeInHandler);
|
|
|
|
effects.windowClosed.connect(fadeOutHandler);
|
2016-10-31 10:22:24 +00:00
|
|
|
effects.windowDataChanged.connect(function (window, role) {
|
|
|
|
if (role == Effect.WindowAddedGrabRole) {
|
|
|
|
if (effect.isGrabbed(window, Effect.WindowAddedGrabRole)) {
|
|
|
|
if (window.fadeInWindowTypeAnimation !== undefined) {
|
|
|
|
cancel(window.fadeInWindowTypeAnimation);
|
|
|
|
window.fadeInWindowTypeAnimation = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (role == Effect.WindowClosedGrabRole) {
|
|
|
|
if (effect.isGrabbed(window, Effect.WindowClosedGrabRole)) {
|
|
|
|
if (window.fadeOutWindowTypeAnimation !== undefined) {
|
|
|
|
cancel(window.fadeOutWindowTypeAnimation);
|
|
|
|
window.fadeOutWindowTypeAnimation = undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|