[x11] Unset the GL context when re-realizing

Setting the stage window using the set_stage_foreign() method will
lead to a re-realization. We need to make sure that the Drawable
currently associated to the GL context is set to None, to avoid a
BadDrawable error or, if we're unlucky, a segfault in the X server.
This commit is contained in:
Emmanuele Bassi 2009-05-11 18:17:30 +01:00
parent 0b7e459d48
commit 4b285e02bc

View File

@ -686,6 +686,12 @@ set_foreign_window_callback (ClutterActor *actor,
fwd->stage_x11->xwin_height = fwd->geom.height; fwd->stage_x11->xwin_height = fwd->geom.height;
clutter_actor_set_geometry (actor, &fwd->geom); clutter_actor_set_geometry (actor, &fwd->geom);
/* calling this with the stage unrealized will unset the stage
* from the GL context; once the stage is realized the GL context
* will be set again
*/
clutter_stage_ensure_current (CLUTTER_STAGE (actor));
} }
/** /**
@ -749,7 +755,7 @@ clutter_x11_set_stage_foreign (ClutterStage *stage,
set_foreign_window_callback, set_foreign_window_callback,
&fwd); &fwd);
CLUTTER_SET_PRIVATE_FLAGS (actor, CLUTTER_ACTOR_SYNC_MATRICES); clutter_stage_ensure_viewport (stage);
return TRUE; return TRUE;
} }