[clutter] bin-layout: Use ClutterActor:fixed-position-set
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] bin-layout: Use ClutterActor:fixed-position-set
- Date: Sat, 11 Aug 2012 11:35:15 +0000 (UTC)
commit 97755882c16adcbefa2065e4ab3b07d225e50fd4
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Aug 9 17:11:10 2012 +0100
bin-layout: Use ClutterActor:fixed-position-set
Instead of only relying on the (now) deprecated BinAlignment.FIXED
enumeration value, we just ask the actor if a fixed position has been
explicitly set, under the assumption that if a developer decided to call
set_x(), set_y(), or set_position() on an actor inside a BinLayout then
she wanted the fixed position to be honoured.
This removes the last (proper) use of the BinAlignment enumeration.
clutter/clutter-bin-layout.c | 31 +++++++++++++++++++++++--------
1 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/clutter/clutter-bin-layout.c b/clutter/clutter-bin-layout.c
index 364851d..b79082b 100644
--- a/clutter/clutter-bin-layout.c
+++ b/clutter/clutter-bin-layout.c
@@ -447,7 +447,8 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
ClutterBinLayer *layer;
ClutterActorBox child_alloc = { 0, };
gdouble x_align, y_align;
- gboolean x_fill, y_fill, is_set;
+ gboolean x_fill, y_fill, is_fixed_position_set;
+ float fixed_x, fixed_y;
if (!CLUTTER_ACTOR_IS_VISIBLE (child))
continue;
@@ -457,19 +458,33 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
child);
layer = CLUTTER_BIN_LAYER (meta);
- if (layer->x_align == CLUTTER_BIN_ALIGNMENT_FIXED)
+ fixed_x = fixed_y = 0.f;
+ g_object_get (child,
+ "fixed-position-set", &is_fixed_position_set,
+ "fixed-x", &fixed_x,
+ "fixed-y", &fixed_y,
+ NULL);
+
+ /* XXX:2.0 - remove the FIXED alignment, and just use the fixed position
+ * of the actor if one is set
+ */
+ if (is_fixed_position_set ||
+ layer->x_align == CLUTTER_BIN_ALIGNMENT_FIXED)
{
- g_object_get (child, "fixed-position-set", &is_set, "fixed-x", &child_alloc.x1, NULL);
- if (!is_set)
- child_alloc.x1 = clutter_actor_get_x (child);
+ if (is_fixed_position_set)
+ child_alloc.x1 = fixed_x;
+ else
+ child_alloc.x1 = clutter_actor_get_x (child);
}
else
child_alloc.x1 = allocation_x;
- if (layer->y_align == CLUTTER_BIN_ALIGNMENT_FIXED)
+ if (is_fixed_position_set ||
+ layer->y_align == CLUTTER_BIN_ALIGNMENT_FIXED)
{
- g_object_get (child, "fixed-position-set", &is_set, "fixed-y", &child_alloc.y1, NULL);
- if (!is_set)
+ if (is_fixed_position_set)
+ child_alloc.y1 = fixed_y;
+ else
child_alloc.y1 = clutter_actor_get_y (child);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]