D16449: [scripting] Introduce redirect function

Vlad Zagorodniy <[email protected]>
Newsgroups gmane.comp.kde.devel.kwin
Message-ID <[email protected]>
zzag created this revision.
zzag added a reviewer: KWin.
Herald added a project: KWin.
Herald added a subscriber: kwin.
zzag requested review of this revision.

REVISION 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.

REPOSITORY
  R108 KWin

REVISION DETAIL
  https://phabricator.kde.org/D16449

AFFECTED FILES
  autotests/integration/effects/scripted_effects_test.cpp
  autotests/integration/effects/scripts/redirectAnimateDontTerminateTest.js
  autotests/integration/effects/scripts/redirectAnimateTerminateTest.js
  autotests/integration/effects/scripts/redirectSetDontTerminateTest.js
  autotests/integration/effects/scripts/redirectSetTerminateTest.js
  libkwineffects/anidata.cpp
  libkwineffects/anidata_p.h
  libkwineffects/kwinanimationeffect.cpp
  libkwineffects/kwinanimationeffect.h
  scripting/scriptedeffect.cpp
  scripting/scriptedeffect.h

To: zzag, #kwin
Cc: kwin, mkulinski, ragreen, jackyalcine, Pitel, iodelay, bwowk, ZrenBot, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas, apol, mart
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.