From 6fa7aeef85322bc8a27b42431cad32719da5d0ab Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 12 May 2008 10:17:55 +0000 Subject: [PATCH] 2008-05-12 Emmanuele Bassi * HACKING.backends: Update documentation. * clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize): Avoid setting more flags than necessary. --- ChangeLog | 8 ++++++++ HACKING.backends | 21 ++++++++------------- clutter/glx/clutter-stage-glx.c | 16 +++------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd016ada9..8f096fe9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-05-12 Emmanuele Bassi + + * 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 * clutter/clutter-frame-source.c (clutter_frame_source_add) diff --git a/HACKING.backends b/HACKING.backends index 14b15ecff..538a3d31b 100644 --- a/HACKING.backends +++ b/HACKING.backends @@ -128,24 +128,20 @@ The stage implementation actor must implement at least the ::realize and the stage implementation should: - create a new native window handle - - create the drawing context (either GL or GLES) and assign it - to the backend, if it's not already present + - if the backend doesn't have a drawing context (either GL or GLES), + create one and assing it to the backend - 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 - - 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 -both the wrapper and the stage implementation. +the stage implementation. Inside the ::unrealize function the stage implementation should: - - unset the CLUTTER_ACTOR_REALIZED flag - - call _clutter_shader_release_all() if the backend supports shaders - and the GL programmable pipeline + - unset the CLUTTER_ACTOR_REALIZED flag on itself - destroy the native window handle - - call clutter_stage_ensure_context() with the wrapper instance - + - call clutter_stage_ensure_current() with the wrapper instance NOTES ===== @@ -157,9 +153,8 @@ implementation for event handling and window management. Usual points of failure for backends are: - not setting the CLUTTER_ACTOR_REALIZED flag on the stage implementation - and the stage wrapper inside the ::realized virtual function; -- not setting the CLUTTER_ACTOR_SYNC_MATRICES on the stage wrapper - at the end of the ::realized virtual function; + and the stage wrapper inside the ::realized virtual function before + calling clutter_stage_ensure_current(); - calling public API, like clutter_actor_paint(), or checking properties on the stage implementation instead of the ClutterStage wrapper. diff --git a/clutter/glx/clutter-stage-glx.c b/clutter/glx/clutter-stage-glx.c index 4665d585f..a60c75eef 100644 --- a/clutter/glx/clutter-stage-glx.c +++ b/clutter/glx/clutter-stage-glx.c @@ -153,8 +153,7 @@ clutter_stage_glx_realize (ClutterActor *actor) if (!stage_x11->xvisinfo) { g_critical ("Unable to find suitable GL visual."); - CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED); - return; + goto fail; } if (stage_x11->xwin == None) @@ -211,8 +210,7 @@ clutter_stage_glx_realize (ClutterActor *actor) if (backend_glx->gl_context == None) { g_critical ("Unable to create suitable GL context."); - CLUTTER_ACTOR_UNSET_FLAGS (actor, CLUTTER_ACTOR_REALIZED); - return; + goto fail; } } @@ -279,11 +277,7 @@ clutter_stage_glx_realize (ClutterActor *actor) if (backend_glx->gl_context == None) { g_critical ("Unable to create suitable GL context."); - - CLUTTER_ACTOR_UNSET_FLAGS (stage_x11->wrapper, CLUTTER_ACTOR_REALIZED); - CLUTTER_ACTOR_UNSET_FLAGS (stage_x11, CLUTTER_ACTOR_REALIZED); - - return; + goto fail; } } @@ -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; 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); }