I was gone for a week on a magical journey, but now I’m back, and it’s time to increase the level of seriousness on the internet again.

Today I’m going to talk about something new in E18: custom compositor animations. Currently they’re only used for desk flips, but I have plans to do other neat things with them at some point.

Here’s an example compositor effect. I’ve once again linked off site because code formatting is awful on wordpress. This is the most basic effect, set as the default and known as “Pane”. It causes windows to slide horizontally or vertically to simulate panning around on a workspace. I have no idea why it’s not named “Pan”.

I’m going to go through this a bit upside down since I think it’ll make more sense that way, and because my boss is Australian. I suggest checking out the EDC Reference if you aren’t familiar with the script.

Parts

To begin, there are two parts to this: a SPACER and a SWALLOW. The SWALLOW part, e.swallow.content, is what will contain an application’s window; this is the important part. It’s set to match the geometry of the SPACER part, mover. This means that if the SPACER here is moved or resized in any way, the window contents will move and resize to match this.

Programs

There are four basic programs below the parts, triggered by signals from E18, which cause the animation to occur. One signal (“e,action,go”) causes the animation to play forwards when the mover part is in the starting state, and it also causes the animation to play in reverse when the mover part is in the ending state. Another signal from E18 can cause the animation to stop immediately (program #3), and the final program sends a signal to E18 to notify when the animation has completed.

Scary Programs

Back up at the top, we see some scary-looking Embryo scripts. These are just two separate callbacks which are run when setting up the animations. The first one, on lines 7-13, tells the animation which end to start at. When, for example, we are showing a virtual desktop which was previously hidden, we need to start in the “hide” state, play the animation in reverse, and end in the “start” state–this is when the callback receives state:1. The opposite is true when receiving state:0.

The other Embryo callback is a signal sent just before the animation is triggered, and it contains animation-specific data. For the “auto” effects, the data is expected to be the position and size of the affected object (x, y, w, h), the size of the screen that the object is on (w, h), and the direction that the object is moving in (x, y; -1 for moving left/up, 1 for moving right/down), or eight integers total.

In this effect, I get the screen geometry and movement parameters, calculate a vector, and then create a custom Embryo state for the mover part with the translated coordinates as the offsets. This effectively moves the part, and the window contents since they’re always relative to it, from A to B between the normal position and the calculated end point. After this setup occurs, when the basic program triggers the animation, Edje will automatically run the whole thing for you. Additionally, by just adding the animation into an E18 edj theme somewhere it will show up and become accessible through the Virtual Desktops Settings config dialog.

Inheritance

Now you might be saying, “But E18ReleaseManager, that’s too much code for me to write. I don’t have months and months to write code like you do. Well, I’ve got the perfect solution for you: group inheritance. This great, and totally-not-buggy-in-any-way feature, makes creating basic new effects a snap. As an example, here’s the new “Grow” effect that I wrote in 30 seconds this morning. You’ll see that nearly all the code is the same, except that I’m just grabbing the direction and setting the mover size based on which way the shift is going. Specifically, I’m setting the rel1/rel2 sizes to make the SWALLOW part have a size of 0 along at least one axis, causing it to expand or shrink during animation.

The result:

Other, Less Important Things To Mark On Your Life Calendar:

EFM windows now accept DND operations more reliably

Window remembers now apply their changes when they get assigned to their matching windows

Shelf config dialog now sets current value for stacking

Tasks gadgets no longer update their border icons as frequently

Mousing over an extremely precise spot on the desktop with icons in an equally precise configuration will no longer trigger a tooltip-related crash

Added a single #define at the top of comp_effects.edc to make it faster to change compositor animation durations

I’m hungry

Share this: Twitter

Facebook

Like this: Like Loading... Related

This entry was posted by e-releasemanager.