Whether a child should receive extra space should be determined
by the expand property, not [xy]_fill (which just determine how
additional space should be used). The behavior is already correct
when using the ClutterActor:[xy]_expand properties, but needs
fixing for the corresponding ClutterBoxLayoutChild property.
https://bugzilla.gnome.org/show_bug.cgi?id=703809
Currently, BoxLayout interprets the box passed into allocate() in
a fairly peculiar way:
- in the direction of the box, all space between [xy]1 and [xy]2
is distributed among children (e.g. children occupy the entire
width/height of the box, offset by [xy]1)
- in the opposite direction, expanded children receive space
between [xy]1 and the height/width of the box (e.g. children
occupy the width/height of the box minus [xy]1, offset by [xy]1)
The second behavior doesn't make much sense, so adjust it to interpret
the box parameter in the same way as the first one.
https://bugzilla.gnome.org/show_bug.cgi?id=703809
This reverts commit 58a1854b57.
ClutterLayoutManager implementations should just defer the easing state
set up to the child, and not try to impose a global one.
It's time. Now that we have clutter_actor_allocate() respecting the
easing state of an actor, and that the LayoutManager animation virtual
functions have been deprecated, we can put ClutterAlpha on the chopping
block, and be done with it, once and for all.
So long, ClutterAlpha; and thanks for all the fish.
BoxLayout will use the easing state of the children it's allocating; the
current API is re-implemented in terms of an implicit easing state
forced on each child prior to allocating it.
The allocation code for BoxLayout contains a sequence of brain farts
that make it barely working since the synchronization of the layout
algorithm to the one in GtkBox.
The origin of the layout is inverted, and it doesn't take into
consideration a modified allocation origin (for actors the provide
padding or margin).
The pack-start property is broken, and it only works because we walk the
children list backwards; this horribly breaks when a child changes
visibility. Plus, we count invisible children, which leads to
allocations getting insane origins (either close to -MAX_FLOAT or
MAX_FLOAT).
Finally, the allocation is applied twice even for non-animated cases.
https://bugzilla.gnome.org/show_bug.cgi?id=669291
I don't feel comfortable with this feature, and its implementation
still has too many rough edges. We can safely punt it for now, and
introduce it at a later point, as it doesn't block existing features
or API.
This will make things interesting.
We have better replacements in ClutterActor, that do The Right Thing™
instead of deferring control and requiring reimplementation in every
single container actor.
Instead of getting the list of children to iterate over it, let's use
the newly added child iteration API; this should save us a bunch of
allocations, as well as indirections.
Ported: ClutterBinLayout and ClutterBoxLayout.
The request mode set by the box layout was previously width-for-height
in a vertical layout and height-for-width in a horizontal layout which
seems to be wrong. For example, if width-for-height is used in a
vertical layout then the width request will come second with the
for_height parameter set. However a vertical layout doesn't pass the
for_height parameter on to its children so doing the requests in that
order doesn't help. If the layout contains a ClutterText then both the
width and height request for it will have -1 for the for_width and
for_height parameters so the text would end up allocated too small.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2328
Store a back pointer of the layout manager inside the container using
the GObject instance data. This introduces a change in the implementation
of ClutterLayoutManager, though it's still binary compatible.
Added new "homogeneous" mode to ClutterBoxLayout, that makes layout children
get all the same size.
This is heavily inspired in the "homogeneous" attribute available in GtkBox,
but simplified as we don't have padding nor borders in box layout, only
spacing.
Also added to test-box-layout a key to set/unset homogeneous mode.
* Coding style fixes.
* Added proper test for homogeneous mode in box layout.
* Fix in homogeneous mode.
http://bugzilla.openedhand.com/show_bug.cgi?id=2034
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Remove an useless assignment. The n_expand_children is not used outside
the extra_space check, and if n_expand_children is 0 then the extra
space we allocate is 0.
The BoxLayout uses a HashTable to map the latest stable allocation of
each child, in order to use that as the initial value during an
animation; this in spite of already having a perfectly valid per-child
storage as part of the layout manager: ClutterBoxChild.
The last stable allocation should be stored inside the ClutterBoxChild
instead of having it in the private data for ClutterBoxLayout. The
access remains O(1), since there is a 1:1 mapping between child and
BoxChild instances, but we save a little bit of memory and we avoid
keeping aroud allocations for old children.
When beginning a new animation for a LayoutManager, the implementation
should return the ClutterAlpha used. This allows controlling the
timeline and/or modifying the animation parameters on the fly.
ClutterLayoutManager does not have any state associated with it, and
defers all the state to its sub-classes.
The BoxLayout is thus in charge of controlling:
• whether or not animations should be used
• the duration of the animation
• the easing mode of the animation
By adding three new properties:
• ClutterBoxLayout:use-animations
• ClutterBoxLayout:easing-duration
• ClutterBoxLayout:easing-mode
And their relative accessors pairs we can make BoxLayout decide whether
or not, and with which parameters, call the begin_animation() method of
ClutterLayoutManager.
The test-box-layout has been modified to reflect this new functionality,
by checking the key-press event for the 'a' key symbol to toggle the use
of animations.
Use the newly added animation support inside LayoutManager to animate
between state changes of the BoxLayout properties.
The implementation is based on equivalent code from Mx, written by:
Thomas Wood <thomas.wood@intel.com>
* text-direction:
docs: Add text-direction accessors
Set the default language on the Pango context
actor: Set text direction on parenting
tests: Display the index inside text-box-layout
box-layout: Honour :text-direction
text: Dirty layout cache on text direction changes
actor: Add :text-direction property
Use the newly added ClutterTextDirection enumeration
Add ClutterTextDirection enumeration
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.