[clutter/clutter-1.22] constraint: Add a private header



commit 82fffaedb632bd7bf6a147d0fee41b8133cc6ad8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Dec 14 14:20:53 2014 +0000

    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.

 clutter/Makefile.am                  |   17 +++++-----
 clutter/clutter-actor.c              |   14 +++++----
 clutter/clutter-constraint-private.h |   35 +++++++++++++++++++++
 clutter/clutter-constraint.c         |   56 +++++++++++++++++++++++++++++-----
 clutter/clutter-constraint.h         |    2 +-
 clutter/clutter-private.h            |    4 --
 doc/reference/clutter/Makefile.am    |    1 +
 7 files changed, 102 insertions(+), 27 deletions(-)
---
diff --git a/clutter/Makefile.am b/clutter/Makefile.am
index 027f66f..d04dc6f 100644
--- a/clutter/Makefile.am
+++ b/clutter/Makefile.am
@@ -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
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 322ba70..38e454b 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -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");
         }
     }
 }
diff --git a/clutter/clutter-constraint-private.h b/clutter/clutter-constraint-private.h
new file mode 100644
index 0000000..5fbddef
--- /dev/null
+++ b/clutter/clutter-constraint-private.h
@@ -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__ */
diff --git a/clutter/clutter-constraint.c b/clutter/clutter-constraint.c
index 8749ed9..be6dae8 100644
--- a/clutter/clutter-constraint.c
+++ b/clutter/clutter-constraint.c
@@ -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);
 }
diff --git a/clutter/clutter-constraint.h b/clutter/clutter-constraint.h
index 28aaf30..956264e 100644
--- a/clutter/clutter-constraint.h
+++ b/clutter/clutter-constraint.h
@@ -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
 
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index b714edc..4c8bb40 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -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,
diff --git a/doc/reference/clutter/Makefile.am b/doc/reference/clutter/Makefile.am
index e48f188..2de13f8 100644
--- a/doc/reference/clutter/Makefile.am
+++ b/doc/reference/clutter/Makefile.am
@@ -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        \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]