From 52744c0d9db6d7f9738d31b6d9f774c0912fcad0 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Thu, 21 Oct 2010 16:27:17 +0100 Subject: [PATCH] clutter-stage: Set the Cogl framebuffer size after allocating When handling an allocation on the stage, Clutter uses the oppurtunity to inform Cogl of the new size of the framebuffer so that it can handle the viewport correctly. It queries the size of the window implementation using a backend virtual function. However it was doing this before letting the backend handle the allocation so on Win32 it would end up using the previous framebuffer size. This wasn't affecting the X11 backend because in that case the resizes are asynchronous so setting the stage size causes one allocation which ends up sending a window size request. Eventually a ConfigureNotify is received which causes the size of the stage to be set again and another allocation is fired meaning the framebuffer size will be set again this time with the correct size. In Win32 the resizes are synchronous so we don't have this second allocation. --- clutter/clutter-stage.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index ea00775b4..c64eeb1f6 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -268,10 +268,6 @@ clutter_stage_allocate (ClutterActor *self, height = clutter_actor_box_get_height (box); _clutter_stage_window_get_geometry (priv->impl, &geom); - /* XXX: Until Cogl becomes fully responsible for backend windows Clutter - * need to manually keep it informed of the current window size */ - _cogl_onscreen_clutter_backend_set_size (geom.width, geom.height); - /* if the stage is fixed size (for instance, it's using a frame-buffer) * then we simply ignore any allocation request and override the * allocation chain. @@ -343,6 +339,14 @@ clutter_stage_allocate (ClutterActor *self, klass->allocate (self, &override, flags); } + /* XXX: Until Cogl becomes fully responsible for backend windows + * Clutter need to manually keep it informed of the current window + * size. We do this after the allocation above so that the stage + * window has a chance to update the window size based on the + * allocation. */ + _clutter_stage_window_get_geometry (priv->impl, &geom); + _cogl_onscreen_clutter_backend_set_size (geom.width, geom.height); + clutter_actor_get_allocation_geometry (self, &geom); if (geom.width != prev_geom.width || geom.height != prev_geom.height) {