Commit Graph

5394 Commits

Author SHA1 Message Date
Emmanuele Bassi
24d43cd076 actor: Check easing duration when updating in-flight transitions
If we update a transition that is currently playing, we need to check
the current easing state, and look at the eventual duration, in case
the user wants to cancel the transition.
2012-03-28 12:43:57 +01:00
Emmanuele Bassi
3c1358da5d table-layout: Fix [xy]_expand
A copy and paste thinko.

https://bugzilla.gnome.org/show_bug.cgi?id=672853
2012-03-28 12:01:25 +01:00
Jasper St. Pierre
628ffa7b91 actor: Invalidate the current state when popping easing states
https://bugzilla.gnome.org/show_bug.cgi?id=672945
2012-03-28 11:56:01 +01:00
Emmanuele Bassi
fa8d431941 actor: Simplify setters of animatable properties
Instead of checking the duration of the current easing state we should
check if there's a transition in progress, and update it
unconditionally.

If there is no easing state, or the easing state has a duration of zero
milliseconds, then create_transition() should bail out early and set the
requested final state.

This allows us to write:

  clutter_actor_save_easing_state (actor);
  clutter_actor_set_x (actor, 200);
  clutter_actor_restore_easing_state (actor);

  [...]

  clutter_actor_set_x (actor, 100);

and have the second set_x() update the easing in progress, instead of
being ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=672945
2012-03-28 11:52:01 +01:00
Emmanuele Bassi
f4af52ca7f Remove unused fields from LayoutInfo
The x_expand and y_expand members would mess up the initialization of
the constant LayoutInfo default structure.
2012-03-27 12:09:28 +01:00
Emmanuele Bassi
b074db869c actor: Add debug annotation in add_transition() 2012-03-27 11:38:04 +01:00
Emmanuele Bassi
1ef85372cc actor: Add IN_DESTRUCTION checks
Commit 80626e7584 removed an
IN_DESTRUCTION check from within the add_child_internal() method,
outlining an option for bringing it back. It was too late for the 1.10
cycle to do it, and eventually pick up the pieces, but now that we're
at the beginning of the 1.11 cycle we can restore it, and add checks
elsewhere to balance it.
2012-03-27 11:38:04 +01:00
Tristan Van Berkom
67058229f0 Properly manage timeline refcounting in clutter_animation_set_timeline()
This patch fixes clutter to not crash when multiple animations share
the same timeline and the actors are explicitly destroyed before
the timeline completes (bug 672890)
2012-03-27 16:57:38 +09:00
Neil Roberts
c9a81f035e Don't use any GL types or defines in Clutter
Some of the Clutter code was using GL types for the primitive types
such as GLint and GLubyte and then passing these to Cogl. This doesn't
make much sense because the Cogl functions directly take native C
types. This patch just replaces them with either a native C type or a
glib type.

Some of the cogl conformance tests are trying to directly call GL for
example to test creating a foreign texture. These tests have been
changed to manually define the GL enum values instead of relying on a
GL header to define them.

This is necessary because Cogl may soon stop including a GL header
from its public headers.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-23 17:24:42 +00:00
Neil Roberts
04f2be34b2 configure: Fix the -o operator in a call to test
The disjunction operator was misspelt as -O which tests whether the
following file is owned by the calling user. This doesn't take enough
arguments so bash was showing an error and the test was always
failing. This meant that NEED_XKB_UTILS was always false which should
have broken the build but the Makefile was mistakenly including
clutter-xkb-utils.c again if SUPPORT_WAYLAND is defined.

See 1b77565e for reference.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-23 16:42:35 +00:00
Emmanuele Bassi
1b3777f169 version: Add 1.12 version macros 2012-03-22 12:00:56 +00:00
Emmanuele Bassi
22fad59c26 osx: Fix compilation warnings
https://bugzilla.gnome.org/show_bug.cgi?id=672536
2012-03-22 12:00:55 +00:00
Emmanuele Bassi
2bf5e89140 Fix fallback profile counter macro 2012-03-22 12:00:55 +00:00
Jasper St. Pierre
40c345a42a table-layout: Remove dead code
If a column/row is expanding, n_expand has to be greater than 1.

