[KScreen Effect] Fix fade to black

Summary:
When you have two windows ontop of each other and you turn them
transparent, evidently you'll be able to see through them.
Not only does it look unpolished if the desktop window flashes through
your windows, it can pose a privacy risk as you'd be able to briefly
look through the lock screen.

This patch fades apps to black intead of to transparent. As this looks
weird for panels, so windows are also faded to opaque (if relevant) at
the same rate.

BUG: 388384

Reviewers: #plasma, graesslin

Subscribers: luebking, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D9608
icc-effect-5.14.5
David Edmundson 2018-04-24 23:20:14 +02:00
parent ed4a936315
commit 437a36a2bb
1 changed files with 16 additions and 12 deletions

View File

@ -105,19 +105,23 @@ void KscreenEffect::prePaintWindow(EffectWindow *w, WindowPrePaintData &data, in
void KscreenEffect::paintWindow(EffectWindow *w, int mask, QRegion region, WindowPaintData &data)
{
//fade to black and fully opaque
switch (m_state) {
case StateFadingOut:
data.multiplyOpacity(1.0 - m_timeLine.currentValue());
break;
case StateFadedOut:
data.multiplyOpacity(0.0);
break;
case StateFadingIn:
data.multiplyOpacity(m_timeLine.currentValue());
break;
default:
// no adjustment
break;
case StateFadingOut:
data.setOpacity(data.opacity() + (1.0 - data.opacity()) * m_timeLine.currentValue());
data.multiplyBrightness(1.0 - m_timeLine.currentValue());
break;
case StateFadedOut:
data.multiplyOpacity(0.0);
data.multiplyBrightness(0.0);
break;
case StateFadingIn:
data.setOpacity(data.opacity() + (1.0 - data.opacity()) * (1.0 - m_timeLine.currentValue()));
data.multiplyBrightness(m_timeLine.currentValue());
break;
default:
// no adjustment
break;
}
effects->paintWindow(w, mask, region, data);
}