Commit Graph

842 Commits

Author SHA1 Message Date
Emmanuele Bassi
3fdee4efe9 docs: Fix syntax errors in annotations 2013-12-04 16:09:09 +00:00
Emmanuele Bassi
705640367a Use the non-deprecated Cogl clipping API
Cogl 1.18 deprecated the global clipping API in favour of the
per-framebuffer one, but since we're using the 2.0 API internally we
don't have access to the deprecated symbols any more.

This is pretty much a mechanical port for all the places where we're
still using the old 1.x API.
2013-12-04 16:07:17 +00:00
Emmanuele Bassi
1b45841414 actor: Add private getter for the active framebuffer
Instead of asking every internal user to get the stage and get the
active framebuffer from it, we can wrap it up ourselves, and do some
sanity checks as well.
2013-12-04 16:07:17 +00:00
Owen W. Taylor
2e85269368 Don't queue redraws when reallocating actor that haven't moved
When support for implicit animation of actor position was added,
the optimization for not queueing when allocating an actor back
to the same location was lost. This optimization is important
since when we are hierarchically allocating down from the top of
the stage we constantly reallocate the actors at the top of the
hierarchy back to the same place.

https://bugzilla.gnome.org/show_bug.cgi?id=719368
2013-11-26 12:30:00 -05:00
Owen W. Taylor
0b536c02f9 Bind constraints: Don't force redraws on source relayout
When the source actor potentially changes size, that shouldn't
necessarily result in the target actor being redrawn - it should
be like when a child of a container is reallocated due to changes
in its siblings or parent - it should redraw only to the extent
that it is moved and resized. Privately export an internal function
from clutter-actor.c to allow getting this right.

https://bugzilla.gnome.org/show_bug.cgi?id=719367
2013-11-26 11:12:12 -05:00
Bastien Nocera
d7814cf63e actor: Correct setting the offscreen-redirect property
It's a flags property, not an enum one.

https://bugzilla.gnome.org/show_bug.cgi?id=708922
2013-10-08 14:56:31 +02:00
Florian Müllner
5bab9a8655 actor: Minor cleanup
In clutter_allocate_align_fill(), x2/y2 may be set twice for no
particular reason; save a couple of lines by not doing this.

https://bugzilla.gnome.org/show_bug.cgi?id=703809
2013-08-19 23:37:38 +01:00
Emmanuele Bassi
0b6498d655 Use paint nodes to set up the stage
This allows to set a Content on a stage, and consolidates the paint
code where it belongs.

https://bugzilla.gnome.org/show_bug.cgi?id=704625
2013-08-19 23:23:45 +01:00
Emmanuele Bassi
b50e1c3b62 actor: Do not set remove-on-complete on implicit transitions
The implicitly created transitions are removed when complete by the
implicit transition machinery. The remove-on-complete hint is for
user-provided transitions.

https://bugzilla.gnome.org/show_bug.cgi?id=705739
2013-08-19 23:22:38 +01:00
Adel Gadllah
697f7a3359 clutter-actor: Make clutter_actor_has_mapped_clones public
This allows some optimisations to be done that work when they are no clones.

https://bugzilla.gnome.org/show_bug.cgi?id=703336
2013-07-17 12:43:38 +02:00
Emmanuele Bassi
6227f7a0f5 actor: Deprecate realize and unrealize
There is no reasonable use case for having the functions, the virtual
functions, and the signals for realization and unrealization; the
concept belongs to an older era, when we though it would have been
possible to migrate actors across different GL contexts, of in case a GL
context would not have been available until the main loop started
spinning. That is most definitely not possible today, and too much code
would utterly break if we ever supported that.
2013-07-10 11:16:09 +01:00
Emmanuele Bassi
41bb03da2d Use the new macros for adding private data 2013-07-03 18:04:32 +01:00
Emmanuele Bassi
2e905dd9d4 Fix annotations for signal arguments
The introspection scanner started warning about mismatched arguments
number.
2013-07-03 13:13:41 +01:00
Emmanuele Bassi
18f7a4aa12 actor: Remove the was_painted flag
While we still don't want to perform implicit transitions on unmapped
actors, we can relax the requirement on having been painted once; the
was_painted flag was introduced to avoid performing implicit transitions
on the :allocation property, but for that we can use the
needs_allocation flag instead, as needs_allocation will be set to FALSE
when we have been painted as well.

