The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.
This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.
Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.
With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.
We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).
The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
A ClutterBox might not have a ClutterLayoutManager instance
associated -- for instance, during destruction. We should check
for one before calling methods on it.
* Use g_list_foreach() instead of iterating over the list inside
the destruction sequence, since we are causing the widgets to be
implicitly removed from the list via the destroy() call.
* Use g_signal_connect_swapped() and spare us from a callback.
Use the LayoutManager API to set a back pointer to the Box actor
inside the LayoutManager used by the box.
This also allows us to replace the LayoutManager on a Box, since
the LayoutManager will be able to replace all the metadata if
needed.
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.
If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.
Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
* Use ::layout-changed to queue a relayout when the layout changes
* Destroy the Box children when destroying the Box
* Allow getting the layout manager from the Box
A layout manager instance makes only sense if it's owned by a
container. For this reason, it should have a floating reference
instead of a full reference on construction; this allows constructing
Boxes like:
box = clutter_box_new (clutter_fixed_layout_new ());
without leaking the layout manager instance.
Remove the layout containers: they will be moved to a
high-level library.
* clutter/clutter.h:
* clutter/Makefile.am: Remove layout and boxes from the
build.
* clutter/clutter-layout.[ch]: Remove the ClutterLayout
interface.
* clutter/clutter-box.[ch]:
* clutter/clutter-hbox.[ch]:
* clutter/clutter-vbox.[ch]: Remove ClutterBox and its
subclasses.
* clutter/clutter-label.c: Remove ClutterLayout implementation
* clutter/clutter-script-private.h:
* clutter/clutter-script-parser.c:
* clutter/clutter-script.c:
(clutter_script_parse_node): Remove special parsing for
ClutterMargin and ClutterPadding.
* clutter/clutter-types.h: Remove ClutterPadding and ClutterMargin.
* tests/Makefile.am:
* tests/test-boxes.c: Remove the boxes test case.
* clutter/clutter-box.c (clutter_box_dispose): Call unparent()
on the children, instead of destroy(), to avoid a double free
and a crash when destroying a ClutterBox.
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:
To avoid using a ClutterPadding each time you add an actor to a ClutterBox
when you want the same padding around each child, you can now set the
default padding. The API is pixel-based, since it's a commodity function,
and will affect only clutter_box_pack_defaults().
ClutterBox is meant to work like the HTML boxing model: it has a margin and
a backgrdound color, and every child actor is added with a pack type and a
padding. The ClutterBoxChild structure holds the child actor, the padding,
the packing type and the allocated coordinates for the actor.
Most of these fixes are simple symbol shadowing issues, like index and the
braindead y0 and y1 extern symbols exported by math.h on GNU libc systems.
There is a masking issue in ClutterTexture which should be checked; I ran
the tests and everything looked fine.
The rest are just unused variables.
* clutter/clutter-box.c: (clutter_box_pick):
Call clutter_box_paint rather than actor paint method avoiding
infinte loop (Fixes test-boxes crasher).
* clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_unrealize):
Trap the X calls to avoid potential X errors.