[effects] Rewrite the Dim Inactive effect
ClosedPublic

Authored by zzag on Jun 25 2018, 2:12 PM.

Details

Summary

The Dim Inactive effect was rewritten mostly to fix most of issues with
it, e.g. after leaving a full screen effect(e.g. Desktop Grid) windows
sometimes are not dimmed back, or when a window becomes inactive there
is no smooth transition, etc.


Before: the window is not smoothly dimmed.


After: the window is smoothly dimmed.

In combination with an effect that animates the disappearing of windows,
e.g. Glide, the rewritten Dim Inactive effect doesn't "flash" windows.
If an active window has been closed, it will stay bright. If an inactive
window has been closed, it will stay dimmed.

Among other changes, the KCM has been re-designed to follow common KCM
design in Plasma:

The way the rewritten Dim Inactive effect handles flashing/flickering problem can be
reused in the Dialog Parent effect.

Demo


Before: dimming of a window group.


After: Dimming of a window group.

Depends on D13740

CCBUG: 359251

Test Plan

Test plan #1

  • Activated the Desktop Grid effect
  • Dimmed windows smoothly brightened
  • Left desktop grid
  • Windows dimmed back

Test plan #2

  • Opened Dolphin and its Preferences window
  • Clicked on desktop, both Dolphin and the Preferences window dimmed
  • Clicked on Dolphin, both windows smoothly brightened back

Diff Detail

Repository
R108 KWin
Branch
rewrite-diminactive-effect
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 922
Build 935: arc lint + arc unit
zzag created this revision.Jun 25 2018, 2:12 PM
Restricted Application added a project: KWin. · View Herald TranscriptJun 25 2018, 2:12 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Jun 25 2018, 2:12 PM
zzag edited the summary of this revision. (Show Details)Jun 25 2018, 2:13 PM
zzag edited the summary of this revision. (Show Details)
zzag added a reviewer: VDG.Jun 25 2018, 2:15 PM
zzag edited the summary of this revision. (Show Details)Jun 25 2018, 2:34 PM
zzag edited the summary of this revision. (Show Details)Jun 25 2018, 2:36 PM

A big visual improvement!

zzag updated this revision to Diff 36689.Jun 26 2018, 2:24 PM
  • Add the In transtion
  • Port to the TimeLine class
zzag edited the summary of this revision. (Show Details)Jun 26 2018, 2:26 PM
zzag retitled this revision from [WIP] [effects] Rewrite the Dim Inactive effect to [effects] Rewrite the Dim Inactive effect.
zzag updated this revision to Diff 36692.Jun 26 2018, 3:14 PM

Set m_activeWindow in reconfigure()

zzag updated this revision to Diff 36721.Jun 26 2018, 9:16 PM

Rebase.

zzag updated this revision to Diff 36745.Jun 27 2018, 8:40 AM

Use std::chrono::milliseconds

zzag updated this revision to Diff 36762.Jun 27 2018, 1:07 PM

Fix -Wunused-variable.

zzag updated this revision to Diff 36789.Jun 27 2018, 8:31 PM

Rebase.

zzag edited the test plan for this revision. (Show Details)Jun 27 2018, 8:36 PM
zzag updated this revision to Diff 37233.Jul 6 2018, 8:39 AM

Sync with my local repo.

ngraham accepted this revision as: VDG.Jul 16 2018, 6:44 PM

+1 from VDG. As with others, please get a code review too.

Big +1. Thanks for the great work!

zzag updated this revision to Diff 37910.Jul 16 2018, 9:13 PM

Leave properties.

zzag updated this revision to Diff 37924.Jul 17 2018, 6:08 AM

Edit comments.

zzag added a comment.Jul 23 2018, 7:54 AM

Weekly ping.

Could we get Plasma or KWin review for this?

zzag added a comment.Jul 26 2018, 1:09 PM

Surprisingly, the rewritten Dim Inactive effect has a fix for bug 359251:

Probably, Steam is no longer flickering because the rewritten dim inactive effect has protection against the case when "focus" jumps between windows in a window group.

Still, that's most likely Steam's issue because its menus have the following hints: _NET_WM_WINDOW_TYPE_MENU _KDE_NET_WM_WINDOW_TYPE_OVERRIDE.

zzag edited the summary of this revision. (Show Details)Jul 26 2018, 1:10 PM
davidedmundson accepted this revision.Aug 20 2018, 11:30 PM
davidedmundson added a subscriber: davidedmundson.
davidedmundson added inline comments.
effects/diminactive/diminactive.cpp
104–105

constBegin/constEnd

240

why the reset?

won't that flicker if you

inactive -> active -> inactive

really really quickly.

This revision is now accepted and ready to land.Aug 20 2018, 11:30 PM
zzag added inline comments.Aug 21 2018, 8:15 AM
effects/diminactive/diminactive.cpp
104–105

It won't be compiled:

(*transitionIt) would return const T &, where T = TimeLine. It would work with pointers because what iterator returns is a const reference to a pointer, e.g.

const (TimeLine *) &
240

Good question. The In and the Out animations are different so that's fine to reset them.

really really quickly

It will be noticeable only when animation time factor is 4x+.

On the other hand, TimeLine tries its best to smooth "transition" from old duration to new duration. The problem is when we're truncating duration(e.g. 250ms -> 160ms). But that's easy to fix:

timeLine.setDuration(smallerDuration);
if (timeLine.done()) {
    timeLine.reset();
}

I'll change it.

zzag added inline comments.Aug 21 2018, 8:17 AM
effects/diminactive/diminactive.cpp
240

I'll also have to change easing curves. (to InOut curve)

zzag updated this revision to Diff 40124.Aug 21 2018, 8:47 AM

Fix potential flickering

zzag marked 5 inline comments as done.Aug 21 2018, 8:48 AM
davidedmundson accepted this revision.Aug 21 2018, 8:50 AM
This revision was automatically updated to reflect the committed changes.