https://bugzilla.gnome.org/show_bug.cgi?id=672557
2012-03-21 11:41:25 -04:00
Jasper St. Pierre
8c0be4181b table-layout: Fix x/y-expand for spanning actors
Ported to ClutterTableLayout from MxTable:

239e53146a

https://bugzilla.gnome.org/show_bug.cgi?id=672557
2012-03-21 11:41:25 -04:00
Jasper St. Pierre
16d28853fa table-layout: Fix column visibility for spanning actors
Ported to ClutterTableLayout from MxTable:

6633f185fc

https://bugzilla.gnome.org/show_bug.cgi?id=672557
2012-03-21 11:41:25 -04:00
Jasper St. Pierre
67ddf8745b table-layout: Remove unused 'shrink' field.
Ported to ClutterTableLayout from MxTable:

053a1b0429

https://bugzilla.gnome.org/show_bug.cgi?id=672557
2012-03-21 11:41:25 -04:00
Jasper St. Pierre
5dc1cd399c actor: Freeze property change notifications on destroy 2012-03-21 11:41:25 -04:00
Emmanuele Bassi
d7c922c72a docs: Clean up the animations sections of the Actor reference 2012-03-21 13:36:44 +00:00
Emmanuele Bassi
e3cbec48a8 paint-node: Initialize ClutterPaintOperation
Don't leave it to the compiler.
2012-03-20 16:19:23 +00:00
Robert Bragg
f1aa16069d clutter-wayland-compositor.h: Adds missing header guards
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:37:08 +00:00
Neil Roberts
dee544645b wayland: Fix some missing includes
The commit 90e5088 added some extra compiler warning options that were
triggering warnings when enabling the wayland build due to missing
header includes. This adds those header includes in.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:36:58 +00:00
Robert Bragg
cf96c9caf3 include standalone cogl-wayland-server/client headers
Because the wayland-server-protocol.h header includes symbols that
collide with wayland-client-protocol.h Cogl now provides top level
<cogl/cogl-wayland-server.h> and <cogl/cogl-wayland-client.h> headers so
that applications can ensure they only include one of the wayland
protocol headers in a particular compilation unit. This updates clutter
accordingly to include those headers.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2012-03-20 14:36:50 +00:00
Rob Bradford
568951b8ac wayland: Only try and resize the framebuffer if there is a valid framebuffer 2012-03-20 13:32:20 +00:00
Emmanuele Bassi
d6e710d252 docs: Fix typo 2012-03-20 12:06:21 +00:00
Emmanuele Bassi
7af1d4b847 docs: Add a section on actor animations
Detail the implicit and explicit animation models used by ClutterActor.
2012-03-20 11:59:32 +00:00
Emmanuele Bassi
15952f26cb property-transition: Remove animatable from the ctor
Should not have been there in the first place: the animatable will be
set either using ClutterTransition API, or when adding the transition
to a ClutterActor.
2012-03-20 11:59:32 +00:00
Emmanuele Bassi
552a949695 Use g_clear_object() instead of unref() + NULL 2012-03-20 11:22:07 +00:00
Emmanuele Bassi
227c7b404d actor: Clarify and improve memory management of transitions
When adding a transition to a ClutterActor, the actor should hold a
reference on it, and release it only when we remove it. This makes
transitions just like other objects held by ClutterActor.
2012-03-20 11:17:53 +00:00
Emmanuele Bassi
65cf2039d8 timeline: Increment current-repeat after ::completed
The ::completed signal emission is part of the current cycle; repeating,
like the automatic reverse of the timeline's direction, happens after
the ::completed chain of handlers has been called.
2012-03-19 18:07:26 +00:00
Emmanuele Bassi
28266a59ed docs: Fixes for the API reference 2012-03-19 14:57:46 +00:00
Emmanuele Bassi
5a77f814ab x11/keymap: Silence deprecation warnings around a fallback
We still use XKeycodeToKeysym() in a fallback path in case we're not
running on a decent enough system; XKeycodeToKeysym() is deprecated as
of version 1.12 of the X server, but since I don't want to copy a bunch
of code from GDK or, god forbid, from Xlib, for a fallback path, it's
probably more reasonable to just silence the compiler warnings - at
least until we can drop all the X compatibility crap, and just use
modern, or semi-modern, API.
2012-03-19 14:40:46 +00:00
Emmanuele Bassi
09a317d23d x11: Add support for touch events
For the time being, we just relay everything we get from the X server to
the Clutter application.
2012-03-19 14:29:24 +00:00
Emmanuele Bassi
d15b828cc5 event: Add ClutterTouchEvent
The ClutterTouchEvent structure contains the data relative to a touch
event.
2012-03-19 14:29:24 +00:00
Emmanuele Bassi
ab3582be1c gdk: Relay scroll delta from GDK 2012-03-19 14:29:23 +00:00
Emmanuele Bassi
1c500f7de9 x11: Reset scroll valuators
We need to clear up the state on enter and leave, as well as when the X
server tells us that the device has changed.
2012-03-19 14:29:23 +00:00
Emmanuele Bassi
676a317439 x11: Add support for scroll valuators on XInput2.2 2012-03-19 12:41:24 +00:00
Emmanuele Bassi
6b07f8a3df event: Expose precise scrolling information
Some events may contain precise scrolling information coming from
devices like trackpads and touchscreens. ClutterEvent should allow
setting and getting this information.
2012-03-19 12:41:24 +00:00
Emmanuele Bassi
103438cfe2 actor: Add ::transitions-completed signal
While you can get a per-transition notification of completion, it can be
convenient to also have a way to notify that all the transitions
involving an actor are complete. A simple signal triggered by the
removal of the last transition fits the bill pretty neatly.
2012-03-18 08:07:56 +00:00
Jasper St. Pierre
a37ec4bd34 script-parser: Fix build 2012-03-18 03:08:00 -04:00
Lionel Landwerlin
4d42904fcc x11/stage: fix multi-stage support
When handling Configure events from the X server we update the
internal copy of the window size. Unfortunately we may be updating the
wrong stage implementation because we use the one related to the event
translator (which is the first created stage).

