[x11] Use _clutter_context_is_initialized()

Instead of using _clutter_context_get_default() and checking the
is_initialized flag, we should use the newly added private function
that does not cause side effects, especially for functions that have
to be called before any other Clutter function.
This commit is contained in:
Emmanuele Bassi 2009-06-19 14:12:36 +01:00
parent b5f4befeaa
commit b6e404a406

View File

@ -442,12 +442,10 @@ clutter_x11_get_default_display (void)
void void
clutter_x11_set_display (Display *xdpy) clutter_x11_set_display (Display *xdpy)
{ {
ClutterMainContext *ctx = _clutter_context_get_default (); if (_clutter_context_is_initialized ())
if (ctx->is_initialized)
{ {
g_critical ("Display connection already exists. You can only call " g_critical ("Display connection already exists. You can only call "
"clutter_x11_set_display() once before clutter_init()\n"); "clutter_x11_set_display() before clutter_init()");
return; return;
} }
@ -469,12 +467,10 @@ clutter_x11_set_display (Display *xdpy)
void void
clutter_x11_enable_xinput () clutter_x11_enable_xinput ()
{ {
ClutterMainContext *ctx = _clutter_context_get_default (); if (_clutter_context_is_initialized ())
if (ctx->is_initialized)
{ {
g_warning ("clutter_x11_enable_xinput should " g_critical ("clutter_x11_enable_xinput() can only be called "
"be called before clutter_init"); "before clutter_init()");
return; return;
} }
@ -494,12 +490,10 @@ clutter_x11_enable_xinput ()
void void
clutter_x11_disable_event_retrieval (void) clutter_x11_disable_event_retrieval (void)
{ {
ClutterMainContext *ctx = _clutter_context_get_default (); if (_clutter_context_is_initialized ())
if (ctx->is_initialized)
{ {
g_warning ("clutter_x11_disable_event_retrieval should " g_warning ("clutter_x11_disable_event_retrieval() can only be "
"be called before clutter_init"); "called before clutter_init()");
return; return;
} }