From 53d268a7ef2329689793c43c83986f7636ac052d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 3 Jul 2013 15:51:26 +0200 Subject: [PATCH] st: Remove support for fixed positioning in BoxLayout It is the job of layout containers to arrange their children; having a hidden feature that *also* allows children to be positioned freely outside the parent's allocation is just odd. With the last user of the feature gone, kill it. https://bugzilla.gnome.org/show_bug.cgi?id=703808 --- src/st/st-box-layout.c | 40 +++++++-------------------------- tests/interactive/box-layout.js | 6 ----- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 4f9bd8e38..5ef543173 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -285,7 +285,6 @@ get_content_preferred_width (StBoxLayout *self, { StBoxLayoutPrivate *priv = self->priv; gint n_children = 0; - gint n_fixed = 0; gfloat min_width, natural_width; ClutterActor *child; @@ -304,12 +303,6 @@ get_content_preferred_width (StBoxLayout *self, n_children++; - if (clutter_actor_get_fixed_position_set (child)) - { - n_fixed++; - continue; - } - if (priv->is_vertical) { _st_actor_get_preferred_width (child, -1, FALSE, @@ -329,10 +322,10 @@ get_content_preferred_width (StBoxLayout *self, } } - if (!priv->is_vertical && (n_children - n_fixed) > 1) + if (!priv->is_vertical && n_children > 1) { - min_width += priv->spacing * (n_children - n_fixed - 1); - natural_width += priv->spacing * (n_children - n_fixed - 1); + min_width += priv->spacing * (n_children - 1); + natural_width += priv->spacing * (n_children - 1); } if (min_width_p) @@ -367,7 +360,6 @@ get_content_preferred_height (StBoxLayout *self, { StBoxLayoutPrivate *priv = self->priv; gint n_children = 0; - gint n_fixed = 0; gfloat min_height, natural_height; ClutterActor *child; @@ -386,12 +378,6 @@ get_content_preferred_height (StBoxLayout *self, n_children++; - if (clutter_actor_get_fixed_position_set (child)) - { - n_fixed++; - continue; - } - if (priv->is_vertical) { clutter_container_child_get ((ClutterContainer*) self, child, @@ -416,10 +402,10 @@ get_content_preferred_height (StBoxLayout *self, } } - if (priv->is_vertical && (n_children - n_fixed) > 1) + if (priv->is_vertical && n_children > 1) { - min_height += priv->spacing * (n_children - n_fixed - 1); - natural_height += priv->spacing * (n_children - n_fixed - 1); + min_height += priv->spacing * (n_children - 1); + natural_height += priv->spacing * (n_children - 1); } if (min_height_p) @@ -511,12 +497,9 @@ compute_shrinks (StBoxLayout *self, { gfloat child_min, child_nat; gboolean child_fill; - gboolean fixed; - - fixed = clutter_actor_get_fixed_position_set (child); shrinks[i].child_index = i; - if (CLUTTER_ACTOR_IS_VISIBLE (child) && !fixed) + if (CLUTTER_ACTOR_IS_VISIBLE (child)) { if (priv->is_vertical) { @@ -738,20 +721,13 @@ st_box_layout_allocate (ClutterActor *actor, { ClutterActorBox child_box; gfloat child_min, child_nat, child_allocated; - gboolean xfill, yfill, expand, fixed; + gboolean xfill, yfill, expand; StAlign xalign, yalign; gdouble xalign_f, yalign_f; if (!CLUTTER_ACTOR_IS_VISIBLE (child)) goto next_child; - fixed = clutter_actor_get_fixed_position_set (child); - if (fixed) - { - clutter_actor_allocate_preferred_size (child, flags); - goto next_child; - } - clutter_container_child_get ((ClutterContainer*) actor, child, "x-fill", &xfill, "y-fill", &yfill, diff --git a/tests/interactive/box-layout.js b/tests/interactive/box-layout.js index 327ff230e..36460f847 100644 --- a/tests/interactive/box-layout.js +++ b/tests/interactive/box-layout.js @@ -45,12 +45,6 @@ function test() { style: 'border: 1px solid #aaaaaa; ' + 'background: #cceeff' })); - b2.add(new St.Label({ x: 50, - y: 50, - text: "Fixed", - style: 'border: 1px solid #aaaaaa;' - + 'background: #ffffcc' })); - //////////////////////////////////////////////////////////////////////////////// function createCollapsableBox(width) {