Index: gtk/gtkviewport.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkviewport.c,v
retrieving revision 1.61
diff -u -b -B -p -r1.61 gtkviewport.c
--- gtk/gtkviewport.c	9 Oct 2002 00:36:28 -0000	1.61
+++ gtk/gtkviewport.c	25 May 2003 22:29:14 -0000
@@ -682,6 +682,7 @@ gtk_viewport_size_allocate (GtkWidget   
   GtkAllocation child_allocation;
   gint hval, vval;
   gint border_width = GTK_CONTAINER (widget)->border_width;
+  gdouble old_page_size;
 
   /* demand creation */
   if (!viewport->hadjustment)
@@ -727,6 +728,7 @@ gtk_viewport_size_allocate (GtkWidget   
 			      child_allocation.height);
     }
 
+  old_page_size = viewport->hadjustment->page_size;
   viewport->hadjustment->page_size = child_allocation.width;
   viewport->hadjustment->step_increment = child_allocation.width * 0.1;
   viewport->hadjustment->page_increment = child_allocation.width * 0.9;
@@ -747,6 +749,9 @@ gtk_viewport_size_allocate (GtkWidget   
       viewport->hadjustment->upper = MAX (child_requisition.width,
 					  child_allocation.width);
 
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) 
+	hval = (int)(hval + old_page_size - viewport->hadjustment->page_size);
+
       hval = CLAMP (hval, 0,
 		    viewport->hadjustment->upper -
 		    viewport->hadjustment->page_size);
@@ -773,8 +778,6 @@ gtk_viewport_size_allocate (GtkWidget   
 			   child_allocation.width,
 			   child_allocation.height);
 
-      child_allocation.x = 0;
-      child_allocation.y = 0;
       gtk_widget_size_allocate (bin->child, &child_allocation);
     }
 
