Allow ensuring that a stage viewport is updated
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 12 Jan 2009 11:18:11 +0000 (11:18 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 12 Jan 2009 11:18:11 +0000 (11:18 +0000)
Since we only update the GL viewport when we receive a ConfigureNotify
event on X11, we also need a function to allow other toolkits to tell
a stage that the viewport should be updated.

This commit adds clutter_stage_ensure_viewport(), a function that simply
sets the private SYNC_MATRICES flag on the stage and then queues a
redraw.

This function should be called by libraries integrating Clutter with
other toolkits, like clutter-gtk or clutter-qt.

clutter/clutter-stage.c
clutter/clutter-stage.h

index f6d4228..3b312df 100644 (file)
@@ -1801,6 +1801,31 @@ clutter_stage_ensure_current (ClutterStage *stage)
   _clutter_backend_ensure_context (ctx->backend, stage);
 }
 
+/**
+ * clutter_stage_ensure_viewport:
+ * @stage: a #ClutterStage
+ *
+ * Ensures that the GL viewport is updated with the current
+ * stage window size.
+ *
+ * This function will queue a redraw of @stage.
+ *
+ * This function should not be called by applications; it is used
+ * when embedding a #ClutterStage into a toolkit with another
+ * windowing system, like GTK+.
+ *
+ * Since: 1.0
+ */
+void
+clutter_stage_ensure_viewport (ClutterStage *stage)
+{
+  g_return_if_fail (CLUTTER_IS_STAGE (stage));
+
+  CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
+
+  clutter_stage_queue_redraw (stage);
+}
+
 static gboolean
 redraw_update_idle (gpointer user_data)
 {
index cb8ca90..7b174ee 100644 (file)
@@ -229,6 +229,7 @@ ClutterActor *        clutter_stage_get_key_focus      (ClutterStage *stage);
 void                  clutter_stage_ensure_current     (ClutterStage *stage);
 void                  clutter_stage_queue_redraw       (ClutterStage *stage);
 gboolean              clutter_stage_is_default         (ClutterStage *stage);
+void                  clutter_stage_ensure_viewport    (ClutterStage *stage);
 
 /* Commodity macro */
 #define clutter_stage_add(stage,actor)                  G_STMT_START {  \