This patch fix flickering/redrawning issues with multi-stage by
looking for the right stage implementation associated with an XEvent.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
2012-03-18 00:17:36 +00:00
Emmanuele Bassi
d5738b6bd4 script: Add 'context' to the translatable definitions
This should cover all the possible options.
2012-03-17 22:55:33 +00:00
Emmanuele Bassi
05f78306d1 actor: Avoid popping the easing state stack once too many
If restore_easing_state() is called on the last easing state on the
stack, clean up the stack, so that we don't leave stale pointers
around to later segfault on.
2012-03-17 16:49:35 +00:00
Emmanuele Bassi
229241b875 actor: Remove the implicit easing state save
When setting the easing mode, duration, or delay without having ever
called clutter_actor_save_easing_state(). It's confusing, and not
really nice.

In the future, we'll have a default easing state implicitly created by
the actor itself, but for the time being explicitly opting in is
preferrable.
2012-03-17 16:46:38 +00:00
Emmanuele Bassi
b3b1994c13 Use G_VALUE_INIT instead of { 0, }
The macro avoids warnings from anal-retentive compilers.
2012-03-17 16:40:55 +00:00
Emmanuele Bassi
82bc728584 Add initializer utilities for ClutterVertex
Similar to what we did for ClutterActorBox.
2012-03-17 16:29:09 +00:00
Emmanuele Bassi
63f3eaab62 actor: Fix set_scale_with_gravity()
Add a scale-gravity internal setter, and make set_scale_with_gravity()
call it, along with the scale factor.
2012-03-17 16:17:39 +00:00
Emmanuele Bassi
5e9d6f7257 Add some utility initializers to ClutterActorBox 2012-03-17 15:27:26 +00:00
Emmanuele Bassi
b6f5609b2f osx/stage: Synthesize an enter event on show
If the pointer is inside the window frame when it's shown then we need
to synthesize and emit a NSMouseEnterEvent ourselves, as Quartz won't
do it for us.

