-static gint
-get_base_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode)
-{
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- {
- if (aux_info && aux_info->width > 0)
- return aux_info->width;
- else
- {
- /* XXX Possibly we should be using natural values and not minimums here. */
- gint width;
-
- gtk_size_request_get_width (GTK_SIZE_REQUEST (widget), &width, NULL);
-
- return width;
- }
- }
- else
- {
- if (aux_info && aux_info->height > 0)
- return aux_info->height;
- else
- {
- /* XXX Possibly we should be using natural values and not minimums here. */
- gint height;
-
- gtk_size_request_get_height (GTK_SIZE_REQUEST (widget), &height, NULL);
-
- return height;
- }
- }
-}
-
-static gint
-compute_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint widget_requisition)
-{
- GSList *widgets = NULL;
- GSList *groups = NULL;
- GSList *tmp_list;
- gint result = 0;
-
- add_widget_to_closure (widget, mode, &groups, &widgets);
-
- g_slist_foreach (widgets, (GFunc)mark_unvisited, NULL);
- g_slist_foreach (groups, (GFunc)mark_unvisited, NULL);
-
- g_slist_foreach (widgets, (GFunc)g_object_ref, NULL);
-
- if (!groups)
- {
- result = widget_requisition;
- }
- else
- {
- GtkSizeGroup *group = groups->data;
- GtkSizeGroupPriv *priv = group->priv;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL && priv->have_width)
- result = priv->requisition.width;
- else if (mode == GTK_SIZE_GROUP_VERTICAL && priv->have_height)
- result = priv->requisition.height;
- else
- {
- tmp_list = widgets;
- while (tmp_list)
- {
- GtkWidget *tmp_widget = tmp_list->data;
- gint dimension;
-
- if (tmp_widget == widget)
- dimension = widget_requisition;
- else
- dimension = get_base_dimension (tmp_widget, mode);
-
- if (gtk_widget_get_mapped (tmp_widget) || !priv->ignore_hidden)
- {
- if (dimension > result)
- result = dimension;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = groups;
- while (tmp_list)
- {
- GtkSizeGroup *tmp_group = tmp_list->data;
- GtkSizeGroupPriv *tmp_priv = tmp_group->priv;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- {
- tmp_priv->have_width = TRUE;
- tmp_priv->requisition.width = result;
- }
- else
- {
- tmp_priv->have_height = TRUE;
- tmp_priv->requisition.height = result;
- }
-
- tmp_list = tmp_list->next;
- }
- }
- }
-
- g_slist_foreach (widgets, (GFunc)g_object_unref, NULL);
-
- g_slist_free (widgets);
- g_slist_free (groups);
-
- return result;
-}
-
-/**
- * _gtk_size_group_bump_requisition:
- * @widget: a #GtkWidget
- * @mode: either %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_VERTICAL, depending
- * on the dimension in which to bump the size.
- *
- * Refreshes the sizegroup while returning the groups requested
- * value in the dimension @mode.
- *
- * This function is used to update sizegroup minimum size information
- * in multiple passes from the new #GtkSizeRequest manager.
- */
-gint
-_gtk_size_group_bump_requisition (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint widget_requisition)
-{
- gint result = widget_requisition;
-
- if (!is_bumping (widget))
- {
- GtkWidgetAuxInfo *aux_info =
- _gtk_widget_get_aux_info (widget, FALSE);
-
- /* Avoid recursion here */
- mark_bumping (widget, TRUE);
-
- if (get_size_groups (widget))
- {
- if (aux_info)
- {
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- result = compute_dimension (widget, mode, MAX (aux_info->width, widget_requisition));
- else
- result = compute_dimension (widget, mode, MAX (aux_info->height, widget_requisition));
- }
- else
- result = compute_dimension (widget, mode, widget_requisition);
- }
- else if (aux_info)
- {
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- result = MAX (aux_info->width, widget_requisition);
- else
- result = MAX (aux_info->height, widget_requisition);
- }
- mark_bumping (widget, FALSE);
- }
- return result;
-}
-
-
-