[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
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2018 Vlad Zagorodniy <vladzzag@gmail.com>
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
2018-11-28 09:20:10 +00:00
|
|
|
var blacklist = [
|
|
|
|
// The logout screen has to be animated only by the logout effect.
|
|
|
|
"ksmserver ksmserver",
|
|
|
|
"ksmserver-logout-greeter ksmserver-logout-greeter",
|
|
|
|
|
|
|
|
// KDE Plasma splash screen has to be animated only by the login effect.
|
|
|
|
"ksplashqml ksplashqml",
|
|
|
|
"ksplashsimple ksplashsimple",
|
|
|
|
"ksplashx ksplashx"
|
|
|
|
];
|
|
|
|
|
[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
|
|
|
function isPopupWindow(window) {
|
2018-11-28 09:20:10 +00:00
|
|
|
// If the window is blacklisted, don't animate it.
|
|
|
|
if (blacklist.indexOf(window.windowClass) != -1) {
|
|
|
|
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
|
|
|
// Animate combo box popups, tooltips, popup menus, etc.
|
|
|
|
if (window.popupWindow) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-03-19 14:01:29 +00:00
|
|
|
// Maybe the outline deserves its own effect.
|
|
|
|
if (window.outline) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
[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
|
|
|
// Override-redirect windows are usually used for user interface
|
|
|
|
// concepts that are expected to be animated by this effect, e.g.
|
|
|
|
// popups that contain window thumbnails on X11, etc.
|
|
|
|
if (window.x11Client && !window.managed) {
|
|
|
|
// Some utility windows can look like popup windows (e.g. the
|
|
|
|
// address bar dropdown in Firefox), but we don't want to fade
|
|
|
|
// them because the fade effect didn't do that.
|
|
|
|
if (window.utility) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Previously, there was a "monolithic" fade effect, which tried to
|
|
|
|
// animate almost every window that was shown or hidden. Then it was
|
|
|
|
// split into two effects: one that animates toplevel windows and
|
|
|
|
// this one. In addition to popups, this effect also animates some
|
|
|
|
// special windows(e.g. notifications) because the monolithic version
|
|
|
|
// was doing that.
|
|
|
|
if (window.dock || window.splash || window.toolbar
|
|
|
|
|| window.notification || window.onScreenDisplay) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
var fadingPopupsEffect = {
|
|
|
|
loadConfig: function () {
|
|
|
|
fadingPopupsEffect.fadeInDuration = animationTime(150);
|
|
|
|
fadingPopupsEffect.fadeOutDuration = animationTime(150) * 4;
|
|
|
|
},
|
|
|
|
slotWindowAdded: function (window) {
|
|
|
|
if (effects.hasActiveFullScreenEffect) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!isPopupWindow(window)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!window.visible) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!effect.grab(window, Effect.WindowAddedGrabRole)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.fadeInAnimation = animate({
|
|
|
|
window: window,
|
|
|
|
curve: QEasingCurve.Linear,
|
|
|
|
duration: fadingPopupsEffect.fadeInDuration,
|
|
|
|
type: Effect.Opacity,
|
|
|
|
from: 0.0,
|
|
|
|
to: 1.0
|
|
|
|
});
|
|
|
|
},
|
|
|
|
slotWindowClosed: function (window) {
|
|
|
|
if (effects.hasActiveFullScreenEffect) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!isPopupWindow(window)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!window.visible) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!effect.grab(window, Effect.WindowClosedGrabRole)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
window.fadeOutAnimation = animate({
|
|
|
|
window: window,
|
|
|
|
curve: QEasingCurve.OutQuart,
|
|
|
|
duration: fadingPopupsEffect.fadeOutDuration,
|
|
|
|
type: Effect.Opacity,
|
|
|
|
from: 1.0,
|
|
|
|
to: 0.0
|
|
|
|
});
|
|
|
|
},
|
|
|
|
slotWindowDataChanged: function (window, role) {
|
|
|
|
if (role == Effect.WindowAddedGrabRole) {
|
|
|
|
if (window.fadeInAnimation && effect.isGrabbed(window, role)) {
|
|
|
|
cancel(window.fadeInAnimation);
|
|
|
|
delete window.fadeInAnimation;
|
|
|
|
}
|
|
|
|
} else if (role == Effect.WindowClosedGrabRole) {
|
|
|
|
if (window.fadeOutAnimation && effect.isGrabbed(window, role)) {
|
|
|
|
cancel(window.fadeOutAnimation);
|
|
|
|
delete window.fadeOutAnimation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
init: function () {
|
|
|
|
fadingPopupsEffect.loadConfig();
|
|
|
|
|
|
|
|
effect.configChanged.connect(fadingPopupsEffect.loadConfig);
|
|
|
|
effects.windowAdded.connect(fadingPopupsEffect.slotWindowAdded);
|
|
|
|
effects.windowClosed.connect(fadingPopupsEffect.slotWindowClosed);
|
|
|
|
effects.windowDataChanged.connect(fadingPopupsEffect.slotWindowDataChanged);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
fadingPopupsEffect.init();
|