2007-03-22 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-private.h: Remove inclusion of backend-specific
	headers; update the main context object; add the declarations for
	the event queue functions.

	* clutter/clutter-backend.[ch]: Add the abstract ClutterBackend
	object, which holds backend-specific settings, the main stage,
	and the event queue. Every backend must implement a subclass of
	ClutterBackend and ClutterStage.

	* clutter/clutter-feature.c: Protect the GLX specific calls
	behing #ifdef HAVE_CLUTTER_GLX.

	* clutter/clutter-actor.c:
	* clutter/clutter-group.c:
	* clutter/clutter-clone-texture.c: Include GL/gl.h

	* clutter/clutter-event.[ch]: Update public API and implement the
	event queue private API; hold a reference on the event objects;
	move out the keysym-to-unicode table; add the new event types.

	* clutter/clutter-color.h: Include clutter-fixed.h

	* clutter/clutter-main.c: Update API; get the main stage
	from the backend object; process the event received from the
	queue; lock/unlock the main mutex if we have one; move the
	initialisation process sooner in the init sequence, in order to
	have the backend object when we check for options; call the
	backed vfuncs in the pre/post parse hooks.

	* clutter/clutter-stage.c: Make ClutterStage and abstract class,
	implemented by the backends.

	* clutter/clutter/glx/clutter-glx.h:
	* clutter/clutter/glx/clutter-backend-glx.[ch]:
	* clutter/clutter/glx/clutter-event-glx.c:
	* clutter/clutter/glx/clutter-stage-glx.[ch]:
	* clutter/clutter/glx/Makefile.am: Add the GLX backend.

	* clutter/clutter/egl/clutter-backend-egl.[ch]:
	* clutter/clutter/egl/clutter-event-egl.c:
	* clutter/clutter/egl/clutter-stage-egl.[ch]:
	* clutter/clutter/egl/Makefile.am: Add the stub for a EGL backend.

	* examples/*.c: Update for the new API.
This commit is contained in:
Emmanuele Bassi
2007-03-22 18:21:59 +00:00
parent 15970bba9b
commit 4bd3fa583e
46 changed files with 4361 additions and 2851 deletions

View File

@ -50,6 +50,10 @@
#include "clutter-private.h"
#include "clutter-debug.h"
#ifdef HAVE_CLUTTER_GLX
#include "glx/clutter-glx.h"
#endif
typedef void (*FuncPtr) (void);
typedef int (*GLXGetVideoSyncProc) (unsigned int *count);
typedef int (*GLXWaitVideoSyncProc) (int divisor,
@ -199,10 +203,7 @@ check_vblank_env (const char *name)
{
const char *val;
#if 0
val = getenv("CLUTTER_VBLANK");
#endif
val = clutter_vblank_method ();
val = clutter_get_vblank_method ();
if (val && !strcasecmp(val, name))
return TRUE;
@ -245,35 +246,42 @@ clutter_feature_init (void)
CLUTTER_NOTE (MISC, "allocating features data");
__features = g_new0 (ClutterFeatures, 1);
memset(&__features->funcs, 0, sizeof(ClutterFeatureFuncs));
memset(&__features->funcs, 0, sizeof (ClutterFeatureFuncs));
__features->features_set = FALSE; /* don't rely on zero-ing */
}
if (!clutter_glx_display ())
#ifdef HAVE_CLUTTER_GLX
if (!clutter_glx_get_default_display ())
return;
#endif
if (__features->features_set)
return;
#ifdef HAVE_CLUTTER_GLX
gl_extensions = (const gchar*) glGetString (GL_EXTENSIONS);
glx_extensions = glXQueryExtensionsString (clutter_glx_display (),
clutter_glx_screen ());
glx_extensions = glXQueryExtensionsString (clutter_glx_get_default_display (),
clutter_glx_get_default_screen ());
if (check_gl_extension ("GL_ARB_texture_rectangle", gl_extensions)
|| check_gl_extension ("GL_EXT_texture_rectangle", gl_extensions))
__features->flags |= CLUTTER_FEATURE_TEXTURE_RECTANGLE;
if (check_gl_extension ("GL_ARB_texture_rectangle", gl_extensions) ||
check_gl_extension ("GL_EXT_texture_rectangle", gl_extensions))
{
__features->flags |= CLUTTER_FEATURE_TEXTURE_RECTANGLE;
}
#endif
/* vblank */
__features->vblank_type = CLUTTER_VBLANK_NONE;
if (getenv("__GL_SYNC_TO_VBLANK") || check_vblank_env("none"))
if (getenv("__GL_SYNC_TO_VBLANK") || check_vblank_env ("none"))
{
CLUTTER_NOTE (MISC, "vblank sync: disabled at user request");
}
else
{
if (!check_vblank_env("dri") &&
#ifdef HAVE_CLUTTER_GLX
if (!check_vblank_env ("dri") &&
check_gl_extension ("GLX_SGI_video_sync", glx_extensions))
{
__features->funcs.get_video_sync =
@ -291,7 +299,8 @@ clutter_feature_init (void)
__features->flags |= CLUTTER_FEATURE_SYNC_TO_VBLANK;
}
}
#endif
if (!(__features->flags & CLUTTER_FEATURE_SYNC_TO_VBLANK))
{
__features->dri_fd = open("/dev/dri/card0", O_RDWR);