This is a bit of a blind commit - but it's taken from an equivalent
patch that has been verified to work in GDK.
2012-03-16 23:12:33 +00:00
Emmanuele Bassi
f7735ff1ad docs: Change the short description of ClutterActor
The Actor class is not abstract any more.
2012-03-16 18:10:34 +00:00
Emmanuele Bassi
e5e10b6a04 Annotate functionality added in 1.10 2012-03-16 17:30:26 +00:00
Emmanuele Bassi
1df14c1bac Debugging cleanups
Add some more debugging notes to the layout and paint node output.
2012-03-16 16:16:40 +00:00
Emmanuele Bassi
a7714e294e actor: Remove an has_allocation() check
The get_content_box() method should always succeed; if the actor does
not have an allocation, we are just going to return a 0-box.
2012-03-16 16:13:11 +00:00
Emmanuele Bassi
800b5b6ef7 actor: Restore a lost queue_relayout()
It got lost during a rebase conflict resolution.
2012-03-16 14:47:02 +00:00
Emmanuele Bassi
ae554a5061 Rename 'bilinear' scaling filter to 'trilinear'
Yes, it's not really the proper GL name for a linear-on-every-axis of a
texture plus linear-between-mipmap-levels minification filter, but it
has three redeeming qualities as a name:

  - LINEAR_MIPMAP_LINEAR sucks, as it introduces GL concepts like
    mipmaps in the API naming, while we're trying to avoid that;
  - people using GL already know what 'trilinear' means in this context
    without going all Khronos on their asses;
  - we're using 2D textures anyway, so 'linear on two axes and linear
    between mipmap levels' can be effectively approximated to
    'trilinear'.

I mean, if even the OpenGL official wiki says:

  Unfortunately, what most people think of as "trilinear" is not linear
  filtering of a 3D texture, but what in OpenGL terms is GL_LINEAR mag
  filter and GL_LINEAR_MIPMAP_LINEAR in the min filter in a 2D texture.
  That is, it is bilinear filtering of each appropriate mipmap level,
  and doing a third linear filter between the adjacent mipmap levels.
  Hence the term "trilinear".
                -- http://www.opengl.org/wiki/Texture

then the horse has already been flogged to death, and I don't intend to
be accused of necrophilia and sadism by flogging it some more.

Prior art: every single GL tutorial in the history of ever;
CoreAnimation's scaling filter enumerations.

If people want to start using 1D or 3D textures they they are probably
going to be using Cogl API directly, and that has the GL naming scheme
for minification and magnification filters anyway.
2012-03-16 12:33:40 +00:00
Emmanuele Bassi
b44290c436 docs: Add ClutterActorClass.paint_node() description 2012-03-16 12:33:40 +00:00
Emmanuele Bassi
8904f7cbe4 paint-nodes: Make part of the API internal
At least for the time being, we only expose the parts of the API that we
want to use internally and for new, out-of-tree Content implementations.

The full PaintNode tree API will be made public in 1.12 once we branch
master.
2012-03-16 12:33:40 +00:00
Emmanuele Bassi
74f5bbe5aa docs: Fixes for ClutterImage's API reference 2012-03-16 12:33:39 +00:00
Emmanuele Bassi
0a2ee1709b docs: Fixes for the API reference 2012-03-16 12:33:39 +00:00
Emmanuele Bassi
10e2f551f5 actor: Unconditionally emit ::paint
It's a bit late in the game for changing the emission of the paint
signal with actors that use paint nodes - mostly because we have both
implicit paint nodes (background color, content) and explicit paint
nodes (the paint_node virtual).