Thus, we retain our original goal of not having actors "flying" into
position on their first allocation, without the side effect of
preventing animations when emitting the ::show signal.
2013-06-15 11:54:18 +01:00
Craig R. Hughes
e54246dd69 Extra ref leak in clutter_actor_set_child_at_index too
https://bugzilla.gnome.org/show_bug.cgi?id=696813
2013-06-12 10:14:26 +01:00
Craig R. Hughes
90f68edbda clutter_actor_set_child_above/below_sibling leaking a reference
https://bugzilla.gnome.org/show_bug.cgi?id=696813
2013-06-12 10:14:25 +01:00
Emmanuele Bassi
cbf0199804 actor: Fix has_constraints() and has_actions()
When we changed the MetaGroup to handle internal effects, we updated
has_effects(), but forgot to fix the equivalent has_constrains() and
has_actions() method.

Now, if we clear the constraints or the actions on an actor, and we
call has_constraints() or has_actions(), we get an false positive.
2013-06-12 10:04:32 +01:00
Emmanuele Bassi
9424e995fa actor: Improve conditions for skipping implicit transitions
The "should this implicit transition be skipped" check should live into
its own function, where we can actually explain what it does and which
conditions should be respected.

Instead of just blindly skipping actors that are unmapped, or haven't
been painted yet, we should add a couple of escape hatches.

First of all, we don't want :allocation to be implicitly animated until
we have been painted (thus allocated) once; this avoids actors "flying
in" into their allocation.

We also want to allow implicit transitions on the opacity even if we
haven't been painted yet; the internal optimization that we employ in
clutter_actor_paint() and skips painting fully transparent actors is
exactly that: an internal optimization. Caller code should not be aware
of this change, and it should not influence code outside of ClutterActor
itself.

The rest of the conditions are the same: if the easing state's duration
is zero, or if the actor is both unmapped and not in a cloned branch of
the scene graph, then implicit transitions are pointless, as they won't
be painted.

https://bugzilla.gnome.org/show_bug.cgi?id=698766
2013-05-06 10:04:22 -07:00
Lionel Landwerlin
b914ae70b1 actor: fix translation-z setting
https://bugzilla.gnome.org/show_bug.cgi?id=695982
2013-03-18 10:39:08 +00:00
Emmanuele Bassi
8f032d5952 actor: Skip transitions on invisible actors
If an actor has not been painted yet, or it's not going to be painted,
we can ignore transitions queued on it.

By ignoring transitions on actors that have not been painted yet, we can
avoid doing work during the set up phase of the scene graph, as well as
avoiding actors "flying in" from nowhere.

Obviously, we have to take into account potential clones, so we need to
check that the actor is not part of a cloned branch of the scene graph,
as well as checking if the actor has mapped clones.
2013-03-13 15:05:28 -03:00
Emmanuele Bassi
20c0985869 actor: Propagate the cloned state to the children
If we clone a container, we still want redraws queued on the children to
be propagated.
2013-03-13 15:05:28 -03:00
Emmanuele Bassi
0e0db890e1 actor: Ignore redraws queued on unmapped actors
If an actor is unmapped then it won't be painted, so we can safely
short-circuit out of _clutter_actor_queue_redraw_full() if the mapped
flag is not set.

We need, on the other hand, make an exception for Clones, otherwise
they won't receive notification that the source actor has changed
and they won't be painted.

This allows us to ignore redraws queued on children of invisible
parents, and avoid traversing the scene graph.
2013-03-13 15:05:28 -03:00
Emmanuele Bassi
028baa99a0 actor: Keep track of clones
Instead of using signal notifications, we should be able to keep track
of the clones of an actor from within ClutterActor itself, using private
API. There's no point in pretending that people can actually create a
Clone class out of tree, given the amount of invariants we have to punch
through in order to implement a proper replicator node of the scene
graph, so we can just skip the signal emissions and just do the right
thing at the right time.
2013-03-13 15:05:28 -03:00
Emmanuele Bassi
c32973158d actor: Clean up internal add/remove functions
More comments are warranted: these functions are pretty much full of
potential side effects, and I'd really like to avoid keeping everything
in my head forever.

