+ border_width = gtk_bin_get_effective_border_width (bin);
+ *minimum_height += 2 * border_width;
+ *natural_height += 2 * border_width;
+}
+
+static void
+gtk_bin_get_preferred_width_for_height (GtkWidget *widget,
+ gint height,
+ gint *minimum_width,
+ gint *natural_width)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkBinPrivate *priv = bin->priv;
+ gint border_width;
+
+ border_width = gtk_bin_get_effective_border_width (bin);
+
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ {
+ gint child_min, child_nat;
+ gtk_widget_get_preferred_width_for_height (priv->child, height - 2 * border_width,
+ &child_min, &child_nat);
+
+ *minimum_width = child_min;
+ *natural_width = child_nat;
+ }
+
+ *minimum_width += 2 * border_width;
+ *natural_width += 2 * border_width;
+}
+
+static void
+gtk_bin_get_preferred_height_for_width (GtkWidget *widget,
+ gint width,
+ gint *minimum_height,
+ gint *natural_height)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkBinPrivate *priv = bin->priv;
+ gint border_width;
+
+ border_width = gtk_bin_get_effective_border_width (bin);
+
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ {
+ gint child_min, child_nat;
+ gtk_widget_get_preferred_height_for_width (priv->child, width - 2 * border_width,
+ &child_min, &child_nat);
+
+ *minimum_height = child_min;
+ *natural_height = child_nat;
+ }
+
+ *minimum_height += 2 * border_width;
+ *natural_height += 2 * border_width;
+}
+
+static void
+gtk_bin_size_allocate (GtkWidget *widget,
+ GtkAllocation *allocation)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkBinPrivate *priv = bin->priv;
+
+ gtk_widget_set_allocation (widget, allocation);
+
+ if (priv->child && gtk_widget_get_visible (priv->child))
+ {
+ GtkAllocation child_allocation;
+ gint border_width = gtk_bin_get_effective_border_width (bin);
+
+ child_allocation.x = allocation->x + border_width;
+ child_allocation.y = allocation->y + border_width;
+ child_allocation.width = allocation->width - 2 * border_width;
+ child_allocation.height = allocation->height - 2 * border_width;
+
+ gtk_widget_size_allocate (priv->child, &child_allocation);
+ }