2008-03-31 Matthew Allum <mallum@openedhand.com>

* README:
        Add notes on new multistage feature.

        * clutter/clutter-stage-manager.c:
        Dont ref contained stages.

        * clutter/clutter-stage.c:
        Automatically remove stage from stage manager on finalisation.
        Cleans up warnings when a stage is destroyed.

        * clutter/clutter-backend.h:
        * clutter/glx/clutter-backend-glx.c:
        Minor formatting cleanups.

        * clutter/glx/clutter-stage-glx.c:
        * configure.ac:
        * clutter/clutter-version.h.in:
        Add a general CLUTTER_STAGE_TYPE define, should be useful for
        evntual stage subclassing and creating with g_object_new()
This commit is contained in:
Matthew Allum 2008-03-31 17:15:02 +00:00
parent e88c8b4ce1
commit 244eedb5bd
9 changed files with 78 additions and 5 deletions

View File

@ -1,3 +1,25 @@
2008-03-31 Matthew Allum <mallum@openedhand.com>
* README:
Add notes on new multistage feature.
* clutter/clutter-stage-manager.c:
Dont ref contained stages.
* clutter/clutter-stage.c:
Automatically remove stage from stage manager on finalisation.
Cleans up warnings when a stage is destroyed.
* clutter/clutter-backend.h:
* clutter/glx/clutter-backend-glx.c:
Minor formatting cleanups.
* clutter/glx/clutter-stage-glx.c:
* configure.ac:
* clutter/clutter-version.h.in:
Add a general CLUTTER_STAGE_TYPE define, should be useful for
evntual stage subclassing and creating with g_object_new()
2008-03-30 Neil Roberts <neil@o-hand.com> 2008-03-30 Neil Roberts <neil@o-hand.com>
* clutter/win32/clutter-backend-win32.c * clutter/win32/clutter-backend-win32.c

5
README
View File

@ -145,6 +145,11 @@ wanting to port to newer releases (See NEWS for general new feature info).
Release Notes for Clutter 0.8 Release Notes for Clutter 0.8
------------------------------- -------------------------------
* Clutter now features support for multiple stages assuming supported by the
backend. See test-multistage.c for example of usage. This does not change
the automatic creation of the default stage.
* There is now an experimental native Win32 WGL backend. * There is now an experimental native Win32 WGL backend.
* Some more focused timeline unit tests have been added and some tweaks to * Some more focused timeline unit tests have been added and some tweaks to

View File

@ -245,7 +245,12 @@ _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager,
return; return;
} }
g_object_ref_sink (stage); /* Refing currently disabled as
* - adding/removing internal to clutter and only stage does this
* - stage removes from manager in finalize (and how can it with ref)
* - Maybe a safer way
* g_object_ref_sink (stage);
*/
stage_manager->stages = g_slist_append (stage_manager->stages, stage); stage_manager->stages = g_slist_append (stage_manager->stages, stage);
if (!default_stage) if (!default_stage)
@ -278,5 +283,5 @@ _clutter_stage_manager_remove_stage (ClutterStageManager *stage_manager,
g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage); g_signal_emit (stage_manager, manager_signals[STAGE_REMOVED], 0, stage);
g_object_unref (stage); /* g_object_unref (stage); */
} }

View File

