Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.
Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.
As a side note: this commit closes the oldes bug in Clutter's bug
report tool.
http://bugzilla.openedhand.com/show_bug.cgi?id=521
Previously only ClutterGroup was able to set the CLUTTER_ACTOR_NO_LAYOUT
flag which allows clutter-actor.c to avoid a relayout when showing or
hiding fixed layout containers. Instead of it being the responsibility
of the container to set this flag this patch makes the layout manager
itself decide in the ::set_container method. This way both ClutterBox
and ClutterGroup can take advantage of the optimization.
This replaces code like this:
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
with:
clutter_actor_queue_redraw (self);
clutter_actor_queue_redraw internally knows what can be optimized when
the actor is not visible, but it also knows that the queue_redraw signal
must always be sent in case a ClutterClone is cloning a hidden actor.
There is a lot of duplication between ClutterGroup and ClutterBox so
this makes the two files diff-able so that new fixes can easily be
ported to both and bug fixes missing in one or the other can be spotted
more easily. This doesn't change the behaviour of either actor; it's
really just a shuffle around of code and normalizes the coding style to
make the files comparable.
This has already uncovered one bug in ClutterBox, and also highlights
a bug in ClutterGroup + many other actors:
1) ClutterGroup::real_foreach was recently changed to use
g_list_foreach instead of manually iterating the child list so it can
safely handle calls like:
clutter_container_foreach (container, clutter_actor_destroy);
ClutterBox is still manually iterating the list.
2) In ClutterGroup we guard _queue_redraw() calls like this:
if (CLUTTER_ACTOR_IS_VISIBLE (container))
clutter_actor_queue_redraw (CLUTTER_ACTOR (container));
In ClutterBox we don't:
I think ClutterBox is correct here because
clutter_actor_queue_redraw already optimizes the case where the
actor's not visible, but it also considers that the actor may be
cloned and so the guard in ClutterGroup could break clones. This
actually highlights a wider clutter bug since the same kinds of
guards can be found in all other clutter actors.
The documentation for ClutterGroup behaviour when setting an explicit
size is not accurate - or, actually, it was accurate by the time
ClutterGroup was first written but has been neglected in the following
release cycles.
To avoid confusion for new users of Clutter the documentation should be
slightly expanded, mentioning the exact semantics of ClutterGroup with
regards to: preferred size, explicitly set size and how to constrain the
visible area of a ClutterGroup to an explicitly set size.
Based on a patch by: Neil Roberts <neil@linux.intel.com>
g_list_foreach has better protection against the current node being
removed. This will happen for example if someone calls
clutter_container_foreach(container, clutter_actor_destroy). This was
causing valgrind errors for the conformance tests which do just that.
Some actor implementation might avoid imposing any layout on their
children. The Actor base class usually assumes some sort of layout
management is in place, so it will queue relayouts when, for instance,
an actor is shown or is hidden. If the parent of the actor does not
impose any layout, though, showing or hiding one of its children will
not affect the layout of the others.
An example of this kind of container is ClutterGroup.
By adding a new Actor flag, CLUTTER_ACTOR_NO_LAYOUT, and by making
the Group actor set it on itself, the Actor base class can now decide
whether or not to queue a relayout. The flag is not meant to be used
by application code, and should only be set when implementing a new
container.
http://bugzilla.openedhand.com/show_bug.cgi?id=1838
ClutterGroup previously calculated the size as the distance from the
left edge of the leftmost child to the right edge of the rightmost
child except if there were any chidren left of the origin then the
left edge would be zero.
However the group is always allocated its size relative to its
origin so if all of the children are to the right of the origin then
the preferred size would not be large enough to reach the rightmost
child.
origin
┼──────────┐
│Group │
│ ┌────────┼─┐
│ │Child │ │
│ │ │ │
└─┼────────┘ │
│ │
└──────────┘
group size
╟──────────╢
This patch makes it so the size is always just the rightmost edge.
origin
┼────────────┐
│Group │
│ ┌──────────┤
│ │Child │
│ │ │
│ │ │
│ │ │
└─┴──────────┘
group size
╟────────────╢
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1825
If we use float temporaries when computing the bounds of
a group, then, depending on what variables are kept in registers
and what stored on the stack, the accumulated difference between
natural_width and min_width can be more than FLOAT_EPSILON.
Using double temporaries will eliminate the difference in most
cases, or, very rarely, reduce it to a last-bit error.
http://bugzilla.openedhand.com/show_bug.cgi?id=1632
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Instead of passing a boolean value, the ::allocate virtual function
should use a bitmask and flags. This gives us room for expansion
without breaking API/ABI, and allows to encode more information to
the allocation process instead of just changes of absolute origin.
Currently, picking in ClutterGroup pollutes the CLUTTER_DEBUG=paint
logs since it just calls the paint function. Reimplementing the pick
doesn't make us lose anything -- it might even be slightly faster
since we don't have to do a (typed) cast and a class dereference.
With the recent change to internal floating point values, ClutterUnit
has become a redundant type, defined to be a float. All integer entry
points are being internally converted to floating point values to be
passed to the GL pipeline with the least amount of conversion.
ClutterUnit is thus exposed as just a "pixel with fractionary bits",
and not -- as users might think -- as generic, resolution and device
independent units. not that it was the case, but a definitive amount
of people was convinced it did provide this "feature", and was flummoxed
about the mere existence of this type.
So, having ClutterUnit exposed in the public API doubles the entry
points and has the following disadvantages:
- we have to maintain twice the amount of entry points in ClutterActor
- we still do an integer-to-float implicit conversion
- we introduce a weird impedance between pixels and "pixels with
fractionary bits"
- language bindings will have to choose what to bind, and resort
to manually overriding the API
+ *except* for language bindings based on GObject-Introspection, as
they cannot do manual overrides, thus will replicate the entire
set of entry points
For these reason, we should coalesces every Actor entry point for
pixels and for ClutterUnit into a single entry point taking a float,
like:
void clutter_actor_set_x (ClutterActor *self,
gfloat x);
void clutter_actor_get_size (ClutterActor *self,
gfloat *width,
gfloat *height);
gfloat clutter_actor_get_height (ClutterActor *self);
etc.
The issues I have identified are:
- we'll have a two cases of compiler warnings:
- printf() format of the return values from %d to %f
- clutter_actor_get_size() taking floats instead of unsigned ints
- we'll have a problem with varargs when passing an integer instead
of a floating point value, except on 64bit platforms where the
size of a float is the same as the size of an int
To be clear: the *intent* of the API should not change -- we still use
pixels everywhere -- but:
- we remove ambiguity in the API with regard to pixels and units
- we remove entry points we get to maintain for the whole 1.0
version of the API
- we make things simpler to bind for both manual language bindings
and automatic (gobject-introspection based) ones
- we have the simplest API possible while still exposing the
capabilities of the underlying GL implementation
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
ClutterGroup still ships with API deprecated since 0.4. We did
promise to keep it around for a minor release cycle -- not for 3.
Since we plan on shipping 1.0 without the extra baggage of the
deprecated entry points, here's the chance to remove the accumulated
cruft.
All the removed methods and signals have a ClutterContainer
counterpart.
Bug 1480 - Clutter groups don't output their name when
CLUTTER_DEBUG=paint
This is a really useful thing to do debugging-wise - as you can see
istantly when (and if) clutter objects are being drawn - as often
there's quite a hierarchy of objects in groups.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.
The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".
http://bugzilla.openedhand.com/show_bug.cgi?id=1452
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-rectangle.c:
* clutter/clutter-group.c:
* clutter/clutter-entry.c:
* clutter/clutter-clone-texture.c: Remove unnecessary calls to
cogl_{push,pop}_matrix. The matrix is preserved in
clutter_actor_paint whenever the actor's transformation is applied
so there should be no need to push the matrix in actor paint
implementations unless it does some additional transformations
itself.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
Clean up of parenting code (see #972)
Doc updates to section intro.
Add clutter_actor_allocate_preferred_size () utility call
* clutter/clutter-group.c: (clutter_fixed_layout_allocate):
Use clutter_actor_allocate_preferred_size ()
* doc/clutter-actor-invariants.txt:
Add some more notes
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
Bug #928 - Reparenting a child that itself is a container
doesn't work
* clutter/clutter-actor.c (clutter_actor_set_parent): Realize
an actor when setting its parent, if the parent is realized.
* clutter/clutter-group.c:
(clutter_group_realize), (clutter_group_class_init): Add the
missing implementation of the ::realize() virtual function; this
makes sure that the children of a Group are realized if the Group
is realized. (#928)
* clutter/clutter-actor.c:
(parse_rotation_array),
(clutter_actor_set_custom_property): Use the internal, unit based
rotation setter when parsing the rotation from a ClutterScript
file.
(clutter_geometry_copy),
(clutter_vertex_copy),
(clutter_actor_box_copy): Use the more efficient g_slice_dup().
(clutter_actor_get_stage): Add documentation.
* clutter/clutter-group.c: Documentation fix.
Signed off by: Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-group.c (clutter_group_real_lower): Fix to
actually lower the actor under the 'above' actor. (#822)
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
(clutter_group_query_coords):
Added function to translate vertex array to a bounding box.
(clutter_actor_is_scaled):
(clutter_actor_is_rotated):
Fixed documentation.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
(clutter_actor_is_scaled):
(clutter_actor_is_rotated):
Convenience functions to test whether actor is scaled or rotated.
(clutter_actor_apply_relative_transform_to_point):
Removed unused variable.
* clutter/clutter-group.c:
(clutter_group_query_coords):
Use clutter_actor_get_relative_vertices() to calculate bounding
boxes of children that are scaled or rotated.
* clutter/clutter-group.c:
Make sure unrealizing a group also unrealizes children.
* clutter/glx/clutter-stage-glx.c:
Chain up to group unrealize to make sure textures get unrealized
when changing context (see #718)
* clutter/clutter-texture.c:
Formatting cleanups
* clutter/clutter-group.c:
* clutter/clutter-group.h: Add the clutter_group_add() convenience
function; it's now "undeprecated" and implemented as a macro
* clutter/clutter-stage.h: Add clutter_stage_add() as a convenience
macro
* clutter/cogl/cogl.h: Include just the needed headers instead
of the whole clutter.h; this avoids rebuild cogl when not needed
* clutter/clutter-actor.c:
(clutter_actor_real_request_coords),
(clutter_actor_request_coords),
(clutter_actor_class_init): Provide a default ::request_coords()
implementation in ClutterActor and use it to store the bounding
box passed to clutter_actor_request_coords(). This makes the code
more reliable and clean, and avoids a call to the subclass
request_coords() method if the bounding box did not change. Now,
every class overriding ClutterActor::request_coords() *must* chain
up to the parent class method or the bounding box will not be
saved inside the ClutterActor structure.
* clutter/clutter-entry.c:
* clutter/clutter-group.c:
* clutter/clutter-hbox.c:
* clutter/clutter-label.c:
* clutter/clutter-texture.c:
* clutter/clutter-vbox.c: Chain up to the parent class
request_coords() method.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-group.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c:
* tests/test-events.c:
Parent Actors no longer need to be set reactive for reactive
children to get events. Also makes groups now pickable.
(#597, #423)
* clutter/clutter-texture.c:
Handle case when 1x1 tiled texture is created,
falling 'back' to being non tiled. (#596)
* clutter/eglx/clutter-backend-egl.c:
Call EglTerminate on backend shutdown.
from interface (and all implementations of it) since this
functionality is now implemented using a global hash.
* clutter/clutter-box.c:
* clutter/clutter-group.c:
Language bindings will have problems with raise() and lower() bein in both
ClutterContainer and ClutterActor; hence, this patch renames
clutter_container_raise() and clutter_container_lower() to
clutter_container_raise_child() and clutter_container_lower_child(),
respectively.