summaryrefslogtreecommitdiff
path: root/gtk/gtkviewport.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>1998-03-24 01:43:21 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-03-24 01:43:21 +0000
commit34e324ca708cd83b03e3d526f9defbe2e0f1d90c (patch)
tree47291ccec103012539f7e2a145d553d0f1e9723a /gtk/gtkviewport.c
parent7bd32a06cf0e5ad85445f5d7dfbe6db88caa9331 (diff)
downloadgtk+-34e324ca708cd83b03e3d526f9defbe2e0f1d90c.tar.gz
/home/otaylor/commit
Diffstat (limited to 'gtk/gtkviewport.c')
-rw-r--r--gtk/gtkviewport.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 08e5d27a28..ed8c202b2f 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -391,6 +391,7 @@ gtk_viewport_draw (GtkWidget *widget,
GtkBin *bin;
GdkRectangle tmp_area;
GdkRectangle child_area;
+ gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
@@ -401,13 +402,18 @@ gtk_viewport_draw (GtkWidget *widget,
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
- gtk_viewport_paint (widget, area);
+ border_width = GTK_CONTAINER (widget)->border_width;
+
+ tmp_area = *area;
+ tmp_area.x -= border_width;
+ tmp_area.y -= border_width;
+
+ gtk_viewport_paint (widget, &tmp_area);
if (bin->child)
{
- tmp_area = *area;
- tmp_area.x += viewport->hadjustment->value;
- tmp_area.y += viewport->vadjustment->value;
+ tmp_area.x += viewport->hadjustment->value - widget->style->klass->xthickness;
+ tmp_area.y += viewport->vadjustment->value - widget->style->klass->ythickness;
if (gtk_widget_intersect (bin->child, &tmp_area, &child_area))
gtk_widget_draw (bin->child, &child_area);
@@ -508,6 +514,7 @@ gtk_viewport_size_allocate (GtkWidget *widget,
GtkBin *bin;
GtkAllocation child_allocation;
gint hval, vval;
+ gint border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (widget));
@@ -517,6 +524,8 @@ gtk_viewport_size_allocate (GtkWidget *widget,
viewport = GTK_VIEWPORT (widget);
bin = GTK_BIN (widget);
+ border_width = GTK_CONTAINER (widget)->border_width;
+
child_allocation.x = 0;
child_allocation.y = 0;
@@ -526,16 +535,16 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
}
- child_allocation.width = allocation->width - child_allocation.x * 2;
- child_allocation.height = allocation->height - child_allocation.y * 2;
+ child_allocation.width = allocation->width - child_allocation.x * 2 - border_width * 2;
+ child_allocation.height = allocation->height - child_allocation.y * 2 - border_width * 2;
if (GTK_WIDGET_REALIZED (widget))
{
gdk_window_move_resize (widget->window,
- allocation->x + GTK_CONTAINER (viewport)->border_width,
- allocation->y + GTK_CONTAINER (viewport)->border_width,
- allocation->width - GTK_CONTAINER (viewport)->border_width * 2,
- allocation->height - GTK_CONTAINER (viewport)->border_width * 2);
+ allocation->x + border_width,
+ allocation->y + border_width,
+ allocation->width - border_width * 2,
+ allocation->height - border_width * 2);
gdk_window_move_resize (viewport->view_window,
child_allocation.x,