[clutter] stage-manager: Store the stage manager into the main context



commit f1ebfe30cee518811454b2bea6558bcfd19a5eb7
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Nov 14 15:43:20 2011 +0000

    stage-manager: Store the stage manager into the main context
    
    Use the main context to store the stage manager singleton, instead of a
    static pointer inside clutter-stage-manager.c.

 clutter/clutter-private.h       |    4 ++++
 clutter/clutter-stage-manager.c |    8 ++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h
index 017d54e..8c8f602 100644
--- a/clutter/clutter-private.h
+++ b/clutter/clutter-private.h
@@ -40,6 +40,7 @@
 #include "clutter-layout-manager.h"
 #include "clutter-master-clock.h"
 #include "clutter-settings.h"
+#include "clutter-stage-manager.h"
 #include "clutter-stage.h"
 
 G_BEGIN_DECLS
@@ -124,6 +125,9 @@ struct _ClutterMainContext
   /* the main windowing system backend */
   ClutterBackend *backend;
 
+  /* the object holding all the stage instances */
+  ClutterStageManager *stage_manager;
+
   /* the main event queue */
   GQueue *events_queue;
 
diff --git a/clutter/clutter-stage-manager.c b/clutter/clutter-stage-manager.c
index 26e58cc..a600594 100644
--- a/clutter/clutter-stage-manager.c
+++ b/clutter/clutter-stage-manager.c
@@ -178,12 +178,12 @@ clutter_stage_manager_init (ClutterStageManager *stage_manager)
 ClutterStageManager *
 clutter_stage_manager_get_default (void)
 {
-  static ClutterStageManager *stage_manager = NULL;
+  ClutterMainContext *context = _clutter_context_get_default ();
 
-  if (G_UNLIKELY (stage_manager == NULL))
-    stage_manager = g_object_new (CLUTTER_TYPE_STAGE_MANAGER, NULL);
+  if (G_UNLIKELY (context->stage_manager == NULL))
+    context->stage_manager = g_object_new (CLUTTER_TYPE_STAGE_MANAGER, NULL);
 
-  return stage_manager;
+  return context->stage_manager;
 }
 
 /**



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]