1
0
Fork 0
Commit graph

734 commits

Author SHA1 Message Date
Emmanuele Bassi
14572f4db0 actor: Call show() on set parent conditionally
This commit adds a further conditional check for calling
clutter_actor_show() when adding a child to an actor. We cannot
unconditionally change the value of the show-on-set-parent property like
the original solution of commit 81b19a78f5
as that breaks the document invariant that show-on-set-parent will be
changed iff an actor is without a parent.

The new ADD_CHILD_SHOW_ON_SET_PARENT flag is part of the default and
legacy flags, thus retaining the default behaviour when adding a child;
the flag is not passed when reordering the list of children, which means
we ignore the state of the show-on-set-parent property.

The conformance test suite fully passes, including the newly added test
to verify that changing the paint order does not trigger visibility.

https://bugzilla.gnome.org/show_bug.cgi?id=674510
2012-04-26 14:06:00 +01:00
Emmanuele Bassi
a2f54c59f5 Revert "actor: Unconditionally set show_on_set_parent"
This reverts commit 81b19a78f5.

The commit breaks the conformance test unit for the invariants we
guarantee for the 1.x API:

ERROR:actor-invariants.c:307:actor_show_on_set_parent: assertion failed: (show_on_set_parent)
2012-04-26 14:02:07 +01:00
Jasper St. Pierre
81b19a78f5 actor: Unconditionally set show_on_set_parent
Otherwise, doing something like adjusting the child's position
on a hidden actor will re-show it, which is not what we want.

https://bugzilla.gnome.org/show_bug.cgi?id=674510
2012-04-24 11:25:42 -04:00
Jasper St. Pierre
0287dc26ad actor: Not-actors don't have metas 2012-04-24 11:25:42 -04:00
Emmanuele Bassi
7fffb7290e actor: Return a valid paint volume by default
It's been a year and change, and two stable releases, since we
introduced the paint volume mechanism to allow actors to paint outside
their allocation safely in environments that support clipped redraws.

The time has come to flip the switch, and return a valid paint volume,
matching the actor's allocation, by default - at least for Actor
instances from classes that do not override paint() and
get_paint_volume().

If an actor has a paint signal handler then it's the user responsability
not to paint outside the allocation - and to suffer the consequences of
doing so; in an ideal world, paint() would not be a signal in the first
place anyway. Plus, the idea that painting can happen at any time and
still have a valid surface greatly conflicts with the design goal of
making Clutter's rendering operations fully retained into a render tree.

We can still revert this commit before spinning 1.12, if need be.
2012-04-12 17:50:43 +01:00
Emmanuele Bassi
119a25269e actor: Check for mapped children in the default get_paint_volume()
Unmapped children won't be painted so they should not contribute to the
default paint volume computation.
2012-04-12 17:07:06 +01:00
Emmanuele Bassi
98c9dad42f actor: Clear MetaGroups when empty
When removing the last Action, Constraint, or Effect, we should also be
clearing the corresponding MetaGroup: code inside ClutterActor relies on
NULL checks, and changing them all to check for NULL && n_items == 0
would not be fun.
2012-04-12 17:04:57 +01:00
Emmanuele Bassi
14b9cb4f7b actor: Fix completed transitions logic
We need to remove the transition only if the current repeat is equal to
the number of repeats, and if the transition was marked as remove on
complete. Otherwise, the transition has to remain where it is.
2012-04-11 13:57:06 +01:00
Emmanuele Bassi
ab486bfe70 actor: Remove unnecessary relayout/redraw calls
They will be handled internally.
2012-04-10 13:37:04 +01:00
Emmanuele Bassi
de9112bc8c actor: Do not queue_redraw() in set_opacity()
The opacity internal setter will do it for us, and it will take into
consideration any eventual flatten effect applied to the actor.

This unbreaks the actor-offscreen-redirect conformance test.
2012-04-10 12:59:16 +01:00
Emmanuele Bassi
d45420f992 actor: Make _clutter_actor_foreach_child() safe again
We were using g_list_foreach() prior to the first Apocalypse, and that
function is resilient against changes to the list while iterating it;
since we are not using a GList any more, we need handle this case
ourselves.
2012-03-29 15:52:51 +01:00
Emmanuele Bassi
499534f3ac actor: Make :content-gravity animatable
Let's start making some non-trivial property animatable, like the
content gravity.
2012-03-29 15:11:52 +01:00
Emmanuele Bassi
97dcfe5bf1 actor: Ensure that we correctly remove transitions
The check on :remove-on-complete was inverted, but we also need to check
that the current repeat of the timeline is also the last.
2012-03-29 12:01:03 +01:00
Emmanuele Bassi
ff9a503c14 actor: Minor optimization to avoid get_preferred_*
When the easing state has a duration of zero milliseconds we can skip
the entire create_transition() call inside set_width() and set_height(),
to avoid what may be a costly call to get_preferred_*.
2012-03-28 18:07:06 +01:00
Emmanuele Bassi
cede56dcdd actor: Ensure we use the current easing duration and mode
When updating a transition in flight, if the current easing state does
not match the transition's.
2012-03-28 16:39:30 +01:00
Emmanuele Bassi
824dfcc67e docs: Mention in-flight value changes 2012-03-28 13:21:58 +01:00
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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