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.
This commit is contained in:
Neil Roberts 2010-10-21 16:27:17 +01:00
parent cc7977988c
commit 52744c0d9d

View File

@ -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)
{