GNOME Bugzilla – Bug 598462
[StBoxLayout] Support fixed-position children
Last modified: 2009-10-15 21:57:37 UTC
When doing layout, check for whether x/y have been explicitly specified, and if so honor those positions.
Created attachment 145437 [details] [review] [StBoxLayout] Support fixed-position children
Review of attachment 145437 [details] [review]: it would be nice to split the "child = (ClutterActor*) l->data;" parts into a separate commit... ::: src/st/st-box-layout.c @@ +459,2 @@ { min_width = MAX (child_min, min_width); That doesn't seem right; either we should ignore fixed-position children completely for purposes of preferred width/height (like BigBox does), or else we need to take both position and width into account in the fixed-position case: min_width = MAX (clutter_actor_get_x (child) + child_min, min_width); natural_width = MAX (clutter_actor_get_x (child) + child_nat, natural_width); @@ +536,2 @@ { min_height = MAX (child_min, min_height); as with the width case @@ +881,3 @@ + child_box.y1 = clutter_actor_get_y (child); + child_box.x2 = CLAMP(child_box.x1 + child_nat_width, 0, avail_width - child_box.x1); + child_box.y2 = CLAMP(child_box.y1 + child_nat_height, 0, avail_height - child_box.y1); Clamping the allocation to fit seems to go against the spirit of fixed positioning. I think we should just use clutter_actor_allocate_preferred_size() like ClutterGroup does. (OTOH it's possible that your current way is more "CSS-like"? I'm not sure.) Also, .x2 and .y2 need to be positions but you're assigning distances.
Created attachment 145541 [details] [review] [StBoxLayout] Minor code cleanup: use child variable consistently Preparation for a subsequent patch.
Created attachment 145542 [details] [review] [StBoxLayout] Support fixed position children When doing layout, check for whether x/y have been explicitly specified, and if so honor those positions.