From b7e063c3ce7ccc388c8d7aa3ebc877c61ef8f67b Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 26 Jul 2007 13:13:23 +0000 Subject: [PATCH] Add a header for common types to avoid inclusion hell This patch adds clutter-types.h, a header file containing some common structures and enums, shared by different objects. --- clutter/Makefile.am | 3 +- clutter/clutter-actor.h | 65 +------------ clutter/clutter-behaviour-rotate.h | 14 +-- clutter/clutter-behaviour-scale.h | 3 +- clutter/clutter-behaviour.h | 26 +---- clutter/clutter-types.h | 148 +++++++++++++++++++++++++++++ clutter/clutter.h | 1 + 7 files changed, 161 insertions(+), 99 deletions(-) create mode 100644 clutter/clutter-types.h diff --git a/clutter/Makefile.am b/clutter/Makefile.am index c8ba56153..4924abaec 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -52,6 +52,7 @@ source_h = \ $(srcdir)/clutter-clone-texture.h \ $(srcdir)/clutter-color.h \ $(srcdir)/clutter-container.h \ + $(srcdir)/clutter-effect.h \ $(srcdir)/clutter-entry.h \ $(srcdir)/clutter-event.h \ $(srcdir)/clutter-feature.h \ @@ -68,7 +69,7 @@ source_h = \ $(srcdir)/clutter-texture.h \ $(srcdir)/clutter-timeline.h \ $(srcdir)/clutter-timeout-pool.h \ - $(srcdir)/clutter-effect.h \ + $(srcdir)/clutter-types.h \ $(srcdir)/clutter-units.h \ $(srcdir)/clutter-util.h \ $(srcdir)/clutter-vbox.h \ diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index a8a5194db..a74807161 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -29,16 +29,14 @@ /* clutter-actor.h */ #include -#include -#include #include +#include +#include +#include G_BEGIN_DECLS -#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ()) #define CLUTTER_TYPE_ACTOR_BOX (clutter_actor_box_get_type ()) -#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ()) - #define CLUTTER_TYPE_ACTOR (clutter_actor_get_type ()) #define CLUTTER_ACTOR(obj) \ @@ -60,49 +58,14 @@ G_BEGIN_DECLS #define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \ CLUTTER_ACTOR_IS_REALIZED (e)) -typedef enum { /*< prefix=CLUTTER_GRAVITY >*/ - CLUTTER_GRAVITY_NONE = 0, - CLUTTER_GRAVITY_NORTH, - CLUTTER_GRAVITY_NORTH_EAST, - CLUTTER_GRAVITY_EAST, - CLUTTER_GRAVITY_SOUTH_EAST, - CLUTTER_GRAVITY_SOUTH, - CLUTTER_GRAVITY_SOUTH_WEST, - CLUTTER_GRAVITY_WEST, - CLUTTER_GRAVITY_NORTH_WEST, - CLUTTER_GRAVITY_CENTER -} ClutterGravity; - typedef struct _ClutterActor ClutterActor; typedef struct _ClutterActorClass ClutterActorClass; typedef struct _ClutterActorBox ClutterActorBox; typedef struct _ClutterActorPrivate ClutterActorPrivate; -typedef struct _ClutterGeometry ClutterGeometry; -typedef struct _ClutterVertex ClutterVertex; typedef void (*ClutterCallback) (ClutterActor *actor, gpointer data); #define CLUTTER_CALLBACK(f) ((ClutterCallback) (f)) -/** - * ClutterGeometry: - * @x: X coordinate of the top left corner of an actor - * @y: Y coordinate of the top left corner of an actor - * @width: width of an actor - * @height: height of an actor - * - * Rectangle containing an actor. - */ -struct _ClutterGeometry -{ - /*< public >*/ - gint x; - gint y; - guint width; - guint height; -}; - -GType clutter_geometry_get_type (void) G_GNUC_CONST; - /** * ClutterActorFlags: * @CLUTTER_ACTOR_MAPPED: the actor has been painted @@ -129,7 +92,8 @@ typedef enum * #ClutterUnits, that is are device-independent. If you want to obtain * the box dimensions in pixels, use clutter_actor_get_geometry(). */ -struct _ClutterActorBox { +struct _ClutterActorBox +{ ClutterUnit x1; ClutterUnit y1; ClutterUnit x2; @@ -138,25 +102,6 @@ struct _ClutterActorBox { GType clutter_actor_box_get_type (void) G_GNUC_CONST; -/** - * ClutterVertex: - * @x: X coordinate of the vertex - * @y: Y coordinate of the vertex - * @z: Z coordinate of the vertex - * - * Vertex of an actor in 3D space, expressed in device independent units. - * - * Since: 0.4 - */ -struct _ClutterVertex -{ - ClutterUnit x; - ClutterUnit y; - ClutterUnit z; -}; - -GType clutter_vertex_get_type (void) G_GNUC_CONST; - /** * ClutterActor: * @flags: #ClutterActorFlags diff --git a/clutter/clutter-behaviour-rotate.h b/clutter/clutter-behaviour-rotate.h index 17a0fbe96..f69488963 100644 --- a/clutter/clutter-behaviour-rotate.h +++ b/clutter/clutter-behaviour-rotate.h @@ -26,8 +26,9 @@ #ifndef __CLUTTER_BEHAVIOUR_ROTATE_H__ #define __CLUTTER_BEHAVIOUR_ROTATE_H__ -#include #include +#include +#include G_BEGIN_DECLS @@ -38,17 +39,6 @@ G_BEGIN_DECLS #define CLUTTER_IS_BEHAVIOUR_ROTATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE)) #define CLUTTER_BEHAVIOUR_ROTATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((klass), CLUTTER_TYPE_BEHAVIOUR_ROTATE, ClutterBehaviourRotateClass)) -typedef enum { /*< prefix=CLUTTER >*/ - CLUTTER_X_AXIS, - CLUTTER_Y_AXIS, - CLUTTER_Z_AXIS -} ClutterRotateAxis; - -typedef enum { /*< prefix=CLUTTER_ROTATE >*/ - CLUTTER_ROTATE_CW, - CLUTTER_ROTATE_CCW -} ClutterRotateDirection; - typedef struct _ClutterBehaviourRotate ClutterBehaviourRotate; typedef struct _ClutterBehaviourRotatePrivate ClutterBehaviourRotatePrivate; typedef struct _ClutterBehaviourRotateClass ClutterBehaviourRotateClass; diff --git a/clutter/clutter-behaviour-scale.h b/clutter/clutter-behaviour-scale.h index b8f02decd..3e9bcc143 100644 --- a/clutter/clutter-behaviour-scale.h +++ b/clutter/clutter-behaviour-scale.h @@ -28,9 +28,10 @@ #ifndef __CLUTTER_BEHAVIOUR_SCALE_H__ #define __CLUTTER_BEHAVIOUR_SCALE_H__ +#include #include #include -#include +#include G_BEGIN_DECLS diff --git a/clutter/clutter-behaviour.h b/clutter/clutter-behaviour.h index 2498c917f..00627e34b 100644 --- a/clutter/clutter-behaviour.h +++ b/clutter/clutter-behaviour.h @@ -30,34 +30,10 @@ #include #include +#include G_BEGIN_DECLS -#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ()) - -typedef struct _ClutterKnot ClutterKnot; - -/** - * ClutterKnot: - * @x: X coordinate of the knot - * @y: Y coordinate of the knot - * - * Point in a path behaviour. - * - * Since: 0.2 - */ -struct _ClutterKnot -{ - gint x; - gint y; -}; - -GType clutter_knot_get_type (void) G_GNUC_CONST; -ClutterKnot *clutter_knot_copy (const ClutterKnot *knot); -void clutter_knot_free (ClutterKnot *knot); -gboolean clutter_knot_equal (const ClutterKnot *knot_a, - const ClutterKnot *knot_b); - #define CLUTTER_TYPE_BEHAVIOUR clutter_behaviour_get_type() #define CLUTTER_BEHAVIOUR(obj) \ diff --git a/clutter/clutter-types.h b/clutter/clutter-types.h new file mode 100644 index 000000000..fac26183c --- /dev/null +++ b/clutter/clutter-types.h @@ -0,0 +1,148 @@ +/* + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2006 OpenedHand + * + * 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, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __CLUTTER_TYPES_H__ +#define __CLUTTER_TYPES_H__ + +#include +#include + +G_BEGIN_DECLS + +#define CLUTTER_TYPE_GEOMETRY (clutter_geometry_get_type ()) +#define CLUTTER_TYPE_KNOT (clutter_knot_get_type ()) +#define CLUTTER_TYPE_VERTEX (clutter_vertex_get_type ()) + +typedef enum { /*< prefix=CLUTTER_GRAVITY >*/ + CLUTTER_GRAVITY_NONE = 0, + CLUTTER_GRAVITY_NORTH, + CLUTTER_GRAVITY_NORTH_EAST, + CLUTTER_GRAVITY_EAST, + CLUTTER_GRAVITY_SOUTH_EAST, + CLUTTER_GRAVITY_SOUTH, + CLUTTER_GRAVITY_SOUTH_WEST, + CLUTTER_GRAVITY_WEST, + CLUTTER_GRAVITY_NORTH_WEST, + CLUTTER_GRAVITY_CENTER +} ClutterGravity; + +typedef struct _ClutterGeometry ClutterGeometry; +typedef struct _ClutterKnot ClutterKnot; +typedef struct _ClutterVertex ClutterVertex; + +/** + * ClutterGeometry: + * @x: X coordinate of the top left corner of an actor + * @y: Y coordinate of the top left corner of an actor + * @width: width of an actor + * @height: height of an actor + * + * Rectangle containing an actor. + */ +struct _ClutterGeometry +{ + /*< public >*/ + gint x; + gint y; + guint width; + guint height; +}; + +GType clutter_geometry_get_type (void) G_GNUC_CONST; + + +/** + * ClutterVertex: + * @x: X coordinate of the vertex + * @y: Y coordinate of the vertex + * @z: Z coordinate of the vertex + * + * Vertex of an actor in 3D space, expressed in device independent units. + * + * Since: 0.4 + */ +struct _ClutterVertex +{ + ClutterUnit x; + ClutterUnit y; + ClutterUnit z; +}; + +GType clutter_vertex_get_type (void) G_GNUC_CONST; + +/** + * ClutterKnot: + * @x: X coordinate of the knot + * @y: Y coordinate of the knot + * + * Point in a path behaviour. + * + * Since: 0.2 + */ +struct _ClutterKnot +{ + gint x; + gint y; +}; + +GType clutter_knot_get_type (void) G_GNUC_CONST; +ClutterKnot *clutter_knot_copy (const ClutterKnot *knot); +void clutter_knot_free (ClutterKnot *knot); +gboolean clutter_knot_equal (const ClutterKnot *knot_a, + const ClutterKnot *knot_b); + +/** + * ClutterRotateAxis: + * @CLUTTER_X_AXIS: FIXME + * @CLUTTER_Y_AXIS: FIXME + * @CLUTTER_Z_AXIS: FIXME + * + * FIXME + * + * Since: 0.4 + */ +typedef enum { /*< prefix=CLUTTER >*/ + CLUTTER_X_AXIS, + CLUTTER_Y_AXIS, + CLUTTER_Z_AXIS +} ClutterRotateAxis; + +/** + * ClutterRotateDirection: + * @CLUTTER_ROTATE_CW: Clockwise rotation + * @CLUTTER_ROTATE_CCW: Counter-clockwise rotation + * + * FIXME + * + * Since: 0.4 + */ +typedef enum { /*< prefix=CLUTTER_ROTATE >*/ + CLUTTER_ROTATE_CW, + CLUTTER_ROTATE_CCW +} ClutterRotateDirection; + +G_END_DECLS + +#endif /* __CLUTTER_TYPES_H__ */ diff --git a/clutter/clutter.h b/clutter/clutter.h index d221cbdaa..1dbe2e7d1 100644 --- a/clutter/clutter.h +++ b/clutter/clutter.h @@ -57,6 +57,7 @@ #include "clutter-texture.h" #include "clutter-timeout-pool.h" #include "clutter-timeline.h" +#include "clutter-types.h" #include "clutter-units.h" #include "clutter-util.h" #include "clutter-vbox.h"