From f4df307ddd6e0c977c57aaba1b1e4adfa143c1b0 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 20 Feb 2009 15:39:32 +0000 Subject: [PATCH] [backend] Update the viewport when updating the GL context Bug 1442 - multistage, same-window resize events invalidate stage When ensuring that the GL context is attached to the correct ClutterStage we need to set the SYNC_MATRICES flag on the stage itself. This is needed in case the size of the new stage does not match the size of the old -- thus requiring a call to glViewport() when the paint cycle starts. --- clutter/clutter-backend.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/clutter/clutter-backend.c b/clutter/clutter-backend.c index 2c94c026c..36dbfad8c 100644 --- a/clutter/clutter-backend.c +++ b/clutter/clutter-backend.c @@ -310,6 +310,17 @@ _clutter_backend_ensure_context (ClutterBackend *backend, * potential issue of GL calls with no context) */ current_context_stage = stage; + + /* 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 + * SYNC_MATRICES flag and letting the next redraw cycle take care + * of calling glViewport() + */ + if (current_context_stage) + { + CLUTTER_SET_PRIVATE_FLAGS (current_context_stage, + CLUTTER_ACTOR_SYNC_MATRICES); + } } else CLUTTER_NOTE (MULTISTAGE, "Stage is the same");