clutter/layout-manager: Consume Actors not Containers

We don't actually need the host to be a container, so simply work on
actors saving us a few casts.

This'll simplify dropping ClutterContainer entirely later, and
StViewport/ShellWindowPreviewLayout will also need to be updated for the
new signatures

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3384>
This commit is contained in:
Zander Brown 2023-11-07 09:57:37 +00:00
parent d0ebfa792d
commit e1cdeb0319
14 changed files with 119 additions and 149 deletions

View File

@ -2268,15 +2268,13 @@ clutter_actor_real_get_preferred_width (ClutterActor *self,
if (priv->layout_manager != NULL)
{
ClutterContainer *container = CLUTTER_CONTAINER (self);
CLUTTER_NOTE (LAYOUT, "Querying the layout manager '%s'[%p] "
"for the preferred width",
G_OBJECT_TYPE_NAME (priv->layout_manager),
priv->layout_manager);
clutter_layout_manager_get_preferred_width (priv->layout_manager,
container,
self,
for_height,
min_width_p,
natural_width_p);
@ -2307,15 +2305,13 @@ clutter_actor_real_get_preferred_height (ClutterActor *self,
if (priv->layout_manager != NULL)
{
ClutterContainer *container = CLUTTER_CONTAINER (self);
CLUTTER_NOTE (LAYOUT, "Querying the layout manager '%s'[%p] "
"for the preferred height",
G_OBJECT_TYPE_NAME (priv->layout_manager),
priv->layout_manager);
clutter_layout_manager_get_preferred_height (priv->layout_manager,
container,
self,
for_width,
min_height_p,
natural_height_p);
@ -2572,7 +2568,7 @@ clutter_actor_real_allocate (ClutterActor *self,
G_OBJECT_TYPE_NAME (priv->layout_manager));
clutter_layout_manager_allocate (priv->layout_manager,
CLUTTER_CONTAINER (self),
self,
&children_box);
}
@ -15970,8 +15966,7 @@ clutter_actor_set_layout_manager (ClutterActor *self,
if (priv->layout_manager != NULL)
{
g_object_ref_sink (priv->layout_manager);
clutter_layout_manager_set_container (priv->layout_manager,
CLUTTER_CONTAINER (self));
clutter_layout_manager_set_container (priv->layout_manager, self);
priv->layout_changed_id =
g_signal_connect (priv->layout_manager, "layout-changed",
G_CALLBACK (on_layout_manager_changed),

View File

@ -52,7 +52,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInterval, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterKeyframeTransition, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutManager, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterLayoutMeta, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterOffscreenEffect, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPageTurnEffect, g_object_unref)

View File

@ -61,7 +61,7 @@ G_DEFINE_TYPE (ClutterBinLayout,
static void
clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -98,7 +98,7 @@ clutter_bin_layout_get_preferred_width (ClutterLayoutManager *manager,
static void
clutter_bin_layout_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -156,7 +156,7 @@ get_actor_align_factor (ClutterActorAlign alignment)
static void
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
gfloat allocation_x, allocation_y;

View File

@ -29,8 +29,6 @@
#endif
#include "clutter/clutter-layout-manager.h"
#include "clutter/clutter.h"
#include "clutter/clutter-autocleanups.h"
G_BEGIN_DECLS

View File

@ -50,9 +50,6 @@
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter/deprecated/clutter-container.h"
#include "clutter/clutter-box-layout.h"
#include "clutter/clutter-actor-private.h"
@ -64,7 +61,7 @@
struct _ClutterBoxLayoutPrivate
{
ClutterContainer *container;
ClutterActor *container;
guint spacing;
@ -106,13 +103,13 @@ static float distribute_natural_allocation (float extra_space,
unsigned int n_requested_sizes,
RequestedSize *sizes);
static void count_expand_children (ClutterLayoutManager *layout,
ClutterContainer *container,
gint *visible_children,
gint *expand_children);
ClutterActor *container,
gint *visible_children,
gint *expand_children);
static void
clutter_box_layout_set_container (ClutterLayoutManager *layout,
ClutterContainer *container)
ClutterActor *container)
{
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
ClutterLayoutManagerClass *parent_class;
@ -272,7 +269,6 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
{
ClutterLayoutManager *layout = CLUTTER_LAYOUT_MANAGER (self);
ClutterBoxLayoutPrivate *priv = self->priv;
ClutterContainer *real_container = CLUTTER_CONTAINER (container);
ClutterActor *child;
ClutterActorIter iter;
gint nvis_children = 0, n_extra_widgets = 0;
@ -286,8 +282,7 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
minimum = natural = 0;
count_expand_children (layout, real_container,
&nvis_children, &nexpand_children);
count_expand_children (layout, container, &nvis_children, &nexpand_children);
if (nvis_children < 1)
{
@ -419,7 +414,7 @@ get_preferred_size_for_opposite_orientation (ClutterBoxLayout *self,
static void
allocate_box_child (ClutterBoxLayout *self,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *child,
ClutterActorBox *child_box)
{
@ -434,7 +429,7 @@ allocate_box_child (ClutterBoxLayout *self,
static void
clutter_box_layout_get_preferred_width (ClutterLayoutManager *layout,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
@ -458,7 +453,7 @@ clutter_box_layout_get_preferred_width (ClutterLayoutManager *layout,
static void
clutter_box_layout_get_preferred_height (ClutterLayoutManager *layout,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *natural_height_p)
@ -482,19 +477,17 @@ clutter_box_layout_get_preferred_height (ClutterLayoutManager *layout,
static void
count_expand_children (ClutterLayoutManager *layout,
ClutterContainer *container,
ClutterActor *container,
gint *visible_children,
gint *expand_children)
{
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;
ClutterActor *actor, *child;
ClutterActor *child;
ClutterActorIter iter;
actor = CLUTTER_ACTOR (container);
*visible_children = *expand_children = 0;
clutter_actor_iter_init (&iter, actor);
clutter_actor_iter_init (&iter, container);
while (clutter_actor_iter_next (&iter, &child))
{
if (clutter_actor_is_visible (child))
@ -617,7 +610,7 @@ distribute_natural_allocation (float extra_space,
static void
clutter_box_layout_allocate (ClutterLayoutManager *layout,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *box)
{
ClutterBoxLayoutPrivate *priv = CLUTTER_BOX_LAYOUT (layout)->priv;

View File

@ -45,7 +45,7 @@ G_DEFINE_TYPE (ClutterFixedLayout,
static void
clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -90,7 +90,7 @@ clutter_fixed_layout_get_preferred_width (ClutterLayoutManager *manager,
static void
clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -135,7 +135,7 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
static void
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
ClutterActor *child;

View File

@ -55,9 +55,6 @@
#include <math.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter/deprecated/clutter-container.h"
#include "clutter/clutter-actor.h"
#include "clutter/clutter-animatable.h"
#include "clutter/clutter-child-meta.h"
@ -69,7 +66,7 @@
struct _ClutterFlowLayoutPrivate
{
ClutterContainer *container;
ClutterActor *container;
ClutterFlowOrientation orientation;
@ -182,7 +179,7 @@ compute_lines (ClutterFlowLayout *self,
static void
clutter_flow_layout_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -373,7 +370,7 @@ clutter_flow_layout_get_preferred_width (ClutterLayoutManager *manager,
static void
clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -564,7 +561,7 @@ clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
static void
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
@ -740,7 +737,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
static void
clutter_flow_layout_set_container (ClutterLayoutManager *manager,
ClutterContainer *container)
ClutterActor *container)
{
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
ClutterLayoutManagerClass *parent_class;

View File

@ -34,7 +34,6 @@
#include "clutter/clutter-grid-layout.h"
#include "clutter/clutter-actor-private.h"
#include "clutter/clutter-container.h"
#include "clutter/clutter-debug.h"
#include "clutter/clutter-enum-types.h"
#include "clutter/clutter-layout-meta.h"
@ -103,7 +102,7 @@ struct _ClutterGridLineData
struct _ClutterGridLayoutPrivate
{
ClutterContainer *container;
ClutterActor *container;
ClutterOrientation orientation;
ClutterGridLineData linedata[2];
@ -1250,7 +1249,7 @@ clutter_grid_child_init (ClutterGridChild *self)
static void
clutter_grid_layout_set_container (ClutterLayoutManager *self,
ClutterContainer *container)
ClutterActor *container)
{
ClutterGridLayoutPrivate *priv = CLUTTER_GRID_LAYOUT (self)->priv;
ClutterLayoutManagerClass *parent_class;
@ -1308,7 +1307,7 @@ clutter_grid_layout_get_size_for_size (ClutterGridLayout *self,
static void
clutter_grid_layout_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -1327,7 +1326,7 @@ clutter_grid_layout_get_preferred_width (ClutterLayoutManager *manager,
static void
clutter_grid_layout_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -1379,7 +1378,7 @@ allocate_child (ClutterGridRequest *request,
static void
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);

View File

@ -44,10 +44,12 @@
* #ClutterActor, so you should read the relative documentation
* for subclassing #ClutterActor.
*
* The layout manager implementation can hold a back pointer to the
* #ClutterContainer by implementing the #ClutterLayoutManagerClass.set_container()
* virtual function. The layout manager should not hold a real reference (i.e.
* call g_object_ref()) on the container actor, to avoid reference cycles.
* The layout manager implementation can hold a back pointer to the container
* [type@Clutter.Actor] by implementing the
* [vfunc@Clutter.LayoutManager.set_container] virtual function. The layout
* manager should not hold a real reference (i.e. call
* [method@GObject.Object.ref]) on the container actor, to avoid reference
* cycles.
*
* If a layout manager has properties affecting the layout policies then it should
* emit the #ClutterLayoutManager::layout-changed signal on itself by using the
@ -82,8 +84,8 @@
* ```
*
* Where `manager` is the #ClutterLayoutManager, `container` is the
* #ClutterContainer using the #ClutterLayoutManager, and `actor` is
* the #ClutterActor child of the #ClutterContainer.
* #ClutterActor using the #ClutterLayoutManager, and `actor` is
* the #ClutterActor child of the #ClutterActor.
*
* ## Using ClutterLayoutManager with ClutterScript
*
@ -132,9 +134,6 @@
#include <glib-object.h>
#include <gobject/gvaluecollector.h>
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter/deprecated/clutter-container.h"
#include "clutter/clutter-debug.h"
#include "clutter/clutter-layout-manager.h"
#include "clutter/clutter-layout-meta.h"
@ -218,7 +217,7 @@ layout_manager_thaw_layout_change (ClutterLayoutManager *manager)
static void
layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -234,7 +233,7 @@ layout_manager_real_get_preferred_width (ClutterLayoutManager *manager,
static void
layout_manager_real_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -250,7 +249,7 @@ layout_manager_real_get_preferred_height (ClutterLayoutManager *manager,
static void
layout_manager_real_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
@ -258,7 +257,7 @@ layout_manager_real_allocate (ClutterLayoutManager *manager,
static void
layout_manager_real_set_container (ClutterLayoutManager *manager,
ClutterContainer *container)
ClutterActor *container)
{
if (container != NULL)
g_object_set_data (G_OBJECT (container), "clutter-layout-manager", manager);
@ -266,7 +265,7 @@ layout_manager_real_set_container (ClutterLayoutManager *manager,
static ClutterLayoutMeta *
layout_manager_real_create_child_meta (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor)
{
ClutterLayoutManagerClass *klass;
@ -357,7 +356,7 @@ clutter_layout_manager_init (ClutterLayoutManager *manager)
/**
* clutter_layout_manager_get_preferred_width:
* @manager: a #ClutterLayoutManager
* @container: the #ClutterContainer using @manager
* @container: the #ClutterActor using @manager
* @for_height: the height for which the width should be computed, or -1
* @min_width_p: (out) (allow-none): return location for the minimum width
* of the layout, or %NULL
@ -371,7 +370,7 @@ clutter_layout_manager_init (ClutterLayoutManager *manager)
*/
void
clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p)
@ -379,7 +378,7 @@ clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
ClutterLayoutManagerClass *klass;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
klass->get_preferred_width (manager, container, for_height,
@ -390,7 +389,7 @@ clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_get_preferred_height:
* @manager: a #ClutterLayoutManager
* @container: the #ClutterContainer using @manager
* @container: the #ClutterActor using @manager
* @for_width: the width for which the height should be computed, or -1
* @min_height_p: (out) (allow-none): return location for the minimum height
* of the layout, or %NULL
@ -404,7 +403,7 @@ clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p)
@ -412,7 +411,7 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
ClutterLayoutManagerClass *klass;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
klass->get_preferred_height (manager, container, for_width,
@ -423,7 +422,7 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_allocate:
* @manager: a #ClutterLayoutManager
* @container: the #ClutterContainer using @manager
* @container: the #ClutterActor using @manager
* @allocation: the #ClutterActorBox containing the allocated area
* of @container
*
@ -433,13 +432,13 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation)
{
ClutterLayoutManagerClass *klass;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
g_return_if_fail (allocation != NULL);
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
@ -474,7 +473,7 @@ clutter_layout_manager_layout_changed (ClutterLayoutManager *manager)
/**
* clutter_layout_manager_set_container:
* @manager: a #ClutterLayoutManager
* @container: (allow-none): a #ClutterContainer using @manager
* @container: (allow-none): a [type@Clutter.Actor] using @manager
*
* If the #ClutterLayoutManager sub-class allows it, allow
* adding a weak reference of the @container using @manager
@ -485,12 +484,12 @@ clutter_layout_manager_layout_changed (ClutterLayoutManager *manager)
*/
void
clutter_layout_manager_set_container (ClutterLayoutManager *manager,
ClutterContainer *container)
ClutterActor *container)
{
ClutterLayoutManagerClass *klass;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (container == NULL || CLUTTER_IS_CONTAINER (container));
g_return_if_fail (container == NULL || CLUTTER_IS_ACTOR (container));
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
if (klass->set_container)
@ -505,7 +504,7 @@ _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager)
static inline ClutterLayoutMeta *
create_child_meta (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor)
{
ClutterLayoutManagerClass *klass;
@ -524,7 +523,7 @@ create_child_meta (ClutterLayoutManager *manager,
static inline ClutterLayoutMeta *
get_child_meta (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor)
{
ClutterLayoutMeta *layout = NULL;
@ -535,7 +534,7 @@ get_child_meta (ClutterLayoutManager *manager,
ClutterChildMeta *child = CLUTTER_CHILD_META (layout);
if (layout->manager == manager &&
child->container == container &&
CLUTTER_ACTOR (child->container) == container &&
child->actor == actor)
return layout;
@ -561,8 +560,8 @@ get_child_meta (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_get_child_meta:
* @manager: a #ClutterLayoutManager
* @container: a #ClutterContainer using @manager
* @actor: a #ClutterActor child of @container
* @container: a [type@Clutter.Actor] using @manager
* @actor: a [type@Clutter.Actor] child of @container
*
* Retrieves the #ClutterLayoutMeta that the layout @manager associated
* to the @actor child of @container, eventually by creating one if the
@ -575,11 +574,11 @@ get_child_meta (ClutterLayoutManager *manager,
*/
ClutterLayoutMeta *
clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor)
{
g_return_val_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager), NULL);
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
g_return_val_if_fail (CLUTTER_IS_ACTOR (container), NULL);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
return get_child_meta (manager, container, actor);
@ -634,8 +633,8 @@ layout_get_property_internal (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_child_set:
* @manager: a #ClutterLayoutManager
* @container: a #ClutterContainer using @manager
* @actor: a #ClutterActor child of @container
* @container: a [type@Clutter.Actor] using @manager
* @actor: a [type@Clutter.Actor] child of @container
* @first_property: the first property name
* @...: a list of property name and value pairs
*
@ -647,7 +646,7 @@ layout_get_property_internal (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_child_set (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *first_property,
...)
@ -658,7 +657,7 @@ clutter_layout_manager_child_set (ClutterLayoutManager *manager,
va_list var_args;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (first_property != NULL);
@ -721,8 +720,8 @@ clutter_layout_manager_child_set (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_child_set_property:
* @manager: a #ClutterLayoutManager
* @container: a #ClutterContainer using @manager
* @actor: a #ClutterActor child of @container
* @container: a [type@Clutter.Actor] using @manager
* @actor: a [type@Clutter.Actor] child of @container
* @property_name: the name of the property to set
* @value: a #GValue with the value of the property to set
*
@ -731,7 +730,7 @@ clutter_layout_manager_child_set (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *property_name,
const GValue *value)
@ -741,7 +740,7 @@ clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
GParamSpec *pspec;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (property_name != NULL);
g_return_if_fail (value != NULL);
@ -772,8 +771,8 @@ clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_child_get:
* @manager: a #ClutterLayoutManager
* @container: a #ClutterContainer using @manager
* @actor: a #ClutterActor child of @container
* @container: a [type@Clutter.Actor] using @manager
* @actor: a [type@Clutter.Actor] child of @container
* @first_property: the name of the first property
* @...: a list of property name and return location for the value pairs
*
@ -783,7 +782,7 @@ clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_child_get (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *first_property,
...)
@ -794,7 +793,7 @@ clutter_layout_manager_child_get (ClutterLayoutManager *manager,
va_list var_args;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (first_property != NULL);
@ -859,8 +858,8 @@ clutter_layout_manager_child_get (ClutterLayoutManager *manager,
/**
* clutter_layout_manager_child_get_property:
* @manager: a #ClutterLayoutManager
* @container: a #ClutterContainer using @manager
* @actor: a #ClutterActor child of @container
* @container: a [type@Clutter.Actor] using @manager
* @actor: a [type@Clutter.Actor] child of @container
* @property_name: the name of the property to get
* @value: a #GValue with the value of the property to get
*
@ -873,7 +872,7 @@ clutter_layout_manager_child_get (ClutterLayoutManager *manager,
*/
void
clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *property_name,
GValue *value)
@ -883,7 +882,7 @@ clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
GParamSpec *pspec;
g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager));
g_return_if_fail (CLUTTER_IS_CONTAINER (container));
g_return_if_fail (CLUTTER_IS_ACTOR (container));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (property_name != NULL);
g_return_if_fail (value != NULL);

View File

@ -32,20 +32,14 @@
G_BEGIN_DECLS
#define CLUTTER_TYPE_LAYOUT_MANAGER (clutter_layout_manager_get_type ())
#define CLUTTER_LAYOUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManager))
#define CLUTTER_IS_LAYOUT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_LAYOUT_MANAGER))
#define CLUTTER_LAYOUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
#define CLUTTER_IS_LAYOUT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_LAYOUT_MANAGER))
#define CLUTTER_LAYOUT_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_LAYOUT_MANAGER, ClutterLayoutManagerClass))
#define CLUTTER_TYPE_LAYOUT_MANAGER (clutter_layout_manager_get_type ())
typedef struct _ClutterLayoutManagerClass ClutterLayoutManagerClass;
struct _ClutterLayoutManager
{
/*< private >*/
GInitiallyUnowned parent_instance;
};
CLUTTER_EXPORT
G_DECLARE_DERIVABLE_TYPE (ClutterLayoutManager,
clutter_layout_manager,
CLUTTER,
LAYOUT_MANAGER,
GInitiallyUnowned)
/**
* ClutterLayoutManagerClass:
@ -59,14 +53,15 @@ struct _ClutterLayoutManager
* layout manager. See also the allocate() virtual function in
* #ClutterActor
* @set_container: virtual function; override to set a back pointer
* on the #ClutterContainer using the layout manager. The implementation
* on the [type@Clutter.Actor] using the layout manager. The implementation
* should not take a reference on the container, but just take a weak
* reference, to avoid potential leaks due to reference cycles
* @get_child_meta_type: virtual function; override to return the #GType
* of the #ClutterLayoutMeta sub-class used by the #ClutterLayoutManager
* @create_child_meta: virtual function; override to create a
* #ClutterLayoutMeta instance associated to a #ClutterContainer and a
* child #ClutterActor, used to maintain layout manager specific properties
* [type@Clutter.LayoutMeta] instance associated to a container
* [type@Clutter.Actor] and a child [type@Clutter.Actor], used to maintain
* layout manager specific properties
* @layout_changed: class handler for the #ClutterLayoutManager::layout-changed
* signal
*
@ -80,53 +75,50 @@ struct _ClutterLayoutManagerClass
/*< public >*/
void (* get_preferred_width) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p);
void (* get_preferred_height) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p);
void (* allocate) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation);
void (* set_container) (ClutterLayoutManager *manager,
ClutterContainer *container);
ClutterActor *container);
GType (* get_child_meta_type) (ClutterLayoutManager *manager);
ClutterLayoutMeta *(* create_child_meta) (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor);
void (* layout_changed) (ClutterLayoutManager *manager);
};
CLUTTER_EXPORT
GType clutter_layout_manager_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
void clutter_layout_manager_get_preferred_width (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_height,
gfloat *min_width_p,
gfloat *nat_width_p);
CLUTTER_EXPORT
void clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
gfloat for_width,
gfloat *min_height_p,
gfloat *nat_height_p);
CLUTTER_EXPORT
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
const ClutterActorBox *allocation);
CLUTTER_EXPORT
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
ClutterContainer *container);
ClutterActor *container);
CLUTTER_EXPORT
void clutter_layout_manager_layout_changed (ClutterLayoutManager *manager);
@ -139,30 +131,30 @@ GParamSpec ** clutter_layout_manager_list_child_properties (ClutterLayoutMa
CLUTTER_EXPORT
ClutterLayoutMeta *clutter_layout_manager_get_child_meta (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor);
CLUTTER_EXPORT
void clutter_layout_manager_child_set (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *first_property,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_EXPORT
void clutter_layout_manager_child_get (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *first_property,
...) G_GNUC_NULL_TERMINATED;
CLUTTER_EXPORT
void clutter_layout_manager_child_set_property (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *property_name,
const GValue *value);
CLUTTER_EXPORT
void clutter_layout_manager_child_get_property (ClutterLayoutManager *manager,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
const gchar *property_name,
GValue *value);

View File

@ -1549,7 +1549,7 @@ clutter_script_construct_parameters (ClutterScript *script,
static void
apply_layout_properties (ClutterScript *script,
ClutterContainer *container,
ClutterActor *container,
ClutterActor *actor,
ObjectInfo *oinfo)
{
@ -1737,7 +1737,7 @@ _clutter_script_check_unresolved (ClutterScript *script,
if (child_info == NULL)
continue;
apply_layout_properties (script, CLUTTER_CONTAINER (parent),
apply_layout_properties (script, parent,
child,
child_info);
}

View File

@ -42,12 +42,10 @@
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
#include "clutter/clutter-stage.h"
#include "clutter/deprecated/clutter-container.h"
#include "clutter/clutter-action-private.h"
#include "clutter/clutter-actor-private.h"
#include "clutter/clutter-backend-private.h"
#include "clutter/clutter-container.h"
#include "clutter/clutter-debug.h"
#include "clutter/clutter-enum-types.h"
#include "clutter/clutter-event-private.h"
@ -321,7 +319,7 @@ clutter_stage_allocate (ClutterActor *self,
clutter_actor_set_allocation (self, box);
clutter_layout_manager_allocate (layout_manager,
CLUTTER_CONTAINER (self),
self,
&children_box);
if (window_size.width != CLUTTER_NEARBYINT (width) ||

View File

@ -37,6 +37,7 @@
#include "clutter/clutter-backend.h"
#include "clutter/clutter-bind-constraint.h"
#include "clutter/clutter-binding-pool.h"
#include "clutter/clutter-bin-layout.h"
#include "clutter/clutter-blur-effect.h"
#include "clutter/clutter-box-layout.h"
#include "clutter/clutter-brightness-contrast-effect.h"
@ -107,7 +108,6 @@
#include "clutter/clutter-units.h"
#include "clutter/clutter-virtual-input-device.h"
#include "clutter/clutter-zoom-action.h"
#include "clutter/clutter-bin-layout.h"
#include "clutter/clutter-deprecated.h"

View File

@ -280,7 +280,7 @@ test_text_field_main (gint argc,
label = create_label (CLUTTER_COLOR_White, "<b>Input field:</b>");
g_object_set (label, "min-width", 150.0, NULL);
clutter_actor_add_child (box, label);
clutter_layout_manager_child_set (grid, CLUTTER_CONTAINER (box), label,
clutter_layout_manager_child_set (grid, box, label,
"row", 0,
"column", 0,
"x-expand", FALSE,
@ -292,7 +292,7 @@ test_text_field_main (gint argc,
pango_attr_list_insert (entry_attrs, pango_attr_underline_color_new (65535, 0, 0));
entry = create_entry (CLUTTER_COLOR_Black, "somme misspeeled textt", entry_attrs, 0, 0);
clutter_actor_add_child (box, entry);
clutter_layout_manager_child_set (grid, CLUTTER_CONTAINER (box), entry,
clutter_layout_manager_child_set (grid, box, entry,
"row", 0,
"column", 1,
"x-expand", TRUE,
@ -303,7 +303,7 @@ test_text_field_main (gint argc,
label = create_label (CLUTTER_COLOR_White, "<b>A very long password field:</b>");
clutter_actor_add_child (box, label);
clutter_layout_manager_child_set (grid, CLUTTER_CONTAINER (box), label,
clutter_layout_manager_child_set (grid, box, label,
"row", 1,
"column", 0,
"x-expand", FALSE,
@ -312,7 +312,7 @@ test_text_field_main (gint argc,
entry = create_entry (CLUTTER_COLOR_Black, "password", NULL, '*', 8);
clutter_actor_add_child (box, entry);
clutter_layout_manager_child_set (grid, CLUTTER_CONTAINER (box), entry,
clutter_layout_manager_child_set (grid, box, entry,
"row", 1,
"column", 1,
"x-expand", TRUE,