Diffusion KWin 6408e0ba6045

[effects/cube] Fix animation and reflection issues

Authored by poboiko on Jun 1 2018, 3:32 PM.

Description

[effects/cube] Fix animation and reflection issues

The main problem was that inside the effect there was manualVerticalAngle,
which did not represent the actual rotation angle of the cube during the
animation, but used to calculate the position of the reflection. The actual
angle was calculated on-the-fly and was not exposed outside.

Brief description of what the code does:

  • variables currentAngle and verticalCurrentAngle now always represent the

current position of the cube. They are updated when one uses the mouse and
inside the rotateCube() method, which is called in prePaintScreen().

  • two queues, animations (used for Start / Stop / Left / Right) and

verticalAnimations (used for Up / Down) are used for scheduling the animations
if i.e. user presses several keys in a row. The code checks whether the last
animation has finished (and thus we need to start a new one) inside
prePaintScreen() and postPaintScreen()

  • when the animation starts, code saves the starting position of the cube

inside startAngle, startFrontDesktop and verticalStartAngle variables, which
are used to calculate the actual cube position during the animation later.
This is done by startAnimation() and startVerticalAnimation(), which also
calculates the QTimeLine curves needed for animation

BUG: 213599
BUG: 373101

Differential Revision: https://phabricator.kde.org/D9860

Details