From f911a3a7a13a778b44fedb4760ea55105d6bcd46 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 12 Jan 2009 11:18:11 +0000 Subject: [PATCH] Allow ensuring that a stage viewport is updated 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 | 25 +++++++++++++++++++++++++ clutter/clutter-stage.h | 1 + 2 files changed, 26 insertions(+) diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index f6d4228..3b312df 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -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) { diff --git a/clutter/clutter-stage.h b/clutter/clutter-stage.h index cb8ca90..7b174ee 100644 --- a/clutter/clutter-stage.h +++ b/clutter/clutter-stage.h @@ -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 { \ -- 2.7.4