[compiz] g-w-d.c -> my head spins
David Reveman
davidr at novell.com
Fri Apr 7 05:48:25 PDT 2006
On Thu, 2006-04-06 at 14:28 +0100, Mike Hearn wrote:
> Mirco Müller wrote:
> > I'm currently looking like a jackass and feel just dumb for not really
> > comprehending the code :/
>
> Hardly :) The code is lacking comments, and I've had a hard time
> figuring parts out too. One thing I'd like to do at some point is go
> through one of the plugins and add some detailed comments explaining
> what each part does. The HTML tutorial is a good start but there are
> many details it misses out.
Any work like that is much appreciated.
>
> For instance it took me a little while to figure out the animation
> scheme used ... in the past when I've done animation the algorithm I
> used was something like record the start time of the animation, for each
> loop around the paint code take the current time, calculate the
> "progress" as a value between 0 and 1 then lock the animation relative
> to that. So you specify in the code how many seconds an animation should
> last for.
You can do this in compiz if you like, there's nothing that stops you
from that.
>
> Compiz uses a different scheme in which the elapsed time is used to
> calculate the number of steps and each steps progress is defined as an
> option. The way the number of steps is calculated and what the
> "timestep" option does still isn't really clear to me, but when I figure
> it out I'll try documenting it for others.
Most of the currently plugins use a system where you have an
acceleration, velocity and how to adjust these are calculated from the
distance to target position/scale.. This has proven to make the
animations in the existing plugins look good. For other plugins this
might not be the case at all. btw, the acceleration/velocity code could
need some cleanup.
>
> Likewise the screen grab API isn't too hard to understand when you
> figure it out but IMHO it's otherwise not obvious that "if
> (ss->grabIndex)" means "if the animation is currently in progress".
Well, it means you're currently holding a "grab index", which means that
you're one of possibly more plugins that have the screen grabbed.
Doesn't have to mean that an animation is in progress but as most
plugins grab the screen until their animation is done it's often used
for this.
-David
More information about the compiz
mailing list