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.
This commit is contained in:
parent
8a7304ee7d
commit
7ed96aabd8
1 changed files with 11 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue