[effects] Re-implement the Minimize Animation effect in JavaScript

Authored by zzag on Oct 22 2018, 2:17 PM.



There were several reasons to rewrite the Minimize Animation effect in
JavaScript: to simplify code and to get rid of full repaints. One could
say that nothing prevents us from calculating the dirty region in
postPaintScreen or postPaintWindow and it is correct, but with the
scripting effects API the dirty region will be calculated for us, so we
can focus more on "what we want" instead of "how".

Visually, the "old" effect and the rewritten one look quite the same.
Except one tiny bit: if a window doesn't have an icon in the task manager,
it won't be animated. The reason for that is the purpose of this effect is
to show where the window will be after it's minimized, if the window
doesn't have icon in the task manager, one can't click at the center of
the screen to unminimize the window.

There is one significant change, the name of the effect was changed to
"Squash". If we put this effect and the Magic lamp effect under "Window
Minimize Animation" category (or if we add some "heading" label), then
the old name and the name of the category would "conflict". The new name
was suggested by Nate Graham and it very closely describes what the
effect does. "Scale" doesn't fit this effect because while a window is
being animated, its aspect ratio is not preserved.

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Oct 22 2018, 2:17 PM
Restricted Application added a project: KWin. · View Herald TranscriptOct 22 2018, 2:17 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Oct 22 2018, 2:17 PM

cool stuff


You've changed this to 60. Is that deliberate?


We're not deleting the property if the animation ends normally.

Won't cause any real problem right now, but it might cause a problem when we sort out the TODO.

zzag added inline comments.Oct 23 2018, 12:58 PM

Most scripted effects use 60 for some reason. So does this effect. I change to 50 if that's an issue.


I don't think that would the problem. If the animation has finished, function that reverses animations should return false, indicating that it couldn't reverse the animation.

davidedmundson accepted this revision.Oct 23 2018, 1:19 PM

Most scripted effects use 60 for some reason.

Most effects that are chained in the middle don't really matter.

I wanted to point out there was a difference, up to you which you do.


Sure one could guard it, but the intuitive thing is to write:

if (window.minimizeAnimation) {

And then waste several hours.

But it'll be you doing that change, so we can handle it then.

This revision is now accepted and ready to land.Oct 23 2018, 1:19 PM
This revision was automatically updated to reflect the committed changes.