2006-09-15 Matthew Allum <mallum@openedhand.com>

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.
This commit is contained in:
Matthew Allum 2006-09-15 12:30:15 +00:00
parent 164367e547
commit 55c723b9a2
4 changed files with 29 additions and 26 deletions

View File

@ -1,3 +1,13 @@
2006-09-15 Matthew Allum <mallum@openedhand.com>
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 <mallum@openedhand.com>
Various fixes from Bastien Nocera:

View File

@ -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 ();

View File

@ -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

View File

@ -66,25 +66,6 @@ then
fi
fi
# FIXME: Needed ?
AC_MSG_CHECKING([for XTHREADS in Xlib])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
[[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])])