2008-04-01 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-backend.c: * clutter/glx/clutter-backend-glx.c: * clutter/glx/clutter-stage-glx.c: Allow NULL to be passed to _clutter_backend_ensure_context which essentially clears GL context. This is hooked into stage unrealisation. Isn't yet quite bulletproof. Fixes issues with gtk-embed crasher (thanks to Neil).
This commit is contained in:
parent
d04fd6d620
commit
c158a93a84
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2008-04-01 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter/clutter-backend.c:
|
||||
* clutter/glx/clutter-backend-glx.c:
|
||||
* clutter/glx/clutter-stage-glx.c:
|
||||
Allow NULL to be passed to _clutter_backend_ensure_context
|
||||
which essentially clears GL context. This is hooked into stage
|
||||
unrealisation. Isn't yet quite bulletproof.
|
||||
Fixes issues with gtk-embed crasher (thanks to Neil).
|
||||
|
||||
2008-04-1 Robert Bragg <bob@o-hand.com>
|
||||
|
||||
* clutter/glx/clutter-glx-texture-pixmap.c:
|
||||
|
@ -184,15 +184,25 @@ _clutter_backend_ensure_context (ClutterBackend *backend, ClutterStage *stage)
|
||||
g_return_if_fail (CLUTTER_IS_BACKEND (backend));
|
||||
g_return_if_fail (CLUTTER_IS_STAGE (stage));
|
||||
|
||||
if (stage != current_context_stage)
|
||||
if (stage != current_context_stage || !CLUTTER_ACTOR_IS_REALIZED(stage))
|
||||
{
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (!CLUTTER_ACTOR_IS_REALIZED(stage))
|
||||
stage = NULL;
|
||||
|
||||
klass = CLUTTER_BACKEND_GET_CLASS (backend);
|
||||
if (G_LIKELY(klass->ensure_context))
|
||||
klass->ensure_context (backend, stage);
|
||||
|
||||
/* 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
|
||||
* so at least there is some kind of context in place (as to avoid
|
||||
* potential issue of GL calls with no context)
|
||||
*/
|
||||
|
||||
current_context_stage = stage;
|
||||
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
||||
|
||||
if (stage)
|
||||
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,16 +350,30 @@ clutter_backend_glx_ensure_context (ClutterBackend *backend,
|
||||
ClutterBackendGLX *backend_glx;
|
||||
ClutterStageGLX *stage_glx;
|
||||
ClutterStageX11 *stage_x11;
|
||||
ClutterBackendX11 *backend_x11;
|
||||
|
||||
stage_x11 = CLUTTER_STAGE_X11(stage);
|
||||
stage_glx = CLUTTER_STAGE_GLX(stage);
|
||||
backend_glx = CLUTTER_BACKEND_GLX(backend);
|
||||
if (stage == NULL)
|
||||
{
|
||||
backend_x11 = CLUTTER_BACKEND_X11(backend);
|
||||
CLUTTER_NOTE (MULTISTAGE, "Clearing all context");
|
||||
|
||||
CLUTTER_NOTE (MULTISTAGE, "setting context for stage:%p", stage );
|
||||
glXMakeCurrent (backend_x11->xdpy, None, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
stage_glx = CLUTTER_STAGE_GLX(stage);
|
||||
stage_x11 = CLUTTER_STAGE_X11(stage);
|
||||
backend_glx = CLUTTER_BACKEND_GLX(backend);
|
||||
|
||||
glXMakeCurrent (stage_x11->xdpy,
|
||||
stage_x11->xwin,
|
||||
backend_glx->gl_context);
|
||||
g_return_if_fail (stage_x11->xwin != None);
|
||||
g_return_if_fail (backend_glx->gl_context != None);
|
||||
|
||||
CLUTTER_NOTE (MULTISTAGE, "setting context for stage:%p", stage );
|
||||
|
||||
glXMakeCurrent (stage_x11->xdpy,
|
||||
stage_x11->xwin,
|
||||
backend_glx->gl_context);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,7 +99,8 @@ clutter_stage_glx_unrealize (ClutterActor *actor)
|
||||
stage_x11->xwin = None;
|
||||
}
|
||||
|
||||
glXMakeCurrent (stage_x11->xdpy, None, NULL);
|
||||
/* As unrealised the context will now get cleared */
|
||||
clutter_stage_ensure_current (CLUTTER_STAGE(stage_glx));
|
||||
|
||||
XSync (stage_x11->xdpy, False);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user