* stage-state:
docs: Update ClutterStageState flags
wayland: Use the Stage state tracking
gdk: Use the Stage state tracking
win32: Use the Stage state tracking
x11: Use the Stage state tracking
osx: Use the Stage state tracking
stage: Add state tracking
State changes on the Stage are currently deferred to the windowing
system backends, but the code is generally the same, and it should
be abstracted neatly inside the Stage class itself.
There's also the extra caveat for backends that state changes on a
Stage must also emit a ClutterEvent of type CLUTTER_STAGE_STATE, a
requirement that needlessly complicates the backend code.
Drop mentions of deprecated classes and API, and update the inline
example code.
Still some way to go, and the cookbook would probably benefit from
having a recipe on how to use ClutterActor to build a scene.
GLib has gained support for compiling ancillary data files into the same
binary blob as a library or as an executable.
We should add this feature to ClutterScript, so that it's possible to
bundle UI definitions with an application.
The only actor that results in a mix of the old Container API and the
new Actor API is ClutterStage. By inheritance, a Stage is a Group, but
we don't want it to behave like a Group - as it already overrides most
of the Actor API, and the reason why it was made as a Group in the
first place was convenience for adding/removing children.
Given that touching Group to make it aware of the new Actor API has
rapidly devolved into a struggle between a Demiurge that tries to
avoid breakage and a Chaos that finds new and interesting ways to
break ClutterGroup, let's declare API bankruptcy here and now.
ClutterStage should override ClutterContainer methods, and use the
layout management of ClutterFixedLayout as the proper class that it
was meant to be ages ago. Let ClutterGroup rot in pieces.
Now that we reinstated Group to its "former glory", we need to ensure
that applications using the deprecated containers with the new DOM API
in ClutterActor can actually work - or, at least, not break horribly.
This actually means making sure that ClutterStage and ClutterGroup can
cope with the DOM, while retaining their old implementations, as well as
their bizarre idiosyncrasies and their utter, utter brokenness.
Making Group just a proxy to Actor broke some behaviour that application
and toolkit code was relying on. Let's keep Group around to fight
another day.
This commit fixes gnome-shell as far as I can test it.
A Group is a just a ClutterActor with the layout-manager property set at
instance initialization time. It doesn't need anything else from
ClutterActor's vtable, except the slightly custom show_all/hide_all
implementation, and a simplified get_paint_volume.
Instead of chaining up, given that we want to bypass chaining up and
just set the allocation. This also allows us to bail out of the
overridden allocate vfunc check, given that we want the default Actor
behaviour to apply - including eventual layout manager delegates.
The usual way to implement a container actor is to override the
allocate() virtual function, chain up, and then allocate the actor's
children.
Clutter now has the ability to delegate layout management to
ClutterLayoutManager directly; in the allocation, this is done by
checking whether the actor has children, and then call
clutter_layout_manager_allocate() from within the default implementation
of the ClutterActor::allocate() vfunc. The same vfunc that everyone, has
been chaining up to.
Whoopsie.
Well, we can check if there's a layout manager, and if it's NULL, we
bail out. Except that there's a default layout manager, and it's the
fixed layout manager, so that classes like Group and Stage work by
default.
Double whoopsie.
The fix for this scenario is a bit nasty; we have to check if the actor
class has overridden the allocate() vfunc or not, before actually
looking at the layout manager. This means that classes that override the
allocate() vfunc are expected to do everything that ClutterActor's
default implementation does - which I think it's a fair requirement to
have.
For newly written code, though, it would probably be best if we just
provided a function that does the right thing by default, and that
you're supposed to be calling from within the allocate() vfunc
implementation, if you ever chose to override it. This new function,
clutter_actor_set_allocation(), should come with a warning the size of
Texas, to avoid people thinking it's a way to override the whole "call
allocate() on each child" mechanism. Plus, it should check if we're
inside an allocation sequence, and bail out if not.