diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index 35d97fdcc..90e4ad2a3 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -304,8 +304,8 @@ void _clutter_backend_ensure_context (ClutterBackend *backend, ClutterStage *stage) { - ClutterBackendClass *klass; static ClutterStage *current_context_stage = NULL; + ClutterBackendClass *klass; g_return_if_fail (CLUTTER_IS_BACKEND (backend)); g_return_if_fail (CLUTTER_IS_STAGE (stage)); @@ -314,8 +314,16 @@ _clutter_backend_ensure_context (ClutterBackend *backend, { if (!CLUTTER_ACTOR_IS_REALIZED (stage)) { - CLUTTER_NOTE (MULTISTAGE, "Stage is not realized, unsetting"); - stage = NULL; + CLUTTER_NOTE (MULTISTAGE, + "Stage [%p] is not realized, realizing", + stage); + + /* if we are asked to ensure a particular stage we need + * to make sure that is has been realized; calling + * realized() twice in a row is cheap, since the method + * will check first + */ + clutter_actor_realize (CLUTTER_ACTOR (stage)); } else CLUTTER_NOTE (MULTISTAGE, "Setting the new stage [%p]", stage); diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 8780b2d67..3087dc260 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -275,8 +275,9 @@ clutter_stage_realize (ClutterActor *self) ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; /* Make sure the viewport and projection matrix are valid for the - first paint (which will likely occur before the ConfigureNotify - is received) */ + * first paint (which will likely occur before the ConfigureNotify + * is received) + */ CLUTTER_SET_PRIVATE_FLAGS (self, CLUTTER_ACTOR_SYNC_MATRICES); g_assert (priv->impl != NULL); @@ -286,7 +287,10 @@ clutter_stage_realize (ClutterActor *self) * realization sequence was successful */ if (CLUTTER_ACTOR_IS_REALIZED (priv->impl)) - clutter_stage_ensure_current (CLUTTER_STAGE (self)); + { + CLUTTER_ACTOR_SET_FLAGS (self, CLUTTER_ACTOR_REALIZED); + clutter_stage_ensure_current (CLUTTER_STAGE (self)); + } else CLUTTER_ACTOR_UNSET_FLAGS (self, CLUTTER_ACTOR_REALIZED); } @@ -582,8 +586,9 @@ clutter_stage_dispose (GObject *object) if (priv->impl) { - CLUTTER_NOTE (MISC, "Disposing of the stage implementation"); - g_object_unref (priv->impl); + CLUTTER_NOTE (BACKEND, "Disposing of the stage implementation"); + clutter_actor_hide (priv->impl); + clutter_actor_destroy (priv->impl); priv->impl = NULL; } @@ -847,6 +852,9 @@ clutter_stage_init (ClutterStage *self) else g_object_ref_sink (priv->impl); + /* make sure that the implementation is considered a top level */ + CLUTTER_SET_PRIVATE_FLAGS (priv->impl, CLUTTER_ACTOR_IS_TOPLEVEL); + priv->is_offscreen = FALSE; priv->is_fullscreen = FALSE; priv->is_user_resizable = FALSE; diff --git a/clutter/glx/clutter-backend-glx.c b/clutter/glx/clutter-backend-glx.c index 41f00b159..7ddc1ad6e 100644 --- a/clutter/glx/clutter-backend-glx.c +++ b/clutter/glx/clutter-backend-glx.c @@ -483,10 +483,13 @@ clutter_backend_glx_create_stage (ClutterBackend *backend, stage_x11->backend = backend_x11; stage_x11->wrapper = wrapper; - CLUTTER_NOTE (BACKEND, "GLX stage created (display:%p, screen:%d, root:%u)", + CLUTTER_NOTE (BACKEND, + "GLX stage created[%p] (dpy:%p, screen:%d, root:%u, wrap:%p)", + stage, stage_x11->xdpy, stage_x11->xscreen, - (unsigned int) stage_x11->xwin_root); + (unsigned int) stage_x11->xwin_root, + wrapper); return stage; }