diff --git a/ChangeLog b/ChangeLog index 4f1528cd7..42bd692d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-09-15 Matthew Allum + + More fixes from Bastien Nocera (#155): + + * clutter/clutter-main.c: (clutter_init): + * clutter/clutter-main.h: + Add an enum for clutter init to return an error code. + * configure.ac: + Dont check for XInitThreads, there is no need, its part of xlib. + 2006-09-14 Matthew Allum Various fixes from Bastien Nocera: diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index e611606c8..c603afe38 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -525,14 +525,14 @@ is_gl_version_at_least_12 (void) * * Return value: 1 on success, < 0 on failure. */ -int +ClutterInitError clutter_init (int *argc, char ***argv) { ClutterMainContext *context; static gboolean is_initialized = FALSE; if (is_initialized) - return 1; + return CLUTTER_INIT_SUCCESS; context = clutter_context_get_default (); @@ -547,7 +547,8 @@ clutter_init (int *argc, char ***argv) if (!g_thread_supported ()) g_thread_init (NULL); - XInitThreads(); + if (!XInitThreads()) + return CLUTTER_INIT_ERROR_THREADS; context->main_loops = NULL; context->main_loop_level = 0; @@ -555,7 +556,7 @@ clutter_init (int *argc, char ***argv) if ((context->xdpy = XOpenDisplay (g_getenv ("DISPLAY"))) == NULL) { g_critical ("Unable to connect to X DISPLAY."); - return -1; + return CLUTTER_INIT_ERROR_DISPLAY; } context->xscreen = DefaultScreen(context->xdpy); @@ -575,10 +576,12 @@ clutter_init (int *argc, char ***argv) clutter_actor_realize (CLUTTER_ACTOR (context->stage)); g_return_val_if_fail - (CLUTTER_ACTOR_IS_REALIZED(CLUTTER_ACTOR(context->stage)), -4); + (CLUTTER_ACTOR_IS_REALIZED(CLUTTER_ACTOR(context->stage)), + CLUTTER_INIT_ERROR_INTERNAL); /* At least GL 1.2 is needed for CLAMP_TO_EDGE */ - g_return_val_if_fail(is_gl_version_at_least_12 (), -5); + g_return_val_if_fail(is_gl_version_at_least_12 (), + CLUTTER_INIT_ERROR_OPENGL); /* Check available features */ clutter_feature_init (); diff --git a/clutter/clutter-main.h b/clutter/clutter-main.h index 41d6bdf5b..8cc7f6968 100644 --- a/clutter/clutter-main.h +++ b/clutter/clutter-main.h @@ -61,7 +61,16 @@ G_BEGIN_DECLS #define CLUTTER_MARK() CLUTTER_DBG("mark") -int +typedef enum { + CLUTTER_INIT_SUCCESS = 1, + CLUTTER_INIT_ERROR_UNKOWN = 0, + CLUTTER_INIT_ERROR_THREADS = -1, + CLUTTER_INIT_ERROR_DISPLAY = -2, + CLUTTER_INIT_ERROR_INTERNAL = -3, + CLUTTER_INIT_ERROR_OPENGL = -4 +} ClutterInitError; + +ClutterInitError clutter_init (int *argc, char ***argv); void diff --git a/configure.ac b/configure.ac index ba3db4bf3..583164d5c 100644 --- a/configure.ac +++ b/configure.ac @@ -66,25 +66,6 @@ then fi fi - -# FIXME: Needed ? -AC_MSG_CHECKING([for XTHREADS in Xlib]) - -AC_RUN_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[return XInitThreads() == 0 ? 0 : 1;]])], - [xthreads=no], - [xthreads=yes], - [xthreads=yes]) - -AC_MSG_RESULT($xthreads) - -if test "x$xthreads" = "xyes" -then - X11_LIBS="$X11_LIBS -lpthread" - AC_DEFINE([XTHREADS], [], [1]) -fi - AC_CHECK_HEADERS([GL/gl.h GL/glx.h],, [AC_MSG_ERROR([Unable to locate required GL headers])])