Along with the comments and the type casting reduction, I sneaked in a
one line change that is clearly correct after reading the flow of the
whole thing: we queue only a relayout after three potential redraws have
been queued. If we manage to miss a redraw and yet still get a relayout
then it means that most of our assumptions are fundamentally wrong, and
that we ought to dump this whole business of computer programming, and
just go back to being a hunter-gatherer species.
2013-03-13 15:05:28 -03:00
Emmanuele Bassi
900015a4eb actor: Clean up ::show and ::hide class handlers
The main body of the function should not live inside an 'if' block.
2013-03-13 15:05:27 -03:00
Emmanuele Bassi
a622d34444 actor: Revert the Transition/Actor leak fix
The original code inside ClutterActor that dealt with Transitions
stopping was written for the ::completed signal, thus the code was
correctly handling the lifetime of the instances; when we moved to the
::stopped signal, we assumed that it worked in the same way - with less
conditions to be checked, obviously, but fundamentally similar to the
::completed signal. Sadly, I screwed up the signal definition, and the
signal ended up calling our handlers, but not the default one that did
the cleanup and released references on the Animatable instance.

After fixing the Timeline::stopped signal, we can go back to the
previous code.

Thanks to Craig Hughes for the help in tracking down this mess.

https://bugzilla.gnome.org/show_bug.cgi?id=695158
2013-03-05 00:48:11 +00:00
Emmanuele Bassi
f3659d35a0 actor: Release a reference on the implicit Transitions
When stopping the transition we need to release the reference we
maintain while removing the Transition from the hash table inside an
actor. If we fail to do so, the Transition is never released, which
means we leak the Animatable instance we tied to it.

https://bugzilla.gnome.org/show_bug.cgi?id=695158
2013-03-04 23:06:27 +00:00
Emmanuele Bassi
1f3e56b3be docs: Clean up the documentation for the allocate() methods
The wording could be better, especially on the side effects and the
honoured state.
2013-03-04 12:24:24 +00:00
Emmanuele Bassi
67f10bcc6f docs: Clean up the wording of a couple of comments 2013-03-04 12:24:24 +00:00
Emmanuele Bassi
e317ca11fc Fix compiler warnings by initializing variables 2013-02-21 00:39:15 +00:00
Jasper St. Pierre
50f6b2ac2c actor: Fix clutter_actor_allocate_align_fill for partially-filled actors
If we pass TRUE for x_align and FALSE for y_align, the full available
width should be passed to clutter_get_preferred_height, and the same
should be true in the other dimension.

https://bugzilla.gnome.org/show_bug.cgi?id=694237
2013-02-21 00:13:11 +00:00
Josselin Mouette
e4598a9e52 actor: Use the correct return value
The get_z_rotation_gravity() method returns an enumeration value, not a
floating point value.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>

https://bugzilla.gnome.org/show_bug.cgi?id=694187
2013-02-20 23:06:28 +00:00
Jasper St. Pierre
578e81dc2e actor: Correct documentation formatting for clutter_actor_event()
TRUE and FALSE need to be symbolified here.
2013-01-14 13:00:28 -05:00
Jasper St. Pierre
0caba876e6 actor: Fix documentation reference for pivot-point 2013-01-14 13:00:28 -05:00
Tomeu Vizoso
060b05cc29 actor: Remove transition when stopping it
This covers more cases when the transition completes but was still
being tracked by its actor.

https://bugzilla.gnome.org/show_bug.cgi?id=685982
2012-12-18 01:27:32 +00:00
Emmanuele Bassi
84b4f2f0a3 actor: Clean up the code in ::apply-transform
Instead of placing the whole body of the function inside an if block,
let's make it clear what each part of the function does. Also, add more
comments.
2012-12-18 00:05:42 +00:00
Emanuele Aina
219d0efcc6 actor: rollback pivot translation even on explicit transforms
When setting an explicit transform with clutter_actor_set_transform()
and a non (0,0) pivot-point, clutter_actor_apply_transform() will fail
to roll back the pivot-point translation done before multiplying the
transformation matrix due to the "out:" label being slightly misplaced
in clutter_actor_real_apply_transform().

This works properly:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_actor_set_rotation_angle (actor, CLUTTER_Z_AXIS, 30);

This results in the actor being moved to the pivot-point position:
  clutter_actor_set_pivot_point (actor, 0.5, 0.5);
  clutter_matrix_init_identity(&matrix);
  cogl_matrix_rotate (&matrix, 30, 0, 0, 1.0);
  clutter_actor_set_transform (actor, &matrix);

This also add a conformance test checking that even when using a
pivot-point, no matter how a rotation is set the resulting
transformation matrix will be the same.

