- return size_group->widgets;
-}
-
-static void
-get_base_dimensions (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint *minimum_size,
- gint *natural_size)
-{
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- {
- if (minimum_size)
- {
- if (aux_info && aux_info->width > 0)
- *minimum_size = aux_info->width;
- else
- *minimum_size = widget->requisition.width;
- }
-
- if (natural_size)
- {
- if (aux_info)
- *natural_size = aux_info->natural_size.width;
- else
- *natural_size = widget->requisition.width;
- }
- }
- else
- {
- if (minimum_size)
- {
- if (aux_info && aux_info->height > 0)
- *minimum_size = aux_info->height;
- else
- *minimum_size = widget->requisition.height;
- }
-
- if (natural_size)
- {
- if (aux_info)
- *natural_size = aux_info->natural_size.height;
- else
- *natural_size = widget->requisition.height;
- }
- }
-}
-
-static void
-do_size_request (GtkWidget *widget)
-{
- if (GTK_WIDGET_REQUEST_NEEDED (widget))
- {
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, TRUE);
- GtkRequisition extended_minimum;
-
- gtk_widget_ensure_style (widget);
- GTK_PRIVATE_UNSET_FLAG (widget, GTK_REQUEST_NEEDED);
-
- /* First, allow client code to; extended classes or signal connections; to
- * modify the initial size request.
- *
- * Note here that there is no convention of filling the argument or widget->requisition,
- * so we have no choice but to fire size request with this pointer.
- */
- g_signal_emit_by_name (widget, "size-request", &widget->requisition);
-
- /* Now get the extended layout minimum and natural size
- */
- extended_minimum.width = 0;
- extended_minimum.height = 0;
-
- GTK_EXTENDED_LAYOUT_GET_IFACE
- (widget)->get_desired_size (GTK_EXTENDED_LAYOUT (widget),
- &extended_minimum,
- &aux_info->natural_size);
-
- /* Base the base widget requisition on both the size-requst and the extended layout size
- */
- widget->requisition.width = MAX (widget->requisition.width, extended_minimum.width);
- widget->requisition.height = MAX (widget->requisition.height, extended_minimum.height);
-
- /* Additionally allow a "size-request" to overflow the natural size.
- */
- aux_info->natural_size.width = MAX (aux_info->natural_size.width, widget->requisition.width);
- aux_info->natural_size.height = MAX (aux_info->natural_size.height, widget->requisition.height);
-
- /* Assert that pure extended layout cases return initial minimum sizes smaller or equal
- * to their possible natural size.
- *
- * Note that this only determines the return of gtk_widget_get_desired_size() and caches
- * the initial hints. Height for width cases will further be addressed in containers
- * using gtk_extended_layout_get_height_for_width().
- */
- g_assert (widget->requisition.width <= aux_info->natural_size.width);
- g_assert (widget->requisition.height <= aux_info->natural_size.height);
-
- }
-}
-
-static void
-compute_base_dimensions (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint *minimum_size,
- gint *natural_size)
-{
- do_size_request (widget);
- get_base_dimensions (widget, mode, minimum_size, natural_size);
-}
-
-static void
-compute_dimension (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint *minimum_size,
- gint *natural_size)
-{
- GSList *widgets = NULL;
- GSList *groups = NULL;
- GSList *tmp_list;
-
- 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)
- {
- compute_base_dimensions (widget, mode, minimum_size, natural_size);
- }
- else
- {
- GtkSizeGroup *group = groups->data;
- GtkSizeGroupPrivate *priv = GTK_SIZE_GROUP_GET_PRIVATE (group);
-
- gint result_minimum_size = 0;
- gint result_natural_size = 0;
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
- {
- result_minimum_size = group->requisition.width;
- result_natural_size = priv->natural_size.width;
- }
- else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
- {
- result_minimum_size = group->requisition.height;
- result_natural_size = priv->natural_size.height;
- }
- else
- {
- tmp_list = widgets;
- while (tmp_list)
- {
- GtkWidget *tmp_widget = tmp_list->data;
-
- gint tmp_widget_minimum_size;
- gint tmp_widget_natural_size;
-
- compute_base_dimensions (tmp_widget, mode,
- &tmp_widget_minimum_size,
- &tmp_widget_natural_size);
-
- if (gtk_widget_get_mapped (tmp_widget) || !group->ignore_hidden)
- {
- if (result_minimum_size < tmp_widget_minimum_size)
- result_minimum_size = tmp_widget_minimum_size;
- if (result_natural_size < tmp_widget_natural_size)
- result_natural_size = tmp_widget_natural_size;
- }
-
- tmp_list = tmp_list->next;
- }
-
- tmp_list = groups;
- while (tmp_list)
- {
- GtkSizeGroup *tmp_group = tmp_list->data;
- GtkSizeGroupPrivate *tmp_priv = GTK_SIZE_GROUP_GET_PRIVATE (tmp_group);
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL)
- {
- tmp_group->have_width = TRUE;
- tmp_group->requisition.width = result_minimum_size;
- tmp_priv->natural_size.width = result_natural_size;
- }
- else
- {
- tmp_group->have_height = TRUE;
- tmp_group->requisition.height = result_minimum_size;
- tmp_priv->natural_size.height = result_natural_size;
- }
-
- tmp_list = tmp_list->next;
- }
- }
-
- if (minimum_size)
- *minimum_size = result_minimum_size;
- if (natural_size)
- *natural_size = result_natural_size;
- }
-
- g_slist_foreach (widgets, (GFunc)g_object_unref, NULL);
-
- g_slist_free (widgets);
- g_slist_free (groups);
-}
-
-static void
-get_dimensions (GtkWidget *widget,
- GtkSizeGroupMode mode,
- gint *minimum_size,
- gint *natural_size)
-{
- GSList *widgets = NULL;
- GSList *groups = NULL;
-
- add_widget_to_closure (widget, mode, &groups, &widgets);
-
- g_slist_foreach (widgets, (GFunc)mark_unvisited, NULL);
- g_slist_foreach (groups, (GFunc)mark_unvisited, NULL);
-
- if (!groups)
- {
- get_base_dimensions (widget, mode, minimum_size, natural_size);
- }
- else
- {
- GtkSizeGroup *group = groups->data;
- GtkSizeGroupPrivate *priv = GTK_SIZE_GROUP_GET_PRIVATE (group);
-
- if (mode == GTK_SIZE_GROUP_HORIZONTAL && group->have_width)
- {
- if (minimum_size)
- *minimum_size = group->requisition.width;
- if (natural_size)
- *natural_size = priv->natural_size.width;
- }
- else if (mode == GTK_SIZE_GROUP_VERTICAL && group->have_height)
- {
- if (minimum_size)
- *minimum_size = group->requisition.height;
- if (natural_size)
- *natural_size = priv->natural_size.height;
- }
- }
-
- g_slist_free (widgets);
- g_slist_free (groups);
-}
-
-static void
-get_fast_size (GtkWidget *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size)
-{
- GtkWidgetAuxInfo *aux_info = _gtk_widget_get_aux_info (widget, FALSE);
-
- if (minimum_size)
- {
- *minimum_size = widget->requisition;
-
- if (aux_info)
- {
- if (aux_info->width > 0)
- minimum_size->width = aux_info->width;
- if (aux_info->height > 0)
- minimum_size->height = aux_info->height;
- }
- }
-
- if (natural_size)
- {
- if (aux_info)
- {
- *natural_size = aux_info->natural_size;
-
- /* Explicit size request sets the baseline for natural size
- * as well as the minimum size
- */
- if (aux_info->width > natural_size->width)
- natural_size->width = aux_info->width;
- if (aux_info->height > natural_size->height)
- natural_size->height = aux_info->height;
- }
- else
- *natural_size = widget->requisition;
- }
-}
-
-/**
- * _gtk_size_group_get_child_requisition:
- * @widget: a #GtkWidget
- * @requisition: location to store computed requisition.
- *
- * Retrieve the "child requisition" of the widget, taking account grouping
- * of the widget's requisition with other widgets.
- *
- * Deprecated: 3.0: Use _gtk_size_group_compute_desired_size() instead
- **/
-void
-_gtk_size_group_get_child_requisition (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- initialize_size_group_quarks ();
-
- if (requisition)
- {
- if (get_size_groups (widget))
- {
- get_dimensions (widget, GTK_SIZE_GROUP_HORIZONTAL, &requisition->width, NULL);
- get_dimensions (widget, GTK_SIZE_GROUP_VERTICAL, &requisition->height, NULL);
-
- /* Only do the full computation if we actually have size groups */
- }
- else
- get_fast_size (widget, requisition, NULL);
- }
-}
-
-/**
- * _gtk_size_group_compute_desired_size:
- * @widget: a #GtkWidget
- * @minimum_size: location to store computed minimum size
- * @natural_size: location to store computed natural size
- *
- * Compute the desired size of a widget taking into account grouping of
- * the widget's requisition with other widgets.
- **/
-void
-_gtk_size_group_compute_desired_size (GtkWidget *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size)
-{
- initialize_size_group_quarks ();
-
- if (get_size_groups (widget))
- {
- /* Only do the full computation if we actually have size groups */
-
- compute_dimension (widget, GTK_SIZE_GROUP_HORIZONTAL,
- minimum_size ? &minimum_size->width : NULL,
- natural_size ? &natural_size->width : NULL);
- compute_dimension (widget, GTK_SIZE_GROUP_VERTICAL,
- minimum_size ? &minimum_size->height : NULL,
- natural_size ? &natural_size->height : NULL);
- }
- else
- {
- do_size_request (widget);
-
- get_fast_size (widget, minimum_size, natural_size);
- }