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 648873 - Feature request: ClutterFlowLayout not aligning on a grid
Feature request: ClutterFlowLayout not aligning on a grid
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: ClutterLayoutManager
git master
Other Linux
: Normal enhancement
: ---
Assigned To: clutter-maint
clutter-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-28 13:59 UTC by Alban Crequy
Modified: 2013-05-13 19:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flow.c (1.30 KB, text/x-csrc)
2011-04-28 13:59 UTC, Alban Crequy
  Details
ClutterFlowLayout.png (8.88 KB, image/png)
2011-04-28 14:03 UTC, Alban Crequy
  Details
flow-layout: Add :snap-to-grid property (15.61 KB, patch)
2012-06-11 05:37 UTC, Bastian Winkler
none Details | Review
flow-layout: Add :snap-to-grid property (15.60 KB, patch)
2013-04-12 14:27 UTC, Bastian Winkler
none Details | Review
Updated to master (14.23 KB, patch)
2013-04-29 15:54 UTC, Erick Perez Castellanos
reviewed Details | Review
Fixes (2.64 KB, patch)
2013-04-29 15:55 UTC, Erick Perez Castellanos
reviewed Details | Review
flow-layout: Add snap_to_grid. Clutter-1.16 branch (14.34 KB, patch)
2013-05-03 17:16 UTC, Erick Perez Castellanos
accepted-commit_now Details | Review
flow-layout: Add snap_to_grid. Clutter-2 branch (15.68 KB, patch)
2013-05-03 17:28 UTC, Erick Perez Castellanos
committed Details | Review
flow-layout: Add snap_to_grid. Clutter-1.16 branch (15.75 KB, patch)
2013-05-07 19:15 UTC, Erick Perez Castellanos
committed Details | Review

Description Alban Crequy 2011-04-28 13:59:08 UTC
Created attachment 186819 [details]
flow.c

At the moment, ClutterFlowLayout can only align its children on a grid. It would be nice if it could place one item just next to the previous one without losing space.

The attached test program and the screenshot show the problem.
Comment 1 Alban Crequy 2011-04-28 14:03:27 UTC
Created attachment 186820 [details]
ClutterFlowLayout.png

This screenshot shows the problem:
- There is lost space between "Open" and "Eject"
- There is enough space to put the "?" button after the "Kill" button but it goes on a new line
Comment 2 Rob Staudinger 2011-04-28 14:33:04 UTC
There is a "homogeneous" property, that might go some way?
Comment 3 Rob Staudinger 2011-04-28 14:34:44 UTC
Well never mind, I had the older screenshot from the devices panel in mind.
Comment 4 Emmanuele Bassi (:ebassi) 2012-04-24 13:01:03 UTC
I'd accept a patch that added a :snap-to-grid property (default=true) that, when set to false, would not assign to every row/column the minimum and natural size computed based on the biggest child.
Comment 5 Bastian Winkler 2012-06-11 05:37:12 UTC
Created attachment 216084 [details] [review]
flow-layout: Add :snap-to-grid property

Here's an initial patch for the _not_ snap to grid functionality. It's quite 
untested an may contain some unwanted features.
ClutterFlowLayout also needs some revamp to properly support ClutterActor's
expand settings
Comment 6 Bastian Winkler 2013-04-12 14:27:33 UTC
Created attachment 241355 [details] [review]
flow-layout: Add :snap-to-grid property

Add a :snap-to-grid property to FlowLayout to prevent the layout from
assigning it's children a position based on the size of the largest
child.


Updated to clutter-1.14 branch
Comment 7 Erick Perez Castellanos 2013-04-29 15:54:03 UTC
Created attachment 242818 [details] [review]
Updated to master
Comment 8 Erick Perez Castellanos 2013-04-29 15:55:54 UTC
Created attachment 242820 [details] [review]
Fixes
Comment 9 Erick Perez Castellanos 2013-04-29 15:59:24 UTC
(In reply to comment #6)
> Created an attachment (id=241355) [details] [review]
> flow-layout: Add :snap-to-grid property
> 
> Add a :snap-to-grid property to FlowLayout to prevent the layout from
> assigning it's children a position based on the size of the largest
> child.
> 
> 
> Updated to clutter-1.14 branch

This patch made by Bastian already solve the issue of ClutterFlowLayout not respecting expands flags of its children.
Comment 10 Emmanuele Bassi (:ebassi) 2013-05-02 20:54:55 UTC
Review of attachment 242818 [details] [review]:

::: clutter/clutter-flow-layout.c
@@ +1065,3 @@
+   * on a grid
+   *
+   * Since: 1.12

Since: 1.16

@@ +1511,3 @@
+ * @snap_to_grid: %TRUE if the @layout should place its children
+ *   on a grid
+ *

missing description.

something like:

Whether the @layout should lay the children using a grid.

@@ +1512,3 @@
+ *   on a grid
+ *
+ * Since: 1.12

Since: 1.16

@@ +1538,3 @@
+ * clutter_flow_layout_get_snap_to_grid:
+ * @layout: a #ClutterFlowLayout
+ *

missing description.

something like:

Retrieves the value set using clutter_flow_layout_set_snap_to_grid().

@@ +1542,3 @@
+ *   a grid
+ *
+ * Since: 1.12

Since: 1.16

::: clutter/clutter-flow-layout.h
@@ +105,3 @@
                                                                gfloat                 *min_height,
                                                                gfloat                 *max_height);
+CLUTTER_AVAILABLE_IN_1_12

need to be updated to CLUTTER_AVAILABLE_IN_1_16

@@ +108,3 @@
+void                   clutter_flow_layout_set_snap_to_grid   (ClutterFlowLayout      *layout,
+                                                               gboolean                snap_to_grid);
+CLUTTER_AVAILABLE_IN_1_12

same as above.
Comment 11 Emmanuele Bassi (:ebassi) 2013-05-02 20:55:26 UTC
Review of attachment 242820 [details] [review]:

should be a separate patch against master.
Comment 12 Erick Perez Castellanos 2013-05-03 15:25:37 UTC
(In reply to comment #10)
> Review of attachment 242818 [details] [review]:
> 

So, basically, this one should be patch against clutter-1.16 branch ?
Comment 13 Erick Perez Castellanos 2013-05-03 17:16:24 UTC
Created attachment 243229 [details] [review]
flow-layout: Add snap_to_grid. Clutter-1.16 branch
Comment 14 Erick Perez Castellanos 2013-05-03 17:28:45 UTC
Created attachment 243231 [details] [review]
flow-layout: Add snap_to_grid. Clutter-2 branch
Comment 15 Emmanuele Bassi (:ebassi) 2013-05-06 18:12:44 UTC
Review of attachment 243229 [details] [review]:

looks good; tested on clutter-1.16, I think we can commit this.
Comment 16 Emmanuele Bassi (:ebassi) 2013-05-06 18:13:18 UTC
Review of attachment 243229 [details] [review]:

it's missing symbols and docs fixes, though.
Comment 17 Emmanuele Bassi (:ebassi) 2013-05-06 18:14:08 UTC
Review of attachment 243231 [details] [review]:

looks good.
Comment 18 Erick Perez Castellanos 2013-05-07 19:15:38 UTC
Created attachment 243529 [details] [review]
flow-layout: Add snap_to_grid. Clutter-1.16 branch

Added doc and clutter.symbols fix.
Comment 19 Emmanuele Bassi (:ebassi) 2013-05-07 20:07:42 UTC
Review of attachment 243529 [details] [review]:

looks good.
Comment 20 Emmanuele Bassi (:ebassi) 2013-05-13 19:20:44 UTC
everything landed in master