[backend] Update the viewport when updating the GL context
authorEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 20 Feb 2009 15:39:32 +0000 (15:39 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Fri, 20 Feb 2009 16:40:57 +0000 (16:40 +0000)
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

index 2c94c02..36dbfad 100644 (file)
@@ -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");