When we branch for 1.12 we can revert this change.
2012-03-16 12:33:39 +00:00
Emmanuele Bassi
5432775eff paint-node: Make texture template pipeline clamp to edge
It's safer, and consistent with the rest of Clutter, to make sure that
the template pipeline we use for ClutterTextureNode has its wrap mode
set to clamp-to-edge.
2012-03-16 12:33:39 +00:00
Emmanuele Bassi
75e6560160 image: Add set_area() method
This method allows replacing an area inside the texture data used by a
ClutterImage.
2012-03-16 12:33:39 +00:00
Emmanuele Bassi
2be850f441 image: Add get_texture()
Allow retrieving the Cogl texture used by the ClutterImage.
2012-03-16 12:33:39 +00:00
Emmanuele Bassi
9845ce9d89 actor: Fix RESIZE_ASPECT mode for the content box 2012-03-16 12:33:38 +00:00
Emmanuele Bassi
b6403b01a1 Documentation fixes 2012-03-16 12:33:38 +00:00
Emmanuele Bassi
f90330867e Update clutter.symbols 2012-03-16 12:33:38 +00:00
Emmanuele Bassi
fb106ece05 Use the content scaling filters
Both ClutterCanvas and ClutterImage should use the minification and
magnification filters set on the actor, just like the use the content
box and the paint opacity.
2012-03-16 12:33:38 +00:00
Emmanuele Bassi
77729c7362 actor: Add minification/magnification filters
These settings are informative, and will only be used by the eventual
content of an actor.
2012-03-16 12:33:38 +00:00
Emmanuele Bassi
cadae5b325 Add ClutterImage, and image data content 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
f2b9c17a78 canvas: Fix single header inclusion guard 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
0eeb61f3a8 canvas: Add canvas size to the ::draw signal
Instead of requiring a call to clutter_content_get_preferred_size(), we
can simply pass the canvas size to the Canvas::draw signal.
2012-03-16 12:33:37 +00:00
Emmanuele Bassi
07bb35bbe3 Add ClutterCanvas, a drawing content 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
e2f1153c46 paint-node: Remove redundant declarations 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
546a14ec3b content: Make get_preferred_size() public 2012-03-16 12:33:37 +00:00
Emmanuele Bassi
e54ee64380 actor: Make paint_node() and ::paint mutually exclusive
The ::paint signal is the old way to paint an actor; the paint_node()
virtual function is the new way. It's still not possible to traverse the
whole scene graph and build a render tree of PaintNode instances, but
with this change we simultaneously cut out the ::paint signal emission
from the critical path for actors that are using the new PaintNode-based
API, and we retain backward compatibility in the interim period between
1.10 and 2.0.
2012-03-16 12:33:37 +00:00
Emmanuele Bassi
a58be8aad1 paint-nodes: Fix compiler warning 2012-03-16 12:33:36 +00:00
Emmanuele Bassi
51cca132e0 paint-nodes: Use logical extents for the TextNode::draw
When we decide if we ought to clip, we should use the logical extents of
the PangoLayout, just like we do for ClutterText.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
fa77274e80 content: Turn attached and detached into signals
The attached and detached virtual functions are now informative, and not
normative - which means it's a good idea to provide them as signals.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
2f0d29ad75 content: Make vfuncs optional
The virtual functions on the ClutterContent interface should provide
hooks for application code, not be the actual implementation.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
f4d8fb054a paint-node: Use JSON-GLib for debug serialization
Instead of our homegrown string building; this at least ensures that
we're generating proper data, instead of random strings. Plus, using
JsonNode and JsonBuilder, we can ask the PaintNode subclasses to
serialize themselves in a sensible way.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
2ee5851970 docs: Update the API reference
Add all the new symbols.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
6cddd69747 docs: Update documentation on the paint sequence 2012-03-16 12:33:36 +00:00
Emmanuele Bassi
be4746b15f Add ClutterContent
ClutterContent is an interface for creating delegate objects that handle
what an actor is going to paint.

