diff --git a/ChangeLog b/ChangeLog index 3deb7afbf..a06a036f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2006-11-20 Emmanuele Bassi + + * clutter/Makefile.am: + * clutter/clutter.h: + * clutter/clutter-version.h.in: Auto-generated versioning macros. + + * clutter/clutter-actor.h: + * clutter/clutter-actor.c: Add a ClutterActor::parent-set signal, + for notificating changes of an actor's parent; add api-doc for + the actor's properties; add the ClutterActor "name" property; clean + up a bit some functions; emit the "parent-set" signal when setting + te parent and when unparenting; better warnings when lowering + and raising an actor. + + * configure.ac: + * clutter/Makefile.am: Add a --enable-debug configure option, + with three levels of debugging: no, minimum and yes; default + for development releases (odd minor version) is "yes"; update + the version m4 defines; update the libtool macros: now just + changed the clutter_interface_age when releasing will update + everything else. + 2006-11-17 Emmanuele Bassi * clutter/clutter-behaviour-path.h: diff --git a/clutter/Makefile.am b/clutter/Makefile.am index e2bb60c56..44d4a3d28 100644 --- a/clutter/Makefile.am +++ b/clutter/Makefile.am @@ -2,6 +2,7 @@ SUBDIRS=pango MARSHALFILES = clutter-marshal.c clutter-marshal.h ENUMFILES = clutter-enum-types.c clutter-enum-types.h +STAMPFILES = stamp-clutter-marshal.h stamp-clutter-enum-types.h GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0` GLIB_MKENUMS=`pkg-config --variable=glib_mkenums glib-2.0` @@ -28,15 +29,28 @@ source_h = \ $(srcdir)/clutter-behaviour-scale.h \ $(srcdir)/clutter-alpha.h \ $(srcdir)/clutter-media.h \ + $(srcdir)/clutter-version.h \ $(srcdir)/clutter-main.h -clutter-marshal.h: clutter-marshal.list - ( $(GLIB_GENMARSHAL) --prefix=clutter_marshal \ - $(srcdir)/clutter-marshal.list --header > clutter-marshal.h ) +clutter-marshal.h: stamp-clutter-marshal.h + @true +stamp-clutter-marshal.h: clutter-marshal.list + $(GLIB_GENMARSHAL) \ + --prefix=clutter_marshal \ + --header \ + $(srcdir)/clutter-marshal.list > xgen-cmh \ + && (cmp -s xgen-cmh clutter-marshal.h || cp xgen-cmh clutter-marshal.h ) \ + && rm -f xgen-cmh \ + && echo timestamp > $(@F) -clutter-marshal.c: clutter-marshal.h - ( $(GLIB_GENMARSHAL) --prefix=clutter_marshal \ - $(srcdir)/clutter-marshal.list --body --header > clutter-marshal.c ) +clutter-marshal.c: clutter-marshal.h Makefile + ( echo "#include \"clutter-marshal.h\"" ; \ + $(GLIB_GENMARSHAL) \ + --prefix=clutter_marshal \ + --body \ + $(srcdir)/clutter-marshal.list --body ) >> xgen-cmc \ + && cp xgen-cmc clutter-marshal.c \ + && rm -f xgen-cmc clutter-enum-types.h: stamp-clutter-enum-types.h @true @@ -73,7 +87,9 @@ clutter-enum-types.c: clutter-enum-types.h && cp xgen-cetc clutter-enum-types.c \ && rm -f xgen-cetc -CLEANFILES = $(BUILT_SOURCES) stamp-clutter-enum-types.h +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(STAMPFILES) source_c = clutter-main.c \ clutter-util.c \ @@ -103,7 +119,16 @@ libclutter_@CLUTTER_MAJORMINOR@_la_SOURCES = $(MARSHALFILES) \ $(source_h) \ $(source_h_priv) -INCLUDES = @GCC_FLAGS@ @CLUTTER_CFLAGS@ -I$(top_srcdir) -I$(top_srcdir)/clutter/pango +INCLUDES = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/clutter/pango \ + -DPREFIX=\""$(prefix)"\" \ + -DLIBDIR=\""$(libdir)"\" \ + -DDATADIR=\""$(datadir)"\" \ + -DG_DISABLE_DEPRECATED \ + $(GCC_FLAGS) \ + $(CLUTTER_CFLAGS) \ + $(CLUTTER_DEBUG_CFLAGS) lib_LTLIBRARIES = libclutter-@CLUTTER_MAJORMINOR@.la @@ -119,4 +144,4 @@ clutterheaders_HEADERS = $(source_h) \ clutter-enum-types.h \ clutter.h -EXTRA_DIST = clutter-marshal.list +EXTRA_DIST = clutter-marshal.list clutter-version.h.in diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index c071471e8..a10772d8c 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -90,6 +90,7 @@ enum SHOW, HIDE, DESTROY, + PARENT_SET, LAST_SIGNAL }; @@ -590,69 +591,121 @@ clutter_actor_class_init (ClutterActorClass *klass) g_type_class_add_private (klass, sizeof (ClutterActorPrivate)); - g_object_class_install_property (object_class, PROP_X, - g_param_spec_int ("x", - "X co-ord", - "X co-ord of actor", - 0, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_Y, - g_param_spec_int ("y", - "Y co-ord", - "Y co-ord of actor", - 0, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_int ("width", - "Width", - "Width of actor in pixels", - 0, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_int ("height", - "Height", - "Height of actor in pixels", - 0, - G_MAXINT, - 0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_OPACITY, - g_param_spec_uchar ("opacity", - "Opacity", - "Opacity of actor", - 0, - 0xff, - 0xff, - G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_VISIBLE, - g_param_spec_boolean ("visible", - "Visible", - "Whether the actor is visible or not", - FALSE, - G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_HAS_CLIP, - g_param_spec_boolean ("has-clip", - "Has Clip", - "Whether the actor has a clip set or not", - FALSE, - G_PARAM_READABLE)); - g_object_class_install_property (object_class, PROP_CLIP, - g_param_spec_boxed ("clip", - "Clip", - "The clip region for the actor", - CLUTTER_TYPE_GEOMETRY, - G_PARAM_READWRITE)); + /** + * ClutterActor:x: + * + * X coordinate of the actor. + */ + g_object_class_install_property (object_class, + PROP_X, + g_param_spec_int ("x", + "X co-ord", + "X co-ord of actor", + 0, G_MAXINT, + 0, + G_PARAM_READWRITE)); + /** + * ClutterActor:y: + * + * Y coordinate of the actor. + */ + g_object_class_install_property (object_class, + PROP_Y, + g_param_spec_int ("y", + "Y co-ord", + "Y co-ord of actor", + 0, G_MAXINT, + 0, + G_PARAM_READWRITE)); + /** + * ClutterActor:width: + * + * Width of the actor (in pixels). + */ + g_object_class_install_property (object_class, + PROP_WIDTH, + g_param_spec_int ("width", + "Width", + "Width of actor in pixels", + 0, G_MAXINT, + 0, + G_PARAM_READWRITE)); + /** + * ClutterActor:height: + * + * Height of the actor (in pixels). + */ + g_object_class_install_property (object_class, + PROP_HEIGHT, + g_param_spec_int ("height", + "Height", + "Height of actor in pixels", + 0, G_MAXINT, + 0, + G_PARAM_READWRITE)); + /** + * ClutterActor:opacity: + * + * Opacity of the actor. + */ + g_object_class_install_property (object_class, + PROP_OPACITY, + g_param_spec_uchar ("opacity", + "Opacity", + "Opacity of actor", + 0, 0xff, + 0xff, + G_PARAM_CONSTRUCT | G_PARAM_READWRITE)); + /** + * ClutterActor:visible: + * + * Whether the actor is visible or not. + */ + g_object_class_install_property (object_class, + PROP_VISIBLE, + g_param_spec_boolean ("visible", + "Visible", + "Whether the actor is visible or not", + FALSE, + G_PARAM_READWRITE)); + /** + * ClutterActor:has-clip: + * + * Whether the actor has the clip property set or not. + */ + g_object_class_install_property (object_class, + PROP_HAS_CLIP, + g_param_spec_boolean ("has-clip", + "Has Clip", + "Whether the actor has a clip set or not", + FALSE, + G_PARAM_READABLE)); + /** + * ClutterActor:clip: + * + * The clip region for the actor. + */ + g_object_class_install_property (object_class, + PROP_CLIP, + g_param_spec_boxed ("clip", + "Clip", + "The clip region for the actor", + CLUTTER_TYPE_GEOMETRY, + G_PARAM_READWRITE)); + /** + * ClutterActor:name: + * + * The name of the actor. + * + * Since: 0.2 + */ + g_object_class_install_property (object_class, + PROP_NAME, + g_param_spec_string ("name", + "Name", + "Name of the actor", + NULL, + G_PARAM_READWRITE)); /** * ClutterActor::destroy: @@ -662,7 +715,7 @@ clutter_actor_class_init (ClutterActorClass *klass) * either by direct invocation of clutter_actor_destroy() or * when the #ClutterGroup that contains the actor is destroyed. * - * Since: 0.1.1 + * Since: 0.2 */ actor_signals[DESTROY] = g_signal_new ("destroy", @@ -678,7 +731,7 @@ clutter_actor_class_init (ClutterActorClass *klass) * * The ::show signal is emitted when an actor becomes visible. * - * Since: 0.1.1 + * Since: 0.2 */ actor_signals[SHOW] = g_signal_new ("show", @@ -694,7 +747,7 @@ clutter_actor_class_init (ClutterActorClass *klass) * * The ::hide signal is emitted when an actor is no longer visible. * - * Since: 0.1.1 + * Since: 0.2 */ actor_signals[HIDE] = g_signal_new ("hide", @@ -703,7 +756,25 @@ clutter_actor_class_init (ClutterActorClass *klass) G_STRUCT_OFFSET (ClutterActorClass, hide), NULL, NULL, clutter_marshal_VOID__VOID, - G_TYPE_NONE, 0); + G_TYPE_NONE, 0); + /** + * ClutterActor::parent-set: + * @actor: the object which received the signal + * @old_parent: the previous parent of the actor, or %NULL + * + * This signal is emitted when the parent of the actor changes. + * + * Since: 0.2 + */ + actor_signals[PARENT_SET] = + g_signal_new ("parent-set", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ClutterActorClass, parent_set), + NULL, NULL, + clutter_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + CLUTTER_TYPE_ACTOR); } static void @@ -829,10 +900,10 @@ clutter_actor_get_geometry (ClutterActor *self, */ void clutter_actor_get_coords (ClutterActor *self, - gint *x1, - gint *y1, - gint *x2, - gint *y2) + gint *x1, + gint *y1, + gint *x2, + gint *y2) { ClutterActorBox box; @@ -840,10 +911,17 @@ clutter_actor_get_coords (ClutterActor *self, clutter_actor_allocate_coords (self, &box); - if (x1) *x1 = box.x1; - if (y1) *y1 = box.y1; - if (x2) *x2 = box.x2; - if (y2) *y2 = box.y2; + if (x1) + *x1 = box.x1; + + if (y1) + *y1 = box.y1; + + if (x2) + *x2 = box.x2; + + if (y2) + *y2 = box.y2; } /** @@ -857,8 +935,8 @@ clutter_actor_get_coords (ClutterActor *self, */ void clutter_actor_set_position (ClutterActor *self, - gint x, - gint y) + gint x, + gint y) { ClutterActorBox box; @@ -916,8 +994,8 @@ clutter_actor_move_by (ClutterActor *self, */ void clutter_actor_set_size (ClutterActor *self, - gint width, - gint height) + gint width, + gint height) { ClutterActorBox box; @@ -949,9 +1027,10 @@ clutter_actor_get_size (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR (self)); if (width) - *width = clutter_actor_get_width(self); + *width = clutter_actor_get_width (self); + if (height) - *height = clutter_actor_get_height(self); + *height = clutter_actor_get_height (self); } /** @@ -981,17 +1060,23 @@ clutter_actor_get_abs_position (ClutterActor *self, /* FIXME: must be nicer way to get 0,0 for stage ? */ if (parent) { - ClutterFixed parent_scale_x, parent_scale_y, fx, fy; + ClutterFixed parent_scale_x, parent_scale_y; + ClutterFixed fx, fy; - clutter_actor_get_scalex(parent, &parent_scale_x, &parent_scale_y); + clutter_actor_get_scalex (parent, + &parent_scale_x, + &parent_scale_y); - if (parent_scale_x != CFX_ONE || parent_scale_y != CFX_ONE) + if (parent_scale_x != CFX_ONE || + parent_scale_y != CFX_ONE) { - fx = CLUTTER_FIXED_MUL(CLUTTER_INT_TO_FIXED(box.x1),parent_scale_x); - fy = CLUTTER_FIXED_MUL(CLUTTER_INT_TO_FIXED(box.y1),parent_scale_y); + fx = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (box.x1), + parent_scale_x); + fy = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (box.y1), + parent_scale_y); - box.x1 = CLUTTER_FIXED_INT(fx); - box.y1 = CLUTTER_FIXED_INT(fy); + box.x1 = CLUTTER_FIXED_INT (fx); + box.y1 = CLUTTER_FIXED_INT (fy); } if (!CLUTTER_IS_STAGE (parent)) @@ -1026,6 +1111,7 @@ clutter_actor_get_abs_size (ClutterActor *self, if (width) *width = box.x2 - box.x1; + if (height) *height = box.y2 - box.y1; @@ -1033,26 +1119,27 @@ clutter_actor_get_abs_size (ClutterActor *self, do { - if (parent->priv->scale_x != CFX_ONE || parent->priv->scale_y != CFX_ONE) + if (parent->priv->scale_x != CFX_ONE || + parent->priv->scale_y != CFX_ONE) { ClutterFixed fx, fy; if (width) { - fx = CLUTTER_FIXED_MUL(CLUTTER_INT_TO_FIXED(*width), + fx = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (*width), parent->priv->scale_x); - *width = CLUTTER_FIXED_INT(fx); + *width = CLUTTER_FIXED_INT (fx); } if (height) { - fy = CLUTTER_FIXED_MUL(CLUTTER_INT_TO_FIXED(*height), + fy = CLUTTER_FIXED_MUL (CLUTTER_INT_TO_FIXED (*height), parent->priv->scale_x); - *height = CLUTTER_FIXED_INT(fy); + *height = CLUTTER_FIXED_INT (fy); } } } - while ((parent = clutter_actor_get_parent(parent)) != NULL); + while ((parent = clutter_actor_get_parent (parent)) != NULL); } @@ -1206,14 +1293,14 @@ clutter_actor_get_scalex (ClutterActor *self, */ void clutter_actor_get_scale (ClutterActor *self, - double *scale_x, - double *scale_y) + gdouble *scale_x, + gdouble *scale_y) { if (scale_x) - *scale_x = CLUTTER_FIXED_TO_FLOAT(self->priv->scale_x); + *scale_x = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_x); if (scale_y) - *scale_y = CLUTTER_FIXED_TO_FLOAT(self->priv->scale_y); + *scale_y = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_y); } @@ -1273,12 +1360,15 @@ clutter_actor_set_name (ClutterActor *self, { g_return_if_fail (CLUTTER_IS_ACTOR (self)); + g_object_ref (self); + g_free (self->priv->name); - if (name || name[0] != '\0') - { - self->priv->name = g_strdup(name); - } + if (name && name[0] != '\0') + self->priv->name = g_strdup(name); + + g_object_notify (G_OBJECT (self), "name"); + g_object_unref (self); } /** @@ -1324,7 +1414,7 @@ clutter_actor_get_id (ClutterActor *self) */ void clutter_actor_set_depth (ClutterActor *self, - gint depth) + gint depth) { /* Sets Z value. - FIXME: should invert ?*/ self->priv->z = depth; @@ -1368,10 +1458,10 @@ clutter_actor_get_depth (ClutterActor *self) * Rotates actor around the Z axis. */ void -clutter_actor_rotate_z (ClutterActor *self, - gfloat angle, - gint x, - gint y) +clutter_actor_rotate_z (ClutterActor *self, + gfloat angle, + gint x, + gint y) { g_return_if_fail (CLUTTER_IS_ACTOR (self)); @@ -1393,10 +1483,10 @@ clutter_actor_rotate_z (ClutterActor *self, * Rotates actor around the X axis. */ void -clutter_actor_rotate_x (ClutterActor *self, - gfloat angle, - gint y, - gint z) +clutter_actor_rotate_x (ClutterActor *self, + gfloat angle, + gint y, + gint z) { g_return_if_fail (CLUTTER_IS_ACTOR (self)); @@ -1418,10 +1508,10 @@ clutter_actor_rotate_x (ClutterActor *self, * Rotates actor around the X axis. */ void -clutter_actor_rotate_y (ClutterActor *self, - gfloat angle, - gint x, - gint z) +clutter_actor_rotate_y (ClutterActor *self, + gfloat angle, + gint x, + gint z) { g_return_if_fail (CLUTTER_IS_ACTOR (self)); @@ -1537,10 +1627,16 @@ clutter_actor_set_parent (ClutterActor *self, g_object_ref_sink (self); self->priv->parent_actor = parent; + g_signal_emit (self, actor_signals[PARENT_SET], 0, NULL); + + if (CLUTTER_ACTOR_IS_REALIZED (self->priv->parent_actor)) + clutter_actor_realize (self); if (CLUTTER_ACTOR_IS_VISIBLE (self->priv->parent_actor) && CLUTTER_ACTOR_IS_VISIBLE (self)) - clutter_actor_queue_redraw (self); + { + clutter_actor_queue_redraw (self); + } } /** @@ -1571,6 +1667,8 @@ clutter_actor_get_parent (ClutterActor *self) void clutter_actor_unparent (ClutterActor *self) { + ClutterActor *old_parent; + g_return_if_fail (CLUTTER_IS_ACTOR (self)); if (self->priv->parent_actor == NULL) @@ -1585,7 +1683,10 @@ clutter_actor_unparent (ClutterActor *self) clutter_actor_unrealize (self); } + old_parent = self->priv->parent_actor; self->priv->parent_actor = NULL; + g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent); + g_object_unref (self); } @@ -1598,7 +1699,7 @@ clutter_actor_unparent (ClutterActor *self) * logically equivalent to calling clutter_actory_unparent() * and clutter_actor_set_parent(). * - * Since: 0.1.1 + * Since: 0.2 */ void clutter_actor_reparent (ClutterActor *self, @@ -1616,6 +1717,8 @@ clutter_actor_reparent (ClutterActor *self, if (self->priv->parent_actor != new_parent) { + ClutterActor *old_parent; + /* if the actor and the parent have already been realized, * mark the actor as reparenting, so that clutter_actor_unparent() * just hides the actor instead of unrealize it. @@ -1626,6 +1729,8 @@ clutter_actor_reparent (ClutterActor *self, CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_IN_REPARENT); } + old_parent = self->priv->parent_actor; + g_object_ref (self); clutter_group_remove (CLUTTER_GROUP (self->priv->parent_actor), self); clutter_group_add (CLUTTER_GROUP (new_parent), self); @@ -1648,14 +1753,34 @@ clutter_actor_reparent (ClutterActor *self, * Both actors must have the same parent. */ void -clutter_actor_raise (ClutterActor *self, ClutterActor *below) +clutter_actor_raise (ClutterActor *self, + ClutterActor *below) { - g_return_if_fail (CLUTTER_IS_ACTOR(self)); - g_return_if_fail (clutter_actor_get_parent (self) != NULL); + ClutterActor *parent; - clutter_group_raise (CLUTTER_GROUP(clutter_actor_get_parent (self)), - self, - below); + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + parent = clutter_actor_get_parent (self); + if (!parent) + { + g_warning ("Actor of type %s is not inside a group", + g_type_name (G_OBJECT_TYPE (self))); + return; + } + + if (below) + { + if (parent != clutter_actor_get_parent (below)) + { + g_warning ("Actor of type %s is not in the same " + "group of actor of type %s", + g_type_name (G_OBJECT_TYPE (self)), + g_type_name (G_OBJECT_TYPE (below))); + return; + } + } + + clutter_group_raise (CLUTTER_GROUP (parent), self, below); } /** @@ -1667,22 +1792,35 @@ clutter_actor_raise (ClutterActor *self, ClutterActor *below) * Both actors must have the same parent. */ void -clutter_actor_lower (ClutterActor *self, ClutterActor *above) +clutter_actor_lower (ClutterActor *self, + ClutterActor *above) { - g_return_if_fail (CLUTTER_IS_ACTOR(self)); - g_return_if_fail (clutter_actor_get_parent (self) != NULL); + ClutterActor *parent; - if (above != NULL) + g_return_if_fail (CLUTTER_IS_ACTOR(self)); + + parent = clutter_actor_get_parent (self); + if (!parent) { - g_return_if_fail - (clutter_actor_get_parent (self) - != clutter_actor_get_parent (above)); + g_warning ("Actor of type %s is not inside a group", + g_type_name (G_OBJECT_TYPE (self))); + return; + } + + if (above) + { + if (parent != clutter_actor_get_parent (above)) + { + g_warning ("Actor of type %s is not in the same " + "group of actor of type %s", + g_type_name (G_OBJECT_TYPE (self)), + g_type_name (G_OBJECT_TYPE (above))); + return; + } } /* FIXME: group_lower should be an overidable method ? */ - clutter_group_lower (CLUTTER_GROUP(clutter_actor_get_parent (self)), - self, - above); + clutter_group_lower (CLUTTER_GROUP (parent), self, above); } /** diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index f507453cc..a16e15897 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -119,8 +119,10 @@ struct _ClutterActorClass void (* set_depth) (ClutterActor *actor, gint depth); gint (* get_depth) (ClutterActor *actor); + void (* parent_set) (ClutterActor *actor, + ClutterActor *old_parent); - void (*destroy) (ClutterActor *actor); + void (* destroy) (ClutterActor *actor); /* to go ? */ void (* show_all) (ClutterActor *actor); diff --git a/clutter/clutter-version.h.in b/clutter/clutter-version.h.in new file mode 100644 index 000000000..90cdcca4a --- /dev/null +++ b/clutter/clutter-version.h.in @@ -0,0 +1,17 @@ +#ifndef __CLUTTER_VERSION_H__ +#define __CLUTTER_VERSION_H__ + +#define CLUTTER_MAJOR_VERSION @CLUTTER_MAJOR_VERSION@ +#define CLUTTER_MINOR_VERSION @CLUTTER_MINOR_VERSION@ +#define CLUTTER_MICRO_VERSION @CLUTTER_MICRO_VERSION@ + +#define CLUTTER_VERSION @CLUTTER_VERSION@ +#define CLUTTER_VERSION_S "@CLUTTER_VERSION@" +#define CLUTTER_VERSION_HEX 0x@CLUTTER_MAJOR_VERSION@0@CLUTTER_MINOR_VERSION@0@CLUTTER_MICRO_VERSION@ + +#define CLUTTER_CHECK_VERSION(major,minor,micro) \ + ((CLUTTER_MAJOR_VERSION > (major)) || \ + (CLUTTER_MAJOR_VERSION == (major) && CLUTTER_MINOR_VERSION > (minor)) || \ + (CLUTTER_MAJOR_VERSION == (major) && CLUTTER_MINOR_VERSION == (minor) || CLUTTER_MICRO_VERSION > (micro))) + +#endif /* __CLUTTER_VERSION_H__ */ diff --git a/clutter/clutter.h b/clutter/clutter.h index b0c636bfa..4f4a21d41 100644 --- a/clutter/clutter.h +++ b/clutter/clutter.h @@ -20,6 +20,8 @@ #include "clutter-label.h" #include "clutter-alpha.h" #include "clutter-media.h" +#include "clutter-feature.h" +#include "clutter-version.h" #include "clutter-enum-types.h" #endif diff --git a/configure.ac b/configure.ac index 27e157d3c..2c1b4afb8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,31 +1,49 @@ -AC_PREREQ(2.53) - # clutter package version number, (as distinct from shared library version) # An odd micro number indicates in-progress development, (eg. from CVS) # An even micro number indicates a released version. -m4_define(clutter_version_major, 0) -m4_define(clutter_version_minor, 1) -m4_define(clutter_version_micro, 1) +m4_define([clutter_major_version], [0]) +m4_define([clutter_minor_version], [1]) +m4_define([clutter_micro_version], [1]) + +m4_define([clutter_version], + [clutter_major_version.clutter_minor_version.clutter_micro_version]) + +m4_define([clutter_api_version], + [clutter_major_version.clutter_minor_version]) + +# increase the interface age for each release; if the API changes, set to 0 +m4_define([clutter_interface_age], [0]) +m4_define([clutter_binary_age], + [m4_eval(100 * clutter_minor_version + clutter_micro_version)]) + +AC_PREREQ(2.53) AC_INIT([clutter], - clutter_version_major.clutter_version_minor.clutter_version_micro, + [clutter_version], [http://bugzilla.o-hand.com/enter_bug.cgi?product=Clutter]) AC_CONFIG_SRCDIR([clutter/clutter.h]) AM_CONFIG_HEADER([config.h]) AM_INIT_AUTOMAKE([1.7]) -CLUTTER_MAJORMINOR=clutter_version_major.clutter_version_minor +CLUTTER_MAJOR_VERSION=clutter_major_version +CLUTTER_MINOR_VERSION=clutter_minor_version +CLUTTER_MICRO_VERSION=clutter_micro_version +CLUTTER_VERSION=clutter_version +CLUTTER_MAJORMINOR=clutter_api_version +AC_SUBST(CLUTTER_MAJOR_VERSION) +AC_SUBST(CLUTTER_MINOR_VERSION) +AC_SUBST(CLUTTER_MICRO_VERSION) +AC_SUBST(CLUTTER_VERSION) AC_SUBST(CLUTTER_MAJORMINOR) -# CURRENT, REVISION, AGE -# - library source changed -> increment REVISION -# - interfaces added/removed/changed -> increment CURRENT, REVISION = 0 -# - interfaces added -> increment AGE -# - interfaces removed -> AGE = 0 -CLUTTER_LT_CURRENT=1 -CLUTTER_LT_REV=0 -CLUTTER_LT_AGE=1 +m4_define([lt_current], + [m4_eval(100 * clutter_minor_version + clutter_micro_version - clutter_interface_age)]) +m4_define([lt_revision], [clutter_interface_age]) +m4_define([lt_age], [m4_eval(clutter_binary_age - clutter_interface_age)]) +CLUTTER_LT_CURRENT=lt_current +CLUTTER_LT_REV=lt_revision +CLUTTER_LT_AGE=lt_age CLUTTER_LT_VERSION="$CLUTTER_LT_CURRENT:$CLUTTER_LT_REV:$CLUTTER_LT_AGE" CLUTTER_LT_LDFLAGS="-version-info $CLUTTER_LT_VERSION" @@ -101,9 +119,36 @@ if test "x$GCC" = "xyes"; then GCC_FLAGS="-g -Wall" fi +dnl = Enable debug level =================================================== + +m4_define([debug_default], + m4_if(m4_eval(clutter_minor_version % 2), [1], [yes], [minimum])) + +AC_ARG_ENABLE(debug, + AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@], + [turn on debugging @<:@default=debug_default@:>@]), +, + enable_debug=debug_default) + +if test "x$enable_debug" = "xyes"; then + test "$cflags_set" = set || CFLAGS="$CFLAGS -g" + CLUTTER_DEBUG_CFLAGS="-DG_ENABLE_DEBUG" +else + if test "x$enable_debug" = "xno"; then + CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST +_CHECKS" + else + CLUTTER_DEBUG_CFLAGS="-DG_DISABLE_CAST_CHECKS" + fi +fi + +AC_SUBST(CLUTTER_DEBUG_CFLAGS) + dnl ======================================================================== -GTK_DOC_CHECK([1.0]) +dnl = GTK Doc check ======================================================== + +GTK_DOC_CHECK([1.4]) dnl ======================================================================== @@ -117,18 +162,22 @@ CLUTTER_LIBS="$GLX_LIBS $CLUTTER_DEPS_LIBS" AC_SUBST(CLUTTER_CFLAGS) AC_SUBST(CLUTTER_LIBS) -AC_OUTPUT([Makefile -clutter/pango/Makefile -clutter/Makefile -gtk/Makefile -gtk/gtk-clutter.pc -examples/Makefile -doc/Makefile -doc/reference/Makefile -doc/reference/version.xml -clutter.pc +AC_CONFIG_FILES([ + Makefile + clutter/pango/Makefile + clutter/Makefile + clutter/clutter-version.h + gtk/Makefile + gtk/gtk-clutter.pc + examples/Makefile + doc/Makefile + doc/reference/Makefile + doc/reference/version.xml + clutter.pc ]) +AC_OUTPUT + dnl ======================================================================== echo "" @@ -138,5 +187,6 @@ echo "" echo " prefix: ${prefix}" echo "" echo " GTK+ Widget: ${enable_gtk}" +echo " Debug level: ${enable_debug}" echo " Documentation: ${enable_gtk_doc}" echo "" diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index a408e41b5..49a714e03 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,16 @@ +2006-11-20 Emmanuele Bassi + + * clutter-sections.txt: Remove debug macros; add clutter-version + section. + + * Makefile.am: Ignore the stamp files. + + * clutter-docs.sgml: Add a link to the version utils. + + * tmpl/clutter-actor.sgml: + * tmpl/clutter-main.sgml: + * tmpl/clutter-version.sgml: Update templates. + 2006-11-17 Emmanuele Bassi * clutter-sections.txt: Move stuff around: get_type and Private diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am index d3fd96f61..a3070f8ad 100644 --- a/doc/reference/Makefile.am +++ b/doc/reference/Makefile.am @@ -53,6 +53,7 @@ IGNORE_HFILES=\ clutter-keysyms.h \ clutter-enum-types.h \ stamp-clutter-enum-types.h \ + stamp-clutter-marshal.h \ pango # Images to copy into HTML directory. diff --git a/doc/reference/clutter-docs.sgml b/doc/reference/clutter-docs.sgml index 13ad18845..cabd7c07f 100644 --- a/doc/reference/clutter-docs.sgml +++ b/doc/reference/clutter-docs.sgml @@ -91,6 +91,7 @@ + diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index a5eb372a6..654a95c58 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -477,10 +477,6 @@ clutter_keysym_to_unicode
clutter-main -CLUTTER_HAS_DEBUG_MESSGES -CLUTTER_DBG -CLUTTER_GLERR -CLUTTER_MARK ClutterInitError clutter_init clutter_main @@ -493,4 +489,20 @@ clutter_root_xwindow clutter_want_debug clutter_threads_enter clutter_threads_leave + +CLUTTER_HAS_DEBUG_MESSGES +CLUTTER_DBG +CLUTTER_GLERR +CLUTTER_MARK +
+ +
+clutter-version +CLUTTER_MAJOR_VERSION +CLUTTER_MINOR_VERSION +CLUTTER_MICRO_VERSION +CLUTTER_VERSION +CLUTTER_VERSION_S +CLUTTER_VERSION_HEX +CLUTTER_CHECK_VERSION
diff --git a/doc/reference/tmpl/clutter-actor.sgml b/doc/reference/tmpl/clutter-actor.sgml index f491d26c0..d49af3b3d 100644 --- a/doc/reference/tmpl/clutter-actor.sgml +++ b/doc/reference/tmpl/clutter-actor.sgml @@ -140,6 +140,14 @@ ClutterActor @clutteractor: the object which received the signal. + + + + + +@clutteractor: the object which received the signal. +@arg1: + @@ -162,6 +170,11 @@ ClutterActor + + + + + @@ -202,6 +215,7 @@ ClutterActor @allocate_coords: @set_depth: @get_depth: +@parent_set: @destroy: @show_all: @hide_all: diff --git a/doc/reference/tmpl/clutter-main.sgml b/doc/reference/tmpl/clutter-main.sgml index d242f9863..663ef4629 100644 --- a/doc/reference/tmpl/clutter-main.sgml +++ b/doc/reference/tmpl/clutter-main.sgml @@ -17,62 +17,6 @@ clutter-main - - - - - - - - - - - - -@x: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: -@a...: - - - - - - - - - - - - - - - - diff --git a/doc/reference/tmpl/clutter-version.sgml b/doc/reference/tmpl/clutter-version.sgml new file mode 100644 index 000000000..a6054e6ac --- /dev/null +++ b/doc/reference/tmpl/clutter-version.sgml @@ -0,0 +1,73 @@ + +clutter-version + + +Versioning utilities + + + +Clutter exports some macros representing the version at compile time. These +macros are useful for configure and compile time checks. + + + + + + + + + + + + +The major version component of Clutter version + + + + + + +The minor version component of Clutter version + + + + + + +The micro version component of Clutter version + + + + + + +The Clutter version + + + + + + +The Clutter version as a string + + + + + + +The Clutter version as a hexadecimal number + + + + + + +Returns TRUE if the version of the Clutter header files is the same as or newer +than the passed-in version. + + +@major: major version (e.g. 1, for 1.2.3) +@minor: minor version (e.g. 2, for 1.2.3) +@micro: micro version (e.g. 3, for 1.2.3) + +