- if (!viewport->vadjustment)
- gtk_viewport_set_vadjustment (viewport, NULL);
-
- return viewport->vadjustment;
-}
-
-static void
-viewport_get_view_allocation (GtkViewport *viewport,
- GtkAllocation *view_allocation)
-{
- GtkWidget *widget = GTK_WIDGET (viewport);
- GtkAllocation *allocation = &widget->allocation;
- guint border_width;
-
- border_width = gtk_container_get_border_width (GTK_CONTAINER (viewport));
-
- view_allocation->x = 0;
- view_allocation->y = 0;
-
- if (viewport->shadow_type != GTK_SHADOW_NONE)
- {
- view_allocation->x = widget->style->xthickness;
- view_allocation->y = widget->style->ythickness;
- }
-
- view_allocation->width = MAX (1, allocation->width - view_allocation->x * 2 - border_width * 2);
- view_allocation->height = MAX (1, allocation->height - view_allocation->y * 2 - border_width * 2);
-}
-
-static void
-viewport_reclamp_adjustment (GtkAdjustment *adjustment,
- gboolean *value_changed)
-{
- gdouble value = adjustment->value;
-
- value = CLAMP (value, 0, adjustment->upper - adjustment->page_size);
- if (value != adjustment->value)
- {
- adjustment->value = value;
- if (value_changed)
- *value_changed = TRUE;
- }
- else if (value_changed)
- *value_changed = FALSE;