[backend] Unset the current stage if it is unrealized

This commit reverts part of commit 5bcde25c - specifically the
part that forced a realization of the stage if we are ensuring
the GL context with it. This makes Clutter behave like it did
prior to commit 5bcde25c: if we are asked to ensure the GL context
with an unrealized stage we simply pass NULL to the backend
implementation.
This commit is contained in:
Emmanuele Bassi 2009-05-11 12:36:55 +01:00
parent d19f6feb45
commit 8b7c6955de

View File

@ -312,32 +312,35 @@ _clutter_backend_ensure_context (ClutterBackend *backend,
if (current_context_stage != stage || !CLUTTER_ACTOR_IS_REALIZED (stage)) if (current_context_stage != stage || !CLUTTER_ACTOR_IS_REALIZED (stage))
{ {
ClutterStage *new_stage = NULL;
if (!CLUTTER_ACTOR_IS_REALIZED (stage)) if (!CLUTTER_ACTOR_IS_REALIZED (stage))
{ {
CLUTTER_NOTE (MULTISTAGE, new_stage = NULL;
"Stage [%p] is not realized, realizing",
stage);
/* if we are asked to ensure a particular stage we need CLUTTER_NOTE (MULTISTAGE,
* to make sure that is has been realized; calling "Stage [%p] is not realized, unsetting the stage",
* realized() twice in a row is cheap, since the method stage);
* will check first
*/
clutter_actor_realize (CLUTTER_ACTOR (stage));
} }
else else
CLUTTER_NOTE (MULTISTAGE, "Setting the new stage [%p]", stage); {
new_stage = stage;
CLUTTER_NOTE (MULTISTAGE,
"Setting the new stage [%p]",
new_stage);
}
klass = CLUTTER_BACKEND_GET_CLASS (backend); klass = CLUTTER_BACKEND_GET_CLASS (backend);
if (G_LIKELY (klass->ensure_context)) if (G_LIKELY (klass->ensure_context))
klass->ensure_context (backend, stage); klass->ensure_context (backend, new_stage);
/* FIXME: With a NULL stage and thus no active context it may make more /* FIXME: With a NULL stage and thus no active context it may make more
* sense to clean the context but then re call with the default stage * sense to clean the context but then re call with the default stage
* so at least there is some kind of context in place (as to avoid * so at least there is some kind of context in place (as to avoid
* potential issue of GL calls with no context) * potential issue of GL calls with no context)
*/ */
current_context_stage = stage; current_context_stage = new_stage;
/* if the new stage has a different size than the previous one /* if the new stage has a different size than the previous one
* we need to update the viewport; we do it by simply setting the * we need to update the viewport; we do it by simply setting the