https://bugzilla.gnome.org/show_bug.cgi?id=690214
2012-12-14 19:15:48 +01:00
Jasper St. Pierre
15b811840c actor: Use fixed positioning for allocate_preferred_size
clutter_actor_allocate_preferred_size is supposed to use the fixed
position of an actor. Unfortunately, recent refactorings made it so
that it accidentally used the current allocation. As the current
allocation may be adjusted by the actor, or have been previously
allocated in a strange spot, it may have unintended side effects. Use
the fixed positioning of the actor instead.

This fixes weird issues with margins colliding with
ClutterFixedLayout, causing strange offsets on relayout.

https://bugzilla.gnome.org/show_bug.cgi?id=689316
2012-11-30 18:13:53 -05:00
Lionel Landwerlin
da498fdb9a actor: fix allocate_align_fill() to maintain the child preferred size
When trying to clamp to pixel a box that is exactly in between 2
pixels, the clutter_actor_box_clamp_to_pixel() function changes the
size of the box.

Here is an example :

ClutterActorBox box = { 10.5, 10, 20.5, 20};

g_message ("%fx%f -> %fx%f", box.x1, box.y1, box.x2, box.y2);
clutter_actor_box_clamp_to_pixel (&box);
g_message ("%fx%f -> %fx%f", box.x1, box.y1, box.x2, box.y2);

Here is what you get :

** Message: 10.500000x10.000000 -> 20.500000x20.000000
** Message: 10.000000x10.000000 -> 21.000000x20.000000

That is because of the properties of the ceilf and floorf function
used to do the clamping.

For example, ceil(0.5) is 1.0, and ceil(-0.5) is 0.0.
And, floor(0.5) is 0.0, and floor(-0.5) is -1.0.

To work around that problem this patch retains the distance between x
and y coordinates and apply that difference before calling ceilf() on
x2 and y2.

https://bugzilla.gnome.org/show_bug.cgi?id=689073
2012-11-26 11:22:24 +00:00
Guillaume Desmottes
2be88b34b2 Don't annotate with (transfer full) constructors of GInitiallyUnowned subclasses
https://bugzilla.gnome.org/show_bug.cgi?id=686776
2012-10-24 13:17:57 +02:00
Tomeu Vizoso
36c2343001 actor: Place coordinate of the pivot point in the right pointer 2012-10-08 11:08:20 +02:00
Emmanuele Bassi
696f1afc04 actor: Fix transform-set condition
The :transform-set property is set if the matrix in :transform is not
the identity matrix.
2012-09-25 09:12:54 +01:00
Debarshi Ray
c3e574a389 actor: Fix the content box for CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT
The code for calculating the content box when the aspect ratio is
greater than 1 was broken. The same code that did the calculation for
aspect ratio less than 1 should be used in all cases.

Fixes: https://bugzilla.gnome.org/682161
2012-09-07 21:23:24 +01:00
Emmanuele Bassi
48a2846ab9 actor: Make :transform and :child-transform animatable
Now that we can interpolate between two matrices, we can mark the
matrix-based property as animatable.
2012-09-03 21:00:40 +01:00
Emmanuele Bassi
03f4f1c69e actor: Remove existing implicit transition if duration is 0
When changing an implicit transition mid flight we may end up with an
easing state with a duration of zero milliseconds; this leads to the
implicit transition machinery setting the final state directly onto the
actor. If there is a running transition, though, we need to remove it
from the transitions table, otherwise it will keep running.

This regression happened when the update_transition() internal function
was merged into the create_transition() one.

Tested-by: Lionel Landwerlin <llandwerlin@gmail.com>
2012-09-03 13:03:16 +01:00
Lionel Landwerlin
fe92acd649 actor-iter: fix prev()/next() annotations
https://bugzilla.gnome.org/show_bug.cgi?id=682795
2012-08-27 13:47:29 +01:00
Emmanuele Bassi
3937a7c74c actor: Setting the child-transform invalidates the children's modelview
We need to ensure that the children's cached modelview matrix gets
invalidated when setting the :child-transform property on their parent.
2012-08-27 12:24:20 +01:00
Emmanuele Bassi
1b155504c5 actor: Call queue_redraw() when setting child-transform 2012-08-27 10:48:28 +01:00
Emmanuele Bassi
6bf0b983af actor: Deprecate the pick signal
Just like we did for the paint signal; a warning will be emitted if the
diagnostic mode of GLib is enabled through the G_ENABLE_DIAGNOSTIC env
var.
2012-08-27 10:48:27 +01:00
Emmanuele Bassi
ffe32426b8 actor: Add the :child-transform property
An additional transformation that is applied to the children of an actor
before their own transformations, but not to the actor itself.
2012-08-19 17:23:26 +01:00