kwin/autotests/integration/effects
Vlad Zagorodniy 5e104fbc12 [scripting] Introduce redirect function
Summary:
Consider current implementation of the Squash effect: if a window was
minimized, an animation will be started; if the window is unminimized
and the animation is still active (that can happen when user clicks on
app's icon really fast), the animation will be stopped and a new one will
be created. Such behavior can lead to rapid jumps in the observed
"animation".

A better approach would be first try to **reverse** the already active
animation, and if that attempt wasn't successful, start a new animation.

This patch introduces a new function to the scripted effects API that
lets JavaScript effects to control direction of animations. The
prototype of the function looks as follows:

    redirect(<animation id(s)>, <direction>, [<termination policy>])

the first argument is an animation id or a list of animation ids, the
second argument specifies the new direction of the animation or
animations if a list of ids was passed as the first argument. The
third argument specifies whether the animation(s) should be terminated
when it(they) reaches the source position, currently it's relevant only
for animations that are created with set() function. The termination
policy argument is optional, by default it's Effect.TerminateAtSource.

We can use this function to fix issues with rapid jumps in the Squash
effect. Also, redirect() lets us to write effects for simple animations
in slightly different style: first, we have to start the main animation
(e.g. for the Dialog Parent effect, it would be dimming of main windows)
and then change direction of the animation depending on external events,
e.g. when the Desktop Cube effect is activated.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, abetts, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16449
2018-11-17 13:44:16 +02:00
..
scripts [scripting] Introduce redirect function 2018-11-17 13:44:16 +02:00
CMakeLists.txt [autotests] Unit most scripted effects API 2018-07-31 12:29:04 +01:00
fade_test.cpp Fix FadeTest and TranslucencyTest when started without install 2018-11-07 09:34:38 +01:00
scripted_effects_test.cpp [scripting] Introduce redirect function 2018-11-17 13:44:16 +02:00
slidingpopups_test.cpp Fix slidingpopupstest when run without installtion 2018-11-07 10:51:07 +01:00
translucency_test.cpp Fix FadeTest and TranslucencyTest when started without install 2018-11-07 09:34:38 +01:00
windowgeometry_test.cpp [effects] Delay creation of EffectFrames in WindowGeometryEffect 2017-11-21 19:28:00 +01:00
wobbly_shade_test.cpp Clean up includes 2018-08-31 22:58:11 +03:00