fb69b791a1
Summary: When windows get added some effects grab the window and want to be the only one animating this window. For this the grab roles exists. An effect being notified later on evaluates the grab state and does not start the animation. This process failed due to being dependent on the order the effects are loaded. Window Added/Closed are signals emitted by EffectsHandler, thus first come, first serve. The requested effect order does not play into it. Due to that it could happen that an Effect which should not animate, started to animate as the grab was still there. This change adds the possibility to be notified whenever the window data changes. A new signal is added to EffectsHandler which is emitted whenever the windowData changes. The interested effects connect to it and cancel their (just started) animation for the window. Adjusted effects are: * ScaleIn * Fade * WobblyWindows In case of WobblyWindows an additional logical error was fixed that the animations were only run when an effect grabbed instead of the other way around. BUG: 336866 FIXED-IN: 5.8.4 Reviewers: #kwin, #plasma, broulik Subscribers: plasma-devel, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D3211
78 lines
3 KiB
JavaScript
78 lines
3 KiB
JavaScript
/********************************************************************
|
|
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/>.
|
|
*********************************************************************/
|
|
function isFadeWindow(w) {
|
|
if (w.deleted && effect.isGrabbed(w, Effect.WindowClosedGrabRole)) {
|
|
return false;
|
|
} else if (!w.deleted && effect.isGrabbed(w, Effect.WindowAddedGrabRole)) {
|
|
return false;
|
|
}
|
|
return w.onCurrentDesktop && !isLoginWindow(w) && !w.desktopWindow && !w.utility && !w.minimized;
|
|
}
|
|
|
|
function isLoginWindow(w) {
|
|
return w.windowClass == "ksplashx ksplashx" || w.windowClass == "ksplashsimple ksplashsimple" || w.windowClass == "ksplashqml ksplashqml";
|
|
}
|
|
|
|
var fadeInTime, fadeOutTime, fadeWindows;
|
|
function loadConfig() {
|
|
fadeInTime = animationTime(effect.readConfig("FadeInTime", 150));
|
|
fadeOutTime = animationTime(effect.readConfig("FadeOutTime", 150)) * 4;
|
|
fadeWindows = effect.readConfig("FadeWindows", true);
|
|
}
|
|
loadConfig();
|
|
effect.configChanged.connect(function() {
|
|
loadConfig();
|
|
});
|
|
effects.windowAdded.connect(function(w) {
|
|
if (fadeWindows && isFadeWindow(w)) {
|
|
w.fadeInWindowTypeAnimation = effect.animate(w, Effect.Opacity, fadeInTime, 1.0, 0.0);
|
|
}
|
|
});
|
|
effects.windowClosed.connect(function(w) {
|
|
if (fadeWindows && isFadeWindow(w)) {
|
|
w.fadeOutWindowTypeAnimation = animate({
|
|
window: w,
|
|
duration: fadeOutTime,
|
|
animations: [{
|
|
type: Effect.Opacity,
|
|
curve: QEasingCurve.OutQuart,
|
|
to: 0.0
|
|
}]
|
|
});
|
|
}
|
|
});
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
});
|