constraint: Add a private header

And move the only private ClutterConstraint method to it.

This commit also sneaks in a change that makes sense for the debugging
of the update_allocation() method, which checks if the allocation was
effectively changed.
This commit is contained in:
Emmanuele Bassi 2014-12-14 14:20:53 +00:00
parent 768b5b89e2
commit 82fffaedb6
7 changed files with 102 additions and 27 deletions

View File

@ -218,31 +218,32 @@ source_c = \
# private headers; these should not be distributed or introspected
source_h_priv = \
clutter-actor-meta-private.h \
clutter-actor-private.h \
clutter-actor-private.h \
clutter-backend-private.h \
clutter-bezier.h \
clutter-constraint-private.h \
clutter-content-private.h \
clutter-debug.h \
clutter-device-manager-private.h \
clutter-easing.h \
clutter-effect-private.h \
clutter-event-translator.h \
clutter-event-private.h \
clutter-event-private.h \
clutter-flatten-effect.h \
clutter-gesture-action-private.h \
clutter-id-pool.h \
clutter-master-clock.h \
clutter-model-private.h \
clutter-master-clock.h \
clutter-model-private.h \
clutter-offscreen-effect-private.h \
clutter-paint-node-private.h \
clutter-paint-volume-private.h \
clutter-paint-volume-private.h \
clutter-private.h \
clutter-profile.h \
clutter-script-private.h \
clutter-settings-private.h \
clutter-stage-manager-private.h \
clutter-stage-private.h \
clutter-stage-window.h \
clutter-stage-manager-private.h \
clutter-stage-private.h \
clutter-stage-window.h \
$(NULL)
# private source code; these should not be introspected

View File

@ -611,7 +611,7 @@
#include "clutter-animatable.h"
#include "clutter-color-static.h"
#include "clutter-color.h"
#include "clutter-constraint.h"
#include "clutter-constraint-private.h"
#include "clutter-container.h"
#include "clutter-content-private.h"
#include "clutter-debug.h"
@ -9650,19 +9650,21 @@ clutter_actor_update_constraints (ClutterActor *self,
if (clutter_actor_meta_get_enabled (meta))
{
_clutter_constraint_update_allocation (constraint,
self,
allocation);
gboolean changed =
clutter_constraint_update_allocation (constraint,
self,
allocation);
CLUTTER_NOTE (LAYOUT,
"Allocation of '%s' after constraint '%s': "
"{ %.2f, %.2f, %.2f, %.2f }",
"{ %.2f, %.2f, %.2f, %.2f } (changed:%s)",
_clutter_actor_get_debug_name (self),
_clutter_actor_meta_get_debug_name (meta),
allocation->x1,
allocation->y1,
allocation->x2,
allocation->y2);
allocation->y2,
changed ? "yes" : "no");
}
}
}

View File

@ -0,0 +1,35 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __CLUTTER_CONSTRAINT_PRIVATE_H__
#define __CLUTTER_CONSTRAINT_PRIVATE_H__
#include "clutter-constraint.h"
G_BEGIN_DECLS
gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation);
G_END_DECLS
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */

View File

@ -1,3 +1,27 @@
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2010 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Author:
* Emmanuele Bassi <ebassi@linux.intel.com>
*/
/**
* SECTION:clutter-constraint
* @Title: ClutterConstraint
@ -110,7 +134,7 @@
#include <string.h>
#include "clutter-constraint.h"
#include "clutter-constraint-private.h"
#include "clutter-actor.h"
#include "clutter-actor-meta-private.h"
@ -159,16 +183,32 @@ clutter_constraint_init (ClutterConstraint *self)
{
}
void
_clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation)
/*< private >
* clutter_constraint_update_allocation:
* @constraint: a #ClutterConstraint
* @actor: a #ClutterActor
* @allocation: (inout): the allocation to modify
*
* Asks the @constraint to update the @allocation of a #ClutterActor.
*
* Returns: %TRUE if the allocation was updated
*/
gboolean
clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation)
{
g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
g_return_if_fail (allocation != NULL);
ClutterActorBox old_alloc;
g_return_val_if_fail (CLUTTER_IS_CONSTRAINT (constraint), FALSE);
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), FALSE);
g_return_val_if_fail (allocation != NULL, FALSE);
old_alloc = *allocation;
CLUTTER_CONSTRAINT_GET_CLASS (constraint)->update_allocation (constraint,
actor,
allocation);
return clutter_actor_box_equal (allocation, &old_alloc);
}

View File

@ -113,7 +113,7 @@ CLUTTER_AVAILABLE_IN_1_4
void clutter_actor_clear_constraints (ClutterActor *self);
CLUTTER_AVAILABLE_IN_1_10
gboolean clutter_actor_has_constraints (ClutterActor *self);
gboolean clutter_actor_has_constraints (ClutterActor *self);
G_END_DECLS

View File

@ -245,10 +245,6 @@ gboolean _clutter_boolean_continue_accumulator (GSignalInvocationHint *ihint,
void _clutter_run_repaint_functions (ClutterRepaintFlags flags);
void _clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation);
GType _clutter_layout_manager_get_child_meta_type (ClutterLayoutManager *manager);
void _clutter_util_fully_transform_vertices (const CoglMatrix *modelview,

View File

@ -72,6 +72,7 @@ IGNORE_HFILES = \
clutter-cogl-compat.h \
clutter-color-static.h \
clutter-config.h \
clutter-constraint-private.h \
clutter-debug.h \
clutter-deprecated.h \
clutter-device-manager-private.h \