2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>

* HACKING.backends: Update documentation.

	* clutter/glx/clutter-stage-glx.c:
	(clutter_stage_glx_realize): Avoid setting more flags than
	necessary.
This commit is contained in:
Emmanuele Bassi 2008-05-12 10:17:55 +00:00
parent 9144b3902e
commit 6fa7aeef85
3 changed files with 19 additions and 26 deletions

View File

@ -1,3 +1,11 @@
2008-05-12 Emmanuele Bassi <ebassi@openedhand.com>
* HACKING.backends: Update documentation.
* clutter/glx/clutter-stage-glx.c:
(clutter_stage_glx_realize): Avoid setting more flags than
necessary.
2008-05-09 Neil Roberts <neil@o-hand.com> 2008-05-09 Neil Roberts <neil@o-hand.com>
* clutter/clutter-frame-source.c (clutter_frame_source_add) * clutter/clutter-frame-source.c (clutter_frame_source_add)

View File

@ -128,24 +128,20 @@ The stage implementation actor must implement at least the ::realize and
the stage implementation should: the stage implementation should:
- create a new native window handle - create a new native window handle
- create the drawing context (either GL or GLES) and assign it - if the backend doesn't have a drawing context (either GL or GLES),
to the backend, if it's not already present create one and assing it to the backend
- set the CLUTTER_ACTOR_REALIZED flag on *both* the wrapper and the - set the CLUTTER_ACTOR_REALIZED flag on *both* the wrapper and the
stage implementation stage implementation (this is very important)
- call clutter_stage_ensure_current() with the wrapper instance - call clutter_stage_ensure_current() with the wrapper instance
- set the private CLUTTER_ACTOR_SYNC_MATRICES flag on the stage wrapper
In case of failure, the CLUTTER_ACTOR_REALIZED flag should be unset on In case of failure, the CLUTTER_ACTOR_REALIZED flag should be unset on
both the wrapper and the stage implementation. the stage implementation.
Inside the ::unrealize function the stage implementation should: Inside the ::unrealize function the stage implementation should:
- unset the CLUTTER_ACTOR_REALIZED flag - unset the CLUTTER_ACTOR_REALIZED flag on itself
- call _clutter_shader_release_all() if the backend supports shaders
and the GL programmable pipeline
- destroy the native window handle - destroy the native window handle
- call clutter_stage_ensure_context() with the wrapper instance - call clutter_stage_ensure_current() with the wrapper instance
NOTES NOTES
===== =====
@ -157,9 +153,8 @@ implementation for event handling and window management.
Usual points of failure for backends are: Usual points of failure for backends are:
- not setting the CLUTTER_ACTOR_REALIZED flag on the stage implementation - not setting the CLUTTER_ACTOR_REALIZED flag on the stage implementation
and the stage wrapper inside the ::realized virtual function; and the stage wrapper inside the ::realized virtual function before
- not setting the CLUTTER_ACTOR_SYNC_MATRICES on the stage wrapper calling clutter_stage_ensure_current();
at the end of the ::realized virtual function;
- calling public API, like clutter_actor_paint(), or checking properties - calling public API, like clutter_actor_paint(), or checking properties
on the stage implementation instead of the ClutterStage wrapper. on the stage implementation instead of the ClutterStage wrapper.

View File

@ -153,8 +153,7 @@ clutter_stage_glx_realize (ClutterActor *actor)
if (!stage_x11->xvisinfo) if (!stage_x11->xvisinfo)
{ {
g_critical ("Unable to find suitable GL visual."); g_critical ("Unable to find suitable GL visual.");
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED); goto fail;
return;
} }
if (stage_x11->xwin == None) if (stage_x11->xwin == None)
@ -211,8 +210,7 @@ clutter_stage_glx_realize (ClutterActor *actor)
if (backend_glx->gl_context == None) if (backend_glx->gl_context == None)
{ {
g_critical ("Unable to create suitable GL context."); g_critical ("Unable to create suitable GL context.");
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED); goto fail;
return;
} }
} }
@ -279,11 +277,7 @@ clutter_stage_glx_realize (ClutterActor *actor)
if (backend_glx->gl_context == None) if (backend_glx->gl_context == None)
{ {
g_critical ("Unable to create suitable GL context."); g_critical ("Unable to create suitable GL context.");
goto fail;
CLUTTER_ACTOR_UNSET_FLAGS (stage_x11->wrapper, CLUTTER_ACTOR_REALIZED);
CLUTTER_ACTOR_UNSET_FLAGS (stage_x11, CLUTTER_ACTOR_REALIZED);
return;
} }
} }
@ -301,13 +295,9 @@ clutter_stage_glx_realize (ClutterActor *actor)
} }
} }
/* Make sure the viewport gets set up correctly */
CLUTTER_SET_PRIVATE_FLAGS (stage_x11->wrapper, CLUTTER_ACTOR_SYNC_MATRICES);
return; return;
fail: fail:
/* For one reason or another we cant realize the stage.. */
CLUTTER_ACTOR_UNSET_FLAGS (stage_x11->wrapper, CLUTTER_ACTOR_REALIZED);
CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED); CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED);
} }