+2006-07-27 Emmanuele Bassi <ebassi@openedhand.com>
+
+ * clutter/clutter-private.h: Move clutter_feature_init()
+ declaration here: you shouldn't even need to initialise
+ features yourself.
+
+ * clutter/clutter-feature.c: call clutter_feature_init()
+ each time you try to access the feature list; add a static
+ lock around the feature flags container; add api documentation.
+
+ * clutter/clutter-feature.h: Add a type for the feature flags
+ to make bindings happy.
+
2006-07-24 Matthew Allum <mallum@openedhand.com>
* clutter/Makefile.am:
#include "clutter-feature.h"
#include "string.h"
-static gulong __features;
+G_LOCK_DEFINE_STATIC (__features);
+static ClutterFeatureFlags __features;
/* Note must be called after context created */
static gboolean
return FALSE;
}
-gboolean
-clutter_feature_available (gulong query)
-{
- return (__features & query);
-}
-
-gulong
-clutter_feature_all (void)
-{
- return __features;
-}
-
-void
-clutter_feature_init (void)
+/* HOLDS: __features lock */
+static void
+clutter_feature_init_do (void)
{
if (__features)
return;
if (check_gl_extension ("GL_ARB_texture_rectangle"))
__features |= CLUTTER_FEATURE_TEXTURE_RECTANGLE;
+}
+
+void
+clutter_feature_init (void)
+{
+ G_LOCK (__features);
+ clutter_feature_init_do ();
+ G_UNLOCK (__features);
+}
+/**
+ * clutter_feature_available:
+ * @feature: a #ClutterFeatureFlags
+ *
+ * Checks whether @feature is available. @feature can be a logical
+ * OR of #ClutterFeatureFlags.
+ *
+ * Return value: %TRUE if a feature is available
+ *
+ * Since: 0.1.1
+ */
+gboolean
+clutter_feature_available (ClutterFeatureFlags feature)
+{
+ clutter_feature_init ();
+ return (__features & feature);
+}
+
+/**
+ * clutter_feature_all:
+ *
+ * Returns all the suppoerted features.
+ *
+ * Return value: a logical OR of all the supported features.
+ *
+ * Since: 0.1.1
+ */
+ClutterFeatureFlags
+clutter_feature_all (void)
+{
+ clutter_feature_init ();
+ return __features;
}
G_END_DECLS
-enum
+typedef enum
{
CLUTTER_FEATURE_TEXTURE_RECTANGLE = (1 << 1)
-};
+} ClutterFeatureFlags;
-gboolean
-clutter_feature_available (gulong query);
-
-gulong
-clutter_feature_get_all (void);
-
-void
-clutter_feature_init (void);
+gboolean clutter_feature_available (ClutterFeatureFlags flags);
+ClutterFeatureFlags clutter_feature_get_all (void);
G_END_DECLS