diff --git a/ChangeLog b/ChangeLog index e220f21ca..4f9f8a3a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2008-03-31 Matthew Allum + + * 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 * clutter/win32/clutter-backend-win32.c diff --git a/README b/README index 83d024a5f..5314444dd 100644 --- a/README +++ b/README @@ -145,6 +145,11 @@ wanting to port to newer releases (See NEWS for general new feature info). 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. * Some more focused timeline unit tests have been added and some tweaks to diff --git a/clutter/clutter-backend.h b/clutter/clutter-backend.h index 83d8e4243..08b53e914 100644 --- a/clutter/clutter-backend.h +++ b/clutter/clutter-backend.h @@ -62,7 +62,7 @@ struct _ClutterBackendClass gboolean (* post_parse) (ClutterBackend *backend, GError **error); ClutterActor *(* create_stage) (ClutterBackend *backend, - GError **error); + GError **error); void (* init_events) (ClutterBackend *backend); void (* init_features) (ClutterBackend *backend); void (* add_options) (ClutterBackend *backend, diff --git a/clutter/clutter-stage-manager.c b/clutter/clutter-stage-manager.c index 1fd81ba6e..c14059449 100644 --- a/clutter/clutter-stage-manager.c +++ b/clutter/clutter-stage-manager.c @@ -245,7 +245,12 @@ _clutter_stage_manager_add_stage (ClutterStageManager *stage_manager, 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); 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_object_unref (stage); + /* g_object_unref (stage); */ } diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 271cbfc32..5d560735b 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -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 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->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->pick = clutter_stage_pick; diff --git a/clutter/clutter-version.h.in b/clutter/clutter-version.h.in index 806febca4..7c9e15656 100644 --- a/clutter/clutter-version.h.in +++ b/clutter/clutter-version.h.in @@ -112,6 +112,15 @@ */ #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: * @@ -122,4 +131,5 @@ */ #define CLUTTER_NO_FPU CLUTTER_NO_FPU_MACRO_WAS_REMOVED + #endif /* __CLUTTER_VERSION_H__ */ diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c index b6ea0353a..69f98d22e 100644 --- a/clutter/glx/clutter-backend-glx.c +++ b/clutter/glx/clutter-backend-glx.c @@ -45,6 +45,7 @@ #include "../clutter-main.h" #include "../clutter-debug.h" #include "../clutter-private.h" +#include "../clutter-version.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, GError **error) { @@ -396,7 +397,7 @@ clutter_backend_glx_create_stage (ClutterBackend *backend, ClutterStageX11 *stage_x11; 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 */ stage_x11 = CLUTTER_STAGE_X11 (stage); diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c index 2e77f6f0c..00dacbd08 100644 --- a/clutter/glx/clutter-stage-glx.c +++ b/clutter/glx/clutter-stage-glx.c @@ -56,6 +56,8 @@ clutter_stage_glx_unrealize (ClutterActor *actor) ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (actor); ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (actor); + /* Note unrealize should free up any backend stage related resources */ + gboolean was_offscreen; CLUTTER_MARK(); diff --git a/configure.ac b/configure.ac index dd2d089ba..a3883c75a 100644 --- a/configure.ac +++ b/configure.ac @@ -121,6 +121,7 @@ case $clutterbackend in clutter_gl_header="GL/gl.h" CLUTTER_FLAVOUR="sdl" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_SDL" AC_DEFINE([HAVE_CLUTTER_SDL], 1, [Have the SDL backend]) CLUTTER_COGL="gl" @@ -162,6 +163,7 @@ case $clutterbackend in clutter_gl_header="GL/gl.h" CLUTTER_FLAVOUR="glx" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_GLX" AC_DEFINE([HAVE_CLUTTER_GLX], 1, [Have the GLX backend]) CLUTTER_COGL="gl" @@ -191,6 +193,7 @@ case $clutterbackend in clutter_gl_header="GLES/gl.h" CLUTTER_FLAVOUR="eglx" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGLX" AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend]) # We currently assume having egl means also having gles.. @@ -230,6 +233,7 @@ case $clutterbackend in clutter_gl_header="GLES/gl.h" CLUTTER_FLAVOUR="eglnative" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_EGLNATIVE" AC_DEFINE([HAVE_CLUTTER_EGL], 1, [Have the EGL backend]) # We currently assume having egl means also having gles.. @@ -263,6 +267,7 @@ case $clutterbackend in clutter_gl_header="OpenGL/gl.h" CLUTTER_FLAVOUR="osx" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_OSX" AC_DEFINE([HAVE_CLUTTER_OSX], [1], [Have the OSX backend]) CLUTTER_COGL="gl" @@ -277,6 +282,7 @@ case $clutterbackend in clutter_gl_header="GL/gl.h" CLUTTER_FLAVOUR="win32" + CLUTTER_STAGE_TYPE="CLUTTER_TYPE_STAGE_WIN32" AC_DEFINE([HAVE_CLUTTER_WIN32], 1, [Have the Win32 backend]) CLUTTER_COGL="gl" @@ -309,6 +315,7 @@ AC_SUBST([backendextralib]) AC_SUBST(CLUTTER_FLAVOUR) AC_SUBST(CLUTTER_COGL) AC_SUBST(CLUTTER_GL_HEADER) +AC_SUBST(CLUTTER_STAGE_TYPE) clutterbackendlib=libclutter$CLUTTER_REAL-$clutterbackend-$CLUTTER_MAJORMINOR.la AC_SUBST([clutterbackendlib])