From 4e765d1a34d9f1098d404c2cdbeb4f2ba27048f2 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 16 Jan 2007 14:37:54 +0000 Subject: [PATCH] 2007-01-16 Emmanuele Bassi * clutter/clutter-feature.c: Use clutter_vblank_method() to get the VBlank method name from the environment variable OR the command line switch. (clutter_feature_do_init): Move the check on the features state here, to avoid an expensive function call, and inline the function. * clutter/clutter-fixed.c: Fix gtk-doc. * clutter/clutter-main.c: Add a --clutter-vblank command line switch controlling the VBlank method to be used: it overrides the CLUTTER_VBLANK environment variable. (pre_parse_hook), (clutter_init), (clutter_init_with_args): Move thread initialisation before type init, to avoid the warning that comes with newer GLib versions. * clutter/clutter-group.h: * clutter/clutter-group.c: Mark clutter_group_show_all() and clutter_group_hide_all() as deprecated. --- ChangeLog | 25 ++++ NEWS | 1 + clutter/clutter-color.c | 3 + clutter/clutter-feature.c | 15 ++- clutter/clutter-fixed.c | 1 + clutter/clutter-fixed.h | 2 +- clutter/clutter-group.c | 26 ++-- clutter/clutter-group.h | 3 + clutter/clutter-main.c | 40 +++++- clutter/clutter-private.h | 1 + doc/reference/ChangeLog | 6 + doc/reference/clutter-sections.txt | 26 ++++ doc/reference/tmpl/clutter-actor.sgml | 18 +++ doc/reference/tmpl/clutter-behaviour.sgml | 19 +++ doc/reference/tmpl/clutter-color.sgml | 10 ++ doc/reference/tmpl/clutter-fixed.sgml | 141 ++++++++++++++++++++++ doc/reference/tmpl/clutter-label.sgml | 11 ++ 17 files changed, 323 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 55e310219..b6ebed5d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2007-01-16 Emmanuele Bassi + + * clutter/clutter-feature.c: Use clutter_vblank_method() to + get the VBlank method name from the environment variable OR + the command line switch. + + (clutter_feature_do_init): Move the check on the features + state here, to avoid an expensive function call, and inline + the function. + + * clutter/clutter-fixed.c: Fix gtk-doc. + + * clutter/clutter-main.c: Add a --clutter-vblank command line + switch controlling the VBlank method to be used: it overrides + the CLUTTER_VBLANK environment variable. + + (pre_parse_hook), (clutter_init), + (clutter_init_with_args): Move thread initialisation before + type init, to avoid the warning that comes with newer GLib + versions. + + * clutter/clutter-group.h: + * clutter/clutter-group.c: Mark clutter_group_show_all() and + clutter_group_hide_all() as deprecated. + 2007-01-16 Matthew Allum * NEWS: diff --git a/NEWS b/NEWS index 05cb83ebf..21839da12 100644 --- a/NEWS +++ b/NEWS @@ -28,6 +28,7 @@ Clutter 0.2 () o Redo Clutter Label widget, using the new Pango renderer. o Clutter Textures do not store local pixbuf copy (of texture). o Redo group and actor scale/sizing API and functionality. + o Add memory management API for ClutterColor, and string parsing. * List of bug fixed o #156 - clutter_actor_set_position not using the absolute size o #155 - Don't test for XInitThreads [Bastien Nocera] diff --git a/clutter/clutter-color.c b/clutter/clutter-color.c index 005691879..144542149 100644 --- a/clutter/clutter-color.c +++ b/clutter/clutter-color.c @@ -445,6 +445,9 @@ clutter_color_parse (const gchar *color, * hex digits representing the red, green, blue and alpha components * respectively. * + * Note: the returned string cannot be used to get the color back with + * clutter_color_parse(). + * * Return value: a newly-allocated text string * * Since: 0.2 diff --git a/clutter/clutter-feature.c b/clutter/clutter-feature.c index 2390d1559..dae3ce73d 100644 --- a/clutter/clutter-feature.c +++ b/clutter/clutter-feature.c @@ -196,7 +196,10 @@ check_vblank_env (const char *name) { const char *val; +#if 0 val = getenv("CLUTTER_VBLANK"); +#endif + val = clutter_vblank_method (); if (val && !strcasecmp(val, name)) return TRUE; @@ -310,12 +313,16 @@ clutter_feature_init (void) __features->features_set = TRUE; } -static void +static inline void clutter_feature_do_init (void) { - G_LOCK (__features); - clutter_feature_init (); - G_UNLOCK (__features); + if (G_UNLIKELY (__features == NULL) || + G_UNLIKELY (__features->features_set == FALSE)) + { + G_LOCK (__features); + clutter_feature_init (); + G_UNLOCK (__features); + } } /** diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c index 02c723658..253a17308 100644 --- a/clutter/clutter-fixed.c +++ b/clutter/clutter-fixed.c @@ -89,6 +89,7 @@ static ClutterFixed sin_tbl [] = * @angle: a #ClutterFixed angle in radians * * Fixed point implementation of sine function + * * Return value: sine value (as fixed point). * * Since: 0.2 diff --git a/clutter/clutter-fixed.h b/clutter/clutter-fixed.h index 565cde51c..a982ddfbe 100644 --- a/clutter/clutter-fixed.h +++ b/clutter/clutter-fixed.h @@ -84,7 +84,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ #define CFX_DIV CLUTTER_FIXED_DIV /* Fixed point math routines */ -ClutterFixed clutter_fixed_sin (ClutterFixed anx); +ClutterFixed clutter_fixed_sin (ClutterFixed angle); ClutterFixed clutter_angle_sin (ClutterAngle angle); /* convenience macros for the cos functions */ diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index 9f0fcfe6a..4208ff487 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -281,7 +281,7 @@ clutter_group_get_n_children (ClutterGroup *self) * * Since: 0.2 **/ -ClutterActor* +ClutterActor * clutter_group_get_nth_child (ClutterGroup *self, gint index) { @@ -326,40 +326,32 @@ clutter_group_foreach (ClutterGroup *self, * clutter_group_show_all: * @self: A #ClutterGroup * - * Show all child actors of the group. - * Note, does not recurse: use clutter_actor_show_all() for - * a recursive show. + * Show all child actors of the group, like clutter_actor_show_all(). + * + * @Deprecated: Use clutter_actor_show_all() instead. */ void clutter_group_show_all (ClutterGroup *self) { g_return_if_fail (CLUTTER_IS_GROUP (self)); - clutter_actor_show (CLUTTER_ACTOR (self)); - - g_list_foreach (self->priv->children, - (GFunc) clutter_actor_show, - NULL); + clutter_actor_show_all (CLUTTER_ACTOR (self)); } /** * clutter_group_hide_all: * @self: A #ClutterGroup * - * Hide all child actors of the group. - * Note, does not recurse: use clutter_actor_hide_all() for - * a recursive hide. + * Hide all child actors of the group, like clutter_actor_hide_all(). + * + * @Deprecated: Use clutter_actor_hide_all() instead */ void clutter_group_hide_all (ClutterGroup *self) { g_return_if_fail (CLUTTER_IS_GROUP (self)); - clutter_actor_hide(CLUTTER_ACTOR(self)); - - g_list_foreach (self->priv->children, - (GFunc) clutter_actor_hide, - NULL); + clutter_actor_hide_all (CLUTTER_ACTOR (self)); } /** diff --git a/clutter/clutter-group.h b/clutter/clutter-group.h index bda2f70ad..24a448e66 100644 --- a/clutter/clutter-group.h +++ b/clutter/clutter-group.h @@ -100,8 +100,11 @@ void clutter_group_add_many (ClutterGroup *self, ...) G_GNUC_NULL_TERMINATED; void clutter_group_remove (ClutterGroup *self, ClutterActor *actor); +#ifndef CLUTTER_DISABLE_DEPRECATED void clutter_group_show_all (ClutterGroup *self); void clutter_group_hide_all (ClutterGroup *self); +#endif /* CLUTTER_DISABLE_DEPRECATED */ + ClutterActor *clutter_group_find_child_by_id (ClutterGroup *self, guint id); void clutter_group_raise (ClutterGroup *self, diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index df26b152b..7921ecb05 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -47,6 +47,7 @@ static gboolean clutter_is_initialized = FALSE; static gboolean clutter_show_fps = FALSE; static gboolean clutter_fatal_warnings = FALSE; static gchar *clutter_display_name = NULL; +static gchar *clutter_vblank_name = NULL; static int clutter_screen = 0; guint clutter_debug_flags = 0; /* global clutter debug flag */ @@ -274,6 +275,12 @@ clutter_want_fps (void) return clutter_show_fps; } +const gchar * +clutter_vblank_method (void) +{ + return clutter_vblank_name; +} + /** * clutter_redraw: * @@ -571,6 +578,8 @@ static GOptionEntry clutter_args[] = { "X screen to use", "SCREEN" }, { "clutter-show-fps", 0, 0, G_OPTION_ARG_NONE, &clutter_show_fps, "Show frames per second", NULL }, + { "clutter-vblank", 0, 0, G_OPTION_ARG_STRING, &clutter_vblank_name, + "VBlank method to be used (none, dri or glx)", "METHOD" }, { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &clutter_fatal_warnings, "Make all warnings fatal", NULL }, #ifdef CLUTTER_ENABLE_DEBUG @@ -597,10 +606,19 @@ pre_parse_hook (GOptionContext *context, if (clutter_is_initialized) return TRUE; - g_type_init (); - +#if 0 + /* XXX - this shows a warning with newer releases of GLib, + * as we use GOption in order to get here, and GOption uses + * the slice allocator and other GLib stuff. so, either we + * move the thread init inside clutter_init() directly or + * we remove this call altogether, and let the applications + * deal with threading, as they are supposed to do anyway. + */ if (!g_thread_supported ()) g_thread_init (NULL); +#endif + + g_type_init (); #ifdef CLUTTER_ENABLE_DEBUG env_string = g_getenv ("CLUTTER_DEBUG"); @@ -614,13 +632,23 @@ pre_parse_hook (GOptionContext *context, } #endif /* CLUTTER_ENABLE_DEBUG */ + env_string = g_getenv ("CLUTTER_VBLANK"); + if (env_string) + { + clutter_vblank_name = g_strdup (env_string); + env_string = NULL; + } + env_string = g_getenv ("CLUTTER_SHOW_FPS"); if (env_string) clutter_show_fps = TRUE; env_string = g_getenv ("DISPLAY"); if (env_string) - clutter_display_name = g_strdup (env_string); + { + clutter_display_name = g_strdup (env_string); + env_string = NULL; + } return TRUE; } @@ -824,6 +852,9 @@ clutter_init_with_args (int *argc, if (clutter_is_initialized) return CLUTTER_INIT_SUCCESS; + if (!g_thread_supported ()) + g_thread_init (NULL); + if (!XInitThreads()) { g_set_error (error, clutter_init_error_quark (), @@ -903,6 +934,9 @@ clutter_init (int *argc, if (clutter_is_initialized) return CLUTTER_INIT_SUCCESS; + if (!g_thread_supported ()) + g_thread_init (NULL); + if (!XInitThreads()) return CLUTTER_INIT_ERROR_THREADS; diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index b38ed6fb2..681a72c9c 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -70,6 +70,7 @@ struct _ClutterMainContext #define CLUTTER_CONTEXT() (clutter_context_get_default ()) ClutterMainContext *clutter_context_get_default (void); +const gchar *clutter_vblank_method (void); typedef enum { CLUTTER_ACTOR_UNUSED_FLAG = 0, diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog index cb988583f..5ba0da8e0 100644 --- a/doc/reference/ChangeLog +++ b/doc/reference/ChangeLog @@ -1,3 +1,9 @@ +2007-01-16 Emmanuele Bassi + + * clutter-sections.txt: Update. + + * tmpl/*.sgml: Update templates. + 2006-12-13 Emmanuele Bassi * clutter-sections.txt: Update; add clutter_color_equal(). diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index 8d1aa39d5..c0ee78133 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -30,6 +30,7 @@ ClutterLabel ClutterLabelClass clutter_label_new clutter_label_new_with_text +clutter_label_new_full clutter_label_set_text clutter_label_get_text clutter_label_set_font_name @@ -71,6 +72,8 @@ clutter_behaviour_remove ClutterBehaviourForeachFunc clutter_behaviour_actors_foreach clutter_behaviour_get_actors +clutter_behaviour_get_n_actors +clutter_behaviour_get_nth_actor clutter_behaviour_get_alpha clutter_behaviour_set_alpha @@ -226,7 +229,9 @@ clutter_actor_set_size clutter_actor_get_size clutter_actor_set_position clutter_actor_get_abs_position +clutter_actor_set_width clutter_actor_get_width +clutter_actor_set_height clutter_actor_get_height clutter_actor_get_x clutter_actor_get_y @@ -451,6 +456,21 @@ CFX_Q CFX_ONE CFX_MAX CFX_MIN +ClutterAngle +CFX_PI +CFX_2PI +CFX_PI_2 +CFX_PI_4 +CFX_PI8192 +CFX_120 +CFX_180 +CFX_240 +CFX_360 +CFX_60 +CFX_DIV +CFX_INT +CFX_MUL +clutter_color_shadex CLUTTER_FIXED_TO_FLOAT CLUTTER_FIXED_TO_DOUBLE CLUTTER_FLOAT_TO_FIXED @@ -461,6 +481,10 @@ CLUTTER_FIXED_FLOOR CLUTTER_FIXED_CEIL CLUTTER_FIXED_MUL CLUTTER_FIXED_DIV +clutter_fixed_cos +clutter_fixed_sin +clutter_angle_cos +clutter_angle_sin
@@ -477,6 +501,7 @@ clutter_color_equal clutter_color_lighten clutter_color_darken clutter_color_shade +clutter_color_shadex clutter_color_to_hls clutter_color_to_pixel clutter_color_to_string @@ -531,6 +556,7 @@ clutter_root_xwindow clutter_want_debug clutter_threads_enter clutter_threads_leave +clutter_vblank_method clutter_init_error_quark
diff --git a/doc/reference/tmpl/clutter-actor.sgml b/doc/reference/tmpl/clutter-actor.sgml index 481873b2d..310730ef5 100644 --- a/doc/reference/tmpl/clutter-actor.sgml +++ b/doc/reference/tmpl/clutter-actor.sgml @@ -375,6 +375,15 @@ Base class for #ClutterActor @y: + + + + + +@self: +@width: + + @@ -384,6 +393,15 @@ Base class for #ClutterActor @Returns: + + + + + +@self: +@height: + + diff --git a/doc/reference/tmpl/clutter-behaviour.sgml b/doc/reference/tmpl/clutter-behaviour.sgml index a03532d94..adf604c89 100644 --- a/doc/reference/tmpl/clutter-behaviour.sgml +++ b/doc/reference/tmpl/clutter-behaviour.sgml @@ -94,6 +94,25 @@ applies. @Returns: + + + + + +@behave: +@Returns: + + + + + + + +@behave: +@num: +@Returns: + + diff --git a/doc/reference/tmpl/clutter-color.sgml b/doc/reference/tmpl/clutter-color.sgml index fce712946..70ad0f84c 100644 --- a/doc/reference/tmpl/clutter-color.sgml +++ b/doc/reference/tmpl/clutter-color.sgml @@ -132,6 +132,16 @@ clutter-color @shade: + + + + + +@src: +@dest: +@shade: + + diff --git a/doc/reference/tmpl/clutter-fixed.sgml b/doc/reference/tmpl/clutter-fixed.sgml index d0e22cc82..36e26301c 100644 --- a/doc/reference/tmpl/clutter-fixed.sgml +++ b/doc/reference/tmpl/clutter-fixed.sgml @@ -55,6 +55,113 @@ floating-to-fixed conversion. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +@src: +@dest: +@shade: + + @@ -137,3 +244,37 @@ floating-to-fixed conversion. @y: + + + + + +@x: + + + + + + + +@angle: +@Returns: + + + + + + + +@x: + + + + + + + +@angle: +@Returns: + + diff --git a/doc/reference/tmpl/clutter-label.sgml b/doc/reference/tmpl/clutter-label.sgml index 42cab5d21..23a7bce4e 100644 --- a/doc/reference/tmpl/clutter-label.sgml +++ b/doc/reference/tmpl/clutter-label.sgml @@ -92,6 +92,17 @@ ClutterLabel @Returns: + + + + + +@font_name: +@text: +@color: +@Returns: + +