Since they are a newly added type, they only hook into the new PaintNode
based API.

The position and size of the content is controlled in part by the
content's own preferred size, and by the ClutterContentGravity
enumeration.
2012-03-16 12:33:36 +00:00
Emmanuele Bassi
6f0782e0a4 actor: Add paint_node virtual function
The ::paint-node virtual inside ClutterActor is what we want people to
use when painting their actors.

Right now, it's a new code path, that gets called while painting; the
paint_node() implementation should only paint the actor itself, and not
its children — they will get their own paint_node() called when needed.

Internally, ClutterActor will automatically create a dummy PaintNode and
paint the background color; then control will be handed out to the
implementation on the class. This is required to maintain compatibility
with the old ::paint signal emission.

Once we are able to get rid of the paint (and pick) sequences, we'll
switch to a fully retained render tree.
2012-03-16 12:33:35 +00:00
Emmanuele Bassi
b83dc6abfa Add PaintNode, an element on the render object tree
Now that we have a proper scene graph API, we should split out the
rendering part from the logical and event handling part.

ClutterPaintNode is a lightweight fundamental type that encodes only the
paint operations: pipeline state and geometry. At its most simple, is a
way to structure setting up the programmable pipeline using a
CoglPipeline, and submitting Cogl primitives. The important take away
from this API is that you are not allowed to call Cogl API like
cogl_set_source() or cogl_primitive_draw() directly.

The interesting approach to this is that, in the future, we should be
able to move to a purely retained mode: we will decide which actors need
to be painted, they will update their own branch of the render graph,
and we'll take the render graph and build all the rendering commands
from that.

For the 1.x API, we will have to maintain invariants and the existing
behaviour, but as soon as we can break API, the old paint signal will
just go away, and Actors will only be allowed to manipulate the render
tree.
2012-03-16 12:33:35 +00:00
Emmanuele Bassi
cbcc84022e animator: Fix NULL check 2012-03-15 17:51:22 +00:00
Emmanuele Bassi
7f1f9a50c1 actor: Remove G_SIGNAL_NO_RECURSE
As it turns out, we do end up recursing inside the ::paint signal
emission - especially inside the conformance test suite.

This thoroughly sucks - and we'll only be able to fix it properly
when we bump API for 2.0.
2012-03-15 17:41:28 +00:00
Emmanuele Bassi
6a8d67a8ad I should compile the changes I make 2012-03-15 17:32:53 +00:00
Emmanuele Bassi
5e652b91d6 actor: Fix get_transition() method
We now store a closure, not directly a ClutterTransition instance.
2012-03-15 17:31:36 +00:00
Emmanuele Bassi
9e1ec82838 doc: Reference fixes 2012-03-15 17:01:14 +00:00
Emmanuele Bassi
0cf9ad82c4 symbols: Update 2012-03-15 17:01:14 +00:00
Emmanuele Bassi
4bd3583dbf actor: Add generic transition support
ClutterActor should be able to hold all transitions, even the ones that
have been explicitly created.

This will allow to add new transitions types in the future, like the
keyframe-based one, or the transition group.
2012-03-15 17:01:14 +00:00
Emmanuele Bassi
3638c1efed transition: Clear the animatable member when removing on complete 2012-03-15 17:01:14 +00:00
Emmanuele Bassi
514466601e transition: Check the repeat count to remove on complete
We can now ask the timeline for the current repeat, and if it's the last
one, then we can safely detach the transition from the animatable
instance.
2012-03-15 17:01:13 +00:00
Emmanuele Bassi
388f818f41 timeline: Add more state accessors
It should be possible to ask a timeline what is its duration, taking
into account eventual repeats, and which repeat is the one currently
in progress.

