[KScreen Effect] Fade opacity only for transparent windows
ClosedPublic

Authored by davidedmundson on Jan 2 2018, 12:11 PM.

Details

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

Test Plan

I could no longer see my desktop flashing through when suspending and also was unable to look through the lock screen during the animation. It looks a lot nicer now as we mostly fade to black now instead of "fading through to the black root window".
Transparent windows are still fading their opacity as brightness would only affect opaque parts and then you end up with floating black icons in case of e.g. your panel.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Jan 2 2018, 12:11 PM
Restricted Application added a project: KWin. · View Herald TranscriptJan 2 2018, 12:11 PM
Restricted Application added subscribers: KWin, kwin, plasma-devel. · View Herald Transcript
broulik requested review of this revision.Jan 2 2018, 12:11 PM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 2 2018, 12:11 PM

Should the lock screen not be guarded by a black layer in the compositor?
As of the effect, maybe this should rather fade in a black layer than fade out everything else?

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 2 2018, 1:09 PM

As of the effect, maybe this should rather fade in a black layer than fade out everything else?

I suppose. Do you have a pointer to anywhere in KWin where I could look how that's done? (That'll also probably mean it won't make it to 5.12 LTS :/)

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 2 2018, 2:14 PM

Should the lock screen not be guarded by a black layer in the compositor?

On Wayland that's the case. On X11 there is a black window created by kscreenlocker, but we don't have special handling code for it.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptJan 2 2018, 4:38 PM

As of the effect, maybe this should rather fade in a black layer than fade out everything else?

I suppose. Do you have a pointer to anywhere in KWin where I could look how that's done? (That'll also probably mean it won't make it to 5.12 LTS :/)

There's the paintBackground functionality in Scene. It's responsible for rendering the lowest layer. Maybe it would be possible to expose this from the effects to call it at random places. Otherwise we have layer rendering in the showPaint effect. The disadvantage there is that you need to write drawing code for each Scene. AFAIK we don't have a generic "render color" feature.

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptJan 2 2018, 4:41 PM
davidedmundson commandeered this revision.Apr 24 2018, 9:58 PM
davidedmundson added a reviewer: broulik.
Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptApr 24 2018, 9:58 PM

A better version

davidedmundson edited the summary of this revision. (Show Details)Apr 24 2018, 10:00 PM
broulik accepted this revision.Apr 24 2018, 10:17 PM
This revision is now accepted and ready to land.Apr 24 2018, 10:17 PM
This revision was automatically updated to reflect the committed changes.