After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 598462 - [StBoxLayout] Support fixed-position children
[StBoxLayout] Support fixed-position children
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-10-14 16:41 UTC by Colin Walters
Modified: 2009-10-15 21:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[StBoxLayout] Support fixed-position children (9.97 KB, patch)
2009-10-14 16:41 UTC, Colin Walters
needs-work Details | Review
[StBoxLayout] Minor code cleanup: use child variable consistently (3.48 KB, patch)
2009-10-15 18:47 UTC, Colin Walters
committed Details | Review
[StBoxLayout] Support fixed position children (6.54 KB, patch)
2009-10-15 18:47 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2009-10-14 16:41:17 UTC
When doing layout, check for whether x/y have been explicitly
specified, and if so honor those positions.
Comment 1 Colin Walters 2009-10-14 16:41:19 UTC
Created attachment 145437 [details] [review]
[StBoxLayout] Support fixed-position children
Comment 2 Dan Winship 2009-10-14 21:48:30 UTC
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.
Comment 3 Colin Walters 2009-10-15 18:47:22 UTC
Created attachment 145541 [details] [review]
[StBoxLayout] Minor code cleanup: use child variable consistently

Preparation for a subsequent patch.
Comment 4 Colin Walters 2009-10-15 18:47:27 UTC
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.