1
0
Fork 0

Allow checking initialization without side-effects

The _clutter_context_get_default() function will automatically
create the main Clutter context; if we just want to check whether
Clutter has been initialized this will complicate matters, by
requiring a call to g_type_init() inside the client code.

Instead, we should simply provide an internal API that checks
whether the main Clutter context exists and if it has been
initialized, without any side effect.
This commit is contained in:
Emmanuele Bassi 2009-06-19 14:09:42 +01:00
parent 184df2a5fa
commit b5f4befeaa
2 changed files with 12 additions and 2 deletions

View file

@ -1052,10 +1052,19 @@ clutter_get_debug_enabled (void)
#endif
}
gboolean
_clutter_context_is_initialized (void)
{
if (ClutterCntx == NULL)
return FALSE;
return ClutterCntx->is_initialized;
}
ClutterMainContext *
_clutter_context_get_default (void)
{
if (G_UNLIKELY(!ClutterCntx))
if (G_UNLIKELY (ClutterCntx == NULL))
{
ClutterMainContext *ctx;

View file

@ -138,6 +138,7 @@ struct _ClutterMainContext
#define CLUTTER_CONTEXT() (_clutter_context_get_default ())
ClutterMainContext *_clutter_context_get_default (void);
gboolean _clutter_context_is_initialized (void);
PangoContext *_clutter_context_create_pango_context (ClutterMainContext *self);
PangoContext *_clutter_context_get_pango_context (ClutterMainContext *self);