@ -245,6 +245,25 @@ clutter_stage_get_property (GObject *object,
} }
} }
static void
clutter_stage_dispose (GObject *object)
{
G_OBJECT_CLASS (clutter_stage_parent_class)->dispose (object);
}
static void
clutter_stage_finalize (GObject *object)
{
ClutterStage *stage = CLUTTER_STAGE(object);
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
_clutter_stage_manager_remove_stage (stage_manager, stage);
G_OBJECT_CLASS (clutter_stage_parent_class)->finalize (object);
}
static void static void
clutter_stage_class_init (ClutterStageClass *klass) clutter_stage_class_init (ClutterStageClass *klass)
{ {
@ -253,6 +272,8 @@ clutter_stage_class_init (ClutterStageClass *klass)
gobject_class->set_property = clutter_stage_set_property; gobject_class->set_property = clutter_stage_set_property;
gobject_class->get_property = clutter_stage_get_property; gobject_class->get_property = clutter_stage_get_property;
gobject_class->dispose = clutter_stage_dispose;
gobject_class->finalize = clutter_stage_finalize;
actor_class->paint = clutter_stage_paint; actor_class->paint = clutter_stage_paint;
actor_class->pick = clutter_stage_pick; actor_class->pick = clutter_stage_pick;

View File

@ -112,6 +112,15 @@
*/ */
#define CLUTTER_COGL "@CLUTTER_COGL@" #define CLUTTER_COGL "@CLUTTER_COGL@"
/**
* CLUTTER_STAGE_TYPE:
*
* The default GObject type for the Clutter stage.
*
* Since 0.8
*/
#define CLUTTER_STAGE_TYPE @CLUTTER_STAGE_TYPE@
/** /**
* CLUTTER_NO_FPU: * CLUTTER_NO_FPU:
* *
@ -122,4 +131,5 @@
*/ */
#define CLUTTER_NO_FPU CLUTTER_NO_FPU_MACRO_WAS_REMOVED #define CLUTTER_NO_FPU CLUTTER_NO_FPU_MACRO_WAS_REMOVED
#endif /* __CLUTTER_VERSION_H__ */ #endif /* __CLUTTER_VERSION_H__ */

View File

@ -45,6 +45,7 @@
#include "../clutter-main.h" #include "../clutter-main.h"
#include "../clutter-debug.h" #include "../clutter-debug.h"
#include "../clutter-private.h" #include "../clutter-private.h"
#include "../clutter-version.h"
#include "cogl.h" #include "cogl.h"
@ -388,7 +389,7 @@ clutter_backend_glx_redraw (ClutterBackend *backend, ClutterStage *stage)
} }
} }
ClutterActor* static ClutterActor*
clutter_backend_glx_create_stage (ClutterBackend *backend, clutter_backend_glx_create_stage (ClutterBackend *backend,
GError **error) GError **error)
{ {
@ -396,7 +397,7 @@ clutter_backend_glx_create_stage (ClutterBackend *backend,
ClutterStageX11 *stage_x11; ClutterStageX11 *stage_x11;
ClutterActor *stage; ClutterActor *stage;
stage = g_object_new (CLUTTER_TYPE_STAGE_GLX, NULL); stage = g_object_new (CLUTTER_STAGE_TYPE, NULL);
/* copy backend data into the stage */ /* copy backend data into the stage */
stage_x11 = CLUTTER_STAGE_X11 (stage); stage_x11 = CLUTTER_STAGE_X11 (stage);

View File

@ -56,6 +56,8 @@ clutter_stage_glx_unrealize (ClutterActor *actor)
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (actor); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (actor);
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor); ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor);
/* Note unrealize should free up any backend stage related resources */
gboolean was_offscreen; gboolean was_offscreen;
CLUTTER_MARK(); CLUTTER_MARK();

View File

@ -121,6 +121,7 @@ case $clutterbackend in
clutter_gl_header="GL/gl.h" clutter_gl_header="GL/gl.h"
CLUTTER_FLAVOUR="sdl" CLUTTER_FLAVOUR="sdl"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_SDL"
AC_DEFINE([HAVE_CLUTTER_SDL], 1, [Have the SDL backend]) AC_DEFINE([HAVE_CLUTTER_SDL], 1, [Have the SDL backend])
CLUTTER_COGL="gl" CLUTTER_COGL="gl"
@ -162,6 +163,7 @@ case $clutterbackend in
clutter_gl_header="GL/gl.h" clutter_gl_header="GL/gl.h"
CLUTTER_FLAVOUR="glx" CLUTTER_FLAVOUR="glx"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX"
AC_DEFINE([HAVE_CLUTTER_GLX], 1, [Have the GLX backend]) AC_DEFINE([HAVE_CLUTTER_GLX], 1, [Have the GLX backend])
CLUTTER_COGL="gl" CLUTTER_COGL="gl"
@ -191,6 +193,7 @@ case $clutterbackend in
clutter_gl_header="GLES/gl.h" clutter_gl_header="GLES/gl.h"
CLUTTER_FLAVOUR="eglx" CLUTTER_FLAVOUR="eglx"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGLX"
AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend]) AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend])
# We currently assume having egl means also having gles.. # We currently assume having egl means also having gles..
@ -230,6 +233,7 @@ case $clutterbackend in
clutter_gl_header="GLES/gl.h" clutter_gl_header="GLES/gl.h"
CLUTTER_FLAVOUR="eglnative" CLUTTER_FLAVOUR="eglnative"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGLNATIVE"
AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend]) AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend])
# We currently assume having egl means also having gles.. # We currently assume having egl means also having gles..
@ -263,6 +267,7 @@ case $clutterbackend in
clutter_gl_header="OpenGL/gl.h" clutter_gl_header="OpenGL/gl.h"
CLUTTER_FLAVOUR="osx" CLUTTER_FLAVOUR="osx"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX"
AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend]) AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend])
CLUTTER_COGL="gl" CLUTTER_COGL="gl"
@ -277,6 +282,7 @@ case $clutterbackend in
clutter_gl_header="GL/gl.h" clutter_gl_header="GL/gl.h"
CLUTTER_FLAVOUR="win32" CLUTTER_FLAVOUR="win32"
CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32"
AC_DEFINE([HAVE_CLUTTER_WIN32], 1, [Have the Win32 backend]) AC_DEFINE([HAVE_CLUTTER_WIN32], 1, [Have the Win32 backend])
CLUTTER_COGL="gl" CLUTTER_COGL="gl"
@ -309,6 +315,7 @@ AC_SUBST([backendextralib])
AC_SUBST(CLUTTER_FLAVOUR) AC_SUBST(CLUTTER_FLAVOUR)
AC_SUBST(CLUTTER_COGL) AC_SUBST(CLUTTER_COGL)
AC_SUBST(CLUTTER_GL_HEADER) AC_SUBST(CLUTTER_GL_HEADER)
AC_SUBST(CLUTTER_STAGE_TYPE)
clutterbackendlib=libclutter$CLUTTER_REAL-$clutterbackend-$CLUTTER_MAJORMINOR.la clutterbackendlib=libclutter$CLUTTER_REAL-$clutterbackend-$CLUTTER_MAJORMINOR.la
AC_SUBST([clutterbackendlib]) AC_SUBST([clutterbackendlib])