diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2015-09-03 14:15:11 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2015-09-03 14:18:33 +0100 |
commit | 7ed96aabd8c3703f5b0572ee7f000821a25d019d (patch) | |
tree | 6615be075c56cec0f4d4ba15c647bc6d60e6c7bf | |
parent | 8a7304ee7d86fd3649a754a059a596c39792a97d (diff) | |
download | clutter-7ed96aabd8c3703f5b0572ee7f000821a25d019d.tar.gz |
grid: Use the proper orientation for the request mode
We automatically switch the request mode of the container depending on
the GridLayout's orientation, but we need to keep track of the request
mode during allocation, so that we don't get out of sync if the user
changed the request mode after adding the layout manager.
This change also brings us closer to the code in GtkGrid.
-rw-r--r-- | clutter/clutter-grid-layout.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/clutter/clutter-grid-layout.c b/clutter/clutter-grid-layout.c index ad0320368..f39e58d78 100644 --- a/clutter/clutter-grid-layout.c +++ b/clutter/clutter-grid-layout.c @@ -1397,7 +1397,7 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout, ClutterAllocationFlags flags) { ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout); - ClutterGridLayoutPrivate *priv = self->priv; + ClutterOrientation orientation; ClutterGridRequest request; ClutterGridLines *lines; ClutterActorIter iter; @@ -1414,10 +1414,16 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout, lines->lines = g_newa (ClutterGridLine, lines->max - lines->min); memset (lines->lines, 0, (lines->max - lines->min) * sizeof (ClutterGridLine)); - clutter_grid_request_run (&request, 1 - priv->orientation, FALSE); - clutter_grid_request_allocate (&request, 1 - priv->orientation, GET_SIZE (allocation, 1 - priv->orientation)); - clutter_grid_request_run (&request, priv->orientation, TRUE); - clutter_grid_request_allocate (&request, priv->orientation, GET_SIZE (allocation, priv->orientation)); + if (clutter_actor_get_request_mode (CLUTTER_ACTOR (container)) == CLUTTER_REQUEST_WIDTH_FOR_HEIGHT) + orientation = CLUTTER_ORIENTATION_HORIZONTAL; + else + orientation = CLUTTER_ORIENTATION_VERTICAL; + + clutter_grid_request_run (&request, 1 - orientation, FALSE); + clutter_grid_request_allocate (&request, 1 - orientation, GET_SIZE (allocation, 1 - orientation)); + clutter_grid_request_run (&request, orientation, TRUE); + + clutter_grid_request_allocate (&request, orientation, GET_SIZE (allocation, orientation)); clutter_grid_request_position (&request, 0); clutter_grid_request_position (&request, 1); |