These two functions allow writing animations that depend on the current
state of another timeline.
2012-03-15 17:01:13 +00:00
Emmanuele Bassi
1511e588df actor: Add delay to the easing state
It should be possible to set up the delay of a transition, but since
we start the Transition instance before returning control to the caller,
we cannot use clutter_actor_get_transition() to do it without something
extra-awkward, like:

  transition = clutter_actor_get_transition (actor, "width");
  clutter_timeline_stop (transition);
  clutter_timeline_set_delay (transition, 1000);
  clutter_timeline_start (transition);

for each property involved. It's much easier to add a delay to the
easing state of an actor.
2012-03-15 17:01:13 +00:00
Emmanuele Bassi
dda4db378c symbols: Update 2012-03-15 17:01:13 +00:00
Emmanuele Bassi
67113ed690 actor: Implement implicit animatable properties
Clutter is meant to be, and I quote from the README, a toolkit:

  for creating fast, compelling, portable, and dynamic graphical
  user interfaces

and yet the default mode of operation for setting an actor's state on
the scene graph (position, size, opacity, rotation, scaling, depth,
etc.) is *not* dynamic. We assume a static UI, and then animate it.

This is the wrong way to design an API for a toolkit meant to be used to
create animated user interfaces. The default mode of operation should be
to implicitly animate every state transition, and only allow skipping
the animation if the user consciously decides to do so — i.e. the design
tenet of the API should be to make The Right Thing™ by default, and make
it really hard (or even impossible) to do The Wrong Thing™.

So we should identify "animatable" properties, i.e. those properties
that should be implicitly animated by ClutterActor, and use the
animation framework we provide to tween the transitions between the
current state and the desired state; the implicit animation should
happen when setting these properties using the public accessors, and not
through some added functionality. For instance, the following:

  clutter_actor_set_position (actor, newX, newY);

should not make the actor jump to the (newX, newY) point; it should
tween the actor's position between the current point and the desired
point.

Since we have to maintain backward compatibility with existing
applications, we still need to mark the transitions explicitly, but we
can be smart about it, and treat transition states as a stack that can
be pushed and popped, e.g.:

  clutter_actor_save_easing_state (actor);

    clutter_actor_set_easing_duration (actor, 500);
    clutter_actor_set_position (actor, newX, newY);
    clutter_actor_set_opacity (actor, newOpacity);

  clutter_actor_restore_easing_state (actor);

And we can even start stacking animations, e.g.:

  clutter_actor_save_easing_state (actor);

    clutter_actor_set_easing_duration (actor, 500);
    clutter_actor_set_position (actor, newX, newY);

    clutter_actor_save_easing_state (actor);

      clutter_actor_set_easing_duration (actor, 500);
      clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR);
      clutter_actor_set_opacity (actor, newOpacity);
      clutter_actor_set_depth (actor, newDepth);

    clutter_actor_restore_easing_state (actor);

  clutter_actor_restore_easing_state (actor);

And so on, and so forth.

The implementation takes advantage of the newly added Transition API,
which uses only ClutterTimeline sub-classes and ClutterInterval, to cut
down the amount of signal emissions and memory management of object
instances; as well of using the ClutterAnimatable interface for custom
properties and interpolation of values.
2012-03-15 17:01:12 +00:00
Emmanuele Bassi
40bcbf9c0d Add ClutterPropertyTransition
ClutterPropertyTransition is a ClutterTransition that animates a
property of a ClutterAnimatable implementation.
2012-03-15 17:01:12 +00:00
Emmanuele Bassi
0c8443f71a Add ClutterTransition
ClutterTransition is a Timeline sub-class that allows interpolation of a
value between the initial and final states held by a ClutterInterval.
2012-03-15 17:01:12 +00:00