+gtk_pizza_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkPizza *pizza;
+ GtkPizzaChild *child;
+ GList *children;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_PIZZA (container));
+ g_return_if_fail (callback != (GtkCallback)NULL);
+
+ pizza = GTK_PIZZA (container);
+
+ children = pizza->children;
+ while (children)
+ {
+ child = children->data;
+ children = children->next;
+
+ (* callback) (child->widget, callback_data);
+ }
+}
+
+static void
+gtk_pizza_allocate_child (GtkPizza *pizza,
+ GtkPizzaChild *child)
+{
+ GtkAllocation allocation;
+ GtkRequisition requisition;
+
+ allocation.x = child->x - pizza->xoffset;
+ allocation.y = child->y - pizza->yoffset;
+ gtk_widget_get_child_requisition (child->widget, &requisition);
+ allocation.width = requisition.width;
+ allocation.height = requisition.height;
+
+ gtk_widget_size_allocate (child->widget, &allocation);
+}
+
+static void
+gtk_pizza_adjust_allocations_recurse (GtkWidget *widget,
+ gpointer cb_data)
+{
+ GtkPizzaAdjData *data = cb_data;
+
+ widget->allocation.x += data->dx;
+ widget->allocation.y += data->dy;
+
+ if (GTK_WIDGET_NO_WINDOW (widget) && GTK_IS_CONTAINER (widget))
+ {
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_pizza_adjust_allocations_recurse,
+ cb_data);
+ }
+}
+
+static void
+gtk_pizza_adjust_allocations (GtkPizza *pizza,
+ gint dx,
+ gint dy)
+{
+ GList *tmp_list;
+ GtkPizzaAdjData data;
+
+ data.dx = dx;
+ data.dy = dy;
+
+ tmp_list = pizza->children;
+ while (tmp_list)
+ {
+ GtkPizzaChild *child = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ child->widget->allocation.x += dx;
+ child->widget->allocation.y += dy;
+
+ if (GTK_WIDGET_NO_WINDOW (child->widget) &&
+ GTK_IS_CONTAINER (child->widget))
+ {
+ gtk_container_forall (GTK_CONTAINER (child->widget),
+ gtk_pizza_adjust_allocations_recurse,
+ &data);
+ }
+ }
+}
+
+static void
+gtk_pizza_position_child (GtkPizza *pizza,
+ GtkPizzaChild *child)
+{
+ gint x;
+ gint y;
+
+ x = child->x - pizza->xoffset;
+ y = child->y - pizza->yoffset;
+
+ if (IS_ONSCREEN (x,y))
+ {
+ if (GTK_WIDGET_MAPPED (pizza) &&
+ GTK_WIDGET_VISIBLE (child->widget))
+ {
+ if (!GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
+ }
+
+ if (GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_UNSET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+ }
+ else
+ {
+ if (!GTK_WIDGET_IS_OFFSCREEN (child->widget))
+ GTK_PRIVATE_SET_FLAG (child->widget, GTK_IS_OFFSCREEN);
+
+ if (GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_unmap (child->widget);
+ }
+}
+
+static void
+gtk_pizza_position_children (GtkPizza *pizza)
+{
+ GList *tmp_list;
+
+ tmp_list = pizza->children;
+ while (tmp_list)
+ {
+ GtkPizzaChild *child = tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ gtk_pizza_position_child (pizza, child);
+ }
+}
+
+/* This function is used to find events to process while scrolling */
+static Bool
+gtk_pizza_expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
+{
+ if ((xevent->type == Expose) ||
+ ((xevent->xany.window == *(Window *)arg) &&
+ (xevent->type == ConfigureNotify)))
+ return True;
+ else
+ return False;
+}
+
+/* This is the main routine to do the scrolling. Scrolling is
+ * done by "Guffaw" scrolling, as in the Mozilla XFE, with
+ * a few modifications.
+ *
+ * The main improvement is that we keep track of whether we
+ * are obscured or not. If not, we ignore the generated expose
+ * events and instead do the exposes ourself, without having
+ * to wait for a roundtrip to the server. This also provides
+ * a limited form of expose-event compression, since we do
+ * the affected area as one big chunk.
+ */
+
+void
+gtk_pizza_scroll (GtkPizza *pizza, gint dx, gint dy)