And make sure that overriding Container and calling
clutter_actor_add_child() will result in the same sequence of operations
as the current set_parent()+queue_relayout()+signal_emit pattern.
Existing containers can continue using:
clutter_actor_set_parent (child, CLUTTER_ACTOR (container));
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
g_signal_emit_by_name (container, "actor-added", child);
and newly written containers overriding Container.add() can simply call:
clutter_actor_add_child (CLUTTER_ACTOR (container), child);
instead.
We need to queue a relayout when removing a visible child from a visible
parent.
We also need to insert the child at the right position (depending on the
depth) so that newly added actors will be painted on top.
Remove four more floats from ClutterActorPrivate.
The fixed minimum and natural sizes should be stored inside the
ClutterLayoutInfo structure, along with the fixed position.
Add a failsafe against a NULL parent, to avoid a segfault when calling
clutter_actor_allocate() on the Stage.
We also need to deal with floating point values: straight comparison is
not going to cut it.
ClutterActor has various properties controlling the allocation:
- x-align, y-align
- margin-top, margin-bottom, margin-left, margin-right
These properties should adjust the ClutterActorBox passed from the
parent actor to its children when calling clutter_actor_allocate(),
so that the child can just allocate its children at the right origin
with the right available size.
The actor class should be able to hold the margin offsets like it does
for expand and alignment flags.
Instead of filling the private data structure with data, we should be
able to use an ancillary data structure, given that all this data is
optional and might never be set in the first place.
In case no layout manager was set during construction, we fall back to a
FixedLayout. The FixedLayout has the property of making the fixed
positioning and sizing API, as well as the various Constraints, work
out of the box.
Now that ClutterActor implements the Container contract we can actually
defer the size negotiation to a ClutterLayoutManager directly from the
default implementation of the Actor's virtual functions.
We can provide most of the ClutterContainer implementation directly
within ClutterActor — basically removing the need of having the
Container interface in the first place. For backward compatibility
reasons we can keep the interface, but let Actor implement it directly.
Let's try and move away from the reverse implicit scene graph build API,
which we mutuated from GTK+, towards a more traditional node/child API.
The set_parent()/unparent() API is confusing, unless you know the
history; having a add_child()/remove_child() methods pair makes it more
explicit.
We can easily implement the old set_parent()/unparent() pair in terms of
the newly add_child()/remove_child() one.
Enclose the check inside a #ifdef CLUTTER_ENABLE_DEBUG ... #endif, so
that we can compile it out; also, use g_string_append() instead of the
g_string_append_printf() function, given that we're just concatenating
strings.
The ::redraw virtual function was a throwback from olden times, and has
been thoroughly replaced by the equivalent vfunc on the StageWindow
interface. We can safely remove it, now, and simplify the flow of the
redraw code inside ClutterStage.
Semantic changes to Wayland means that we cannot rely on the compositor
setting a pointer buffer for us if set it to nil. The first part of fixing
this is to create an shm buffer containing the bytes for our cursor.
The best way to do this currently is to load the cursor from the well known
location where weston instals its cursor images. The code to implemente this
was derivedlifted from the Wayland backend in GTK+.
Currently, we're emitting the ClutterActor::destroy at the end of the
dispose implementation - right before we chain up to the parent
implementation.
The point of emission makes the ::destroy signal handlers able to just
use the actor pointer - as the actor state will have been mostly cleared
by the time application can run. This (undocumented) behaviour severely
limits the amount of things you can do inside a ::destroy signal
handler, thus making the ::destroy signal just a weird weak reference,
instead of a proper way to break application reference cycles.
Given that this change relaxes some of the conditions, this change
should be safe - obviously, if anything happens, we'll back it out; the
conformance and interactive tests confirm that, for common patterns of
usage, this change does not break existing code.