Revert "stage: Do not use get_allocation_geometry()"

This reverts commit ef1bb42a86.

Apparently, it broke GNOME Shell, so let's back it out first and try to
figure out why.
This commit is contained in:
Emmanuele Bassi 2012-08-12 09:29:29 +01:00
parent 93a43f879d
commit 44661902bd

View File

@ -364,11 +364,10 @@ clutter_stage_allocate (ClutterActor *self,
ClutterAllocationFlags flags) ClutterAllocationFlags flags)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
float old_width, old_height; ClutterGeometry prev_geom, geom;
float new_width, new_height;
float width, height;
cairo_rectangle_int_t window_size; cairo_rectangle_int_t window_size;
gboolean origin_changed; gboolean origin_changed;
gint width, height;
origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED) origin_changed = (flags & CLUTTER_ABSOLUTE_ORIGIN_CHANGED)
? TRUE ? TRUE
@ -378,10 +377,11 @@ clutter_stage_allocate (ClutterActor *self,
return; return;
/* our old allocation */ /* our old allocation */
clutter_actor_get_size (self, &old_width, &old_height); clutter_actor_get_allocation_geometry (self, &prev_geom);
/* the current allocation */ /* the current allocation */
clutter_actor_box_get_size (box, &width, &height); width = clutter_actor_box_get_width (box);
height = clutter_actor_box_get_height (box);
/* the current Stage implementation size */ /* the current Stage implementation size */
_clutter_stage_window_get_geometry (priv->impl, &window_size); _clutter_stage_window_get_geometry (priv->impl, &window_size);
@ -391,7 +391,7 @@ clutter_stage_allocate (ClutterActor *self,
* allocation chain - because we cannot forcibly change the size of the * allocation chain - because we cannot forcibly change the size of the
* stage window. * stage window.
*/ */
if (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)) if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
{ {
CLUTTER_NOTE (LAYOUT, CLUTTER_NOTE (LAYOUT,
"Following allocation to %dx%d (origin %s)", "Following allocation to %dx%d (origin %s)",
@ -470,15 +470,14 @@ clutter_stage_allocate (ClutterActor *self,
window_size.height); window_size.height);
/* reset the viewport if the allocation effectively changed */ /* reset the viewport if the allocation effectively changed */
clutter_actor_get_size (self, &new_width, &new_height); clutter_actor_get_allocation_geometry (self, &geom);
if (geom.width != prev_geom.width ||
if (old_width != new_width || geom.height != prev_geom.height)
old_height != new_height)
{ {
_clutter_stage_set_viewport (CLUTTER_STAGE (self), _clutter_stage_set_viewport (CLUTTER_STAGE (self),
0, 0, 0, 0,
new_width, geom.width,
new_height); geom.height);
/* Note: we don't assume that set_viewport will queue a full redraw /* Note: we don't assume that set_viewport will queue a full redraw
* since it may bail-out early if something preemptively set the * since it may bail-out early if something preemptively set the
@ -2837,7 +2836,7 @@ clutter_stage_read_pixels (ClutterStage *stage,
gint width, gint width,
gint height) gint height)
{ {
ClutterActorBox box; ClutterGeometry geom;
guchar *pixels; guchar *pixels;
g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL); g_return_val_if_fail (CLUTTER_IS_STAGE (stage), NULL);
@ -2846,13 +2845,13 @@ clutter_stage_read_pixels (ClutterStage *stage,
clutter_stage_ensure_current (stage); clutter_stage_ensure_current (stage);
clutter_actor_paint (CLUTTER_ACTOR (stage)); clutter_actor_paint (CLUTTER_ACTOR (stage));
clutter_actor_get_allocation_box (CLUTTER_ACTOR (stage), &box); clutter_actor_get_allocation_geometry (CLUTTER_ACTOR (stage), &geom);
if (width < 0) if (width < 0)
width = box.x2 - box.x1; width = geom.width;
if (height < 0) if (height < 0)
height = box.y2 - box.y1; height = geom.height;
pixels = g_malloc (height * width * 4); pixels = g_malloc (height * width * 4);