Index: gtkpaned.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkpaned.c,v
retrieving revision 1.59
diff -u -r1.59 gtkpaned.c
--- gtkpaned.c	3 Jul 2003 01:02:04 -0000	1.59
+++ gtkpaned.c	19 Sep 2003 14:23:24 -0000
@@ -733,6 +733,18 @@
   return FALSE;
 }
 
+static gboolean
+is_rtl (GtkPaned *paned)
+{
+  if (paned->orientation == GTK_ORIENTATION_VERTICAL &&
+      gtk_widget_get_direction (GTK_WIDGET (paned)) == GTK_TEXT_DIR_RTL)
+    {
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
 static void
 update_drag (GtkPaned *paned)
 {
@@ -745,9 +757,23 @@
   else
     gtk_widget_get_pointer (GTK_WIDGET (paned), &pos, NULL);
 
-  gtk_widget_style_get (GTK_WIDGET (paned), "handle_size", &handle_size, NULL);
+  pos -= paned->drag_pos;
+
+  if (is_rtl (paned))
+    {
+      gtk_widget_style_get (GTK_WIDGET (paned),
+			    "handle_size", &handle_size,
+			    NULL);
+      
+      size = GTK_WIDGET (paned)->allocation.width - pos - handle_size;
+    }
+  else
+    {
+      size = pos;
+    }
+
+  size -= GTK_CONTAINER (paned)->border_width;
   
-  size = pos - GTK_CONTAINER (paned)->border_width - paned->drag_pos;
   size = CLAMP (size, paned->min_position, paned->max_position);
 
   if (size != paned->child1_size)
@@ -1332,7 +1358,7 @@
 {
   GList *cycle_chain = NULL;
   GList *list;
-
+  
   GtkDirectionType direction = reversed? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD;
 
   /* ignore f6 if the handle is focused */
@@ -1429,38 +1455,40 @@
     {
       gint old_position;
       gint new_position;
+      gint increment;
       
       enum {
 	SINGLE_STEP_SIZE = 1,
 	PAGE_STEP_SIZE   = 75
       };
       
-      old_position = gtk_paned_get_position (paned);
+      new_position = old_position = gtk_paned_get_position (paned);
+      increment = 0;
       
       switch (scroll)
 	{
 	case GTK_SCROLL_STEP_LEFT:
 	case GTK_SCROLL_STEP_UP:
 	case GTK_SCROLL_STEP_BACKWARD:
-	  new_position = old_position - SINGLE_STEP_SIZE;
+	  increment = - SINGLE_STEP_SIZE;
 	  break;
 	  
 	case GTK_SCROLL_STEP_RIGHT:
 	case GTK_SCROLL_STEP_DOWN:
 	case GTK_SCROLL_STEP_FORWARD:
-	  new_position = old_position + SINGLE_STEP_SIZE;
+	  increment = SINGLE_STEP_SIZE;
 	  break;
 	  
 	case GTK_SCROLL_PAGE_LEFT:
 	case GTK_SCROLL_PAGE_UP:
 	case GTK_SCROLL_PAGE_BACKWARD:
-	  new_position = old_position - PAGE_STEP_SIZE;
+	  increment = - PAGE_STEP_SIZE;
 	  break;
 	  
 	case GTK_SCROLL_PAGE_RIGHT:
 	case GTK_SCROLL_PAGE_DOWN:
 	case GTK_SCROLL_PAGE_FORWARD:
-	  new_position = old_position + PAGE_STEP_SIZE;
+	  increment = PAGE_STEP_SIZE;
 	  break;
 	  
 	case GTK_SCROLL_START:
@@ -1470,10 +1498,17 @@
 	case GTK_SCROLL_END:
 	  new_position = paned->max_position;
 	  break;
-	  
+
 	default:
-	  new_position = old_position;
 	  break;
+	}
+
+      if (increment)
+	{
+	  if (is_rtl (paned))
+	    increment = -increment;
+	  
+	  new_position = old_position + increment;
 	}
       
       new_position = CLAMP (new_position, paned->min_position, paned->max_position);
Index: gtkhpaned.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkhpaned.c,v
retrieving revision 1.39
diff -u -r1.39 gtkhpaned.c
--- gtkhpaned.c	7 Nov 2002 19:53:49 -0000	1.39
+++ gtkhpaned.c	19 Sep 2003 14:23:25 -0000
@@ -138,6 +138,15 @@
 }
 
 static void
+flip_child (GtkWidget *widget, GtkAllocation *child_pos)
+{
+  gint x = widget->allocation.x;
+  gint width = widget->allocation.width;
+
+  child_pos->x = 2 * x + width - child_pos->x - child_pos->width;
+}
+
+static void
 gtk_hpaned_size_allocate (GtkWidget     *widget,
 			  GtkAllocation *allocation)
 {
@@ -171,6 +180,21 @@
       paned->handle_pos.y = widget->allocation.y + border_width;
       paned->handle_pos.width = handle_size;
       paned->handle_pos.height = MAX (1, widget->allocation.height - 2 * border_width);
+
+      child1_allocation.height = child2_allocation.height = MAX (1, (gint) allocation->height - border_width * 2);
+      child1_allocation.width = MAX (1, paned->child1_size);
+      child1_allocation.x = widget->allocation.x + border_width;
+      child1_allocation.y = child2_allocation.y = widget->allocation.y + border_width;
+      
+      child2_allocation.x = child1_allocation.x + paned->child1_size + paned->handle_pos.width;
+      child2_allocation.width = MAX (1, widget->allocation.x + widget->allocation.width - child2_allocation.x - border_width);
+
+      if (gtk_widget_get_direction (GTK_WIDGET (widget)) == GTK_TEXT_DIR_RTL)
+	{
+	  flip_child (widget, &(child2_allocation));
+	  flip_child (widget, &(child1_allocation));
+	  flip_child (widget, &(paned->handle_pos));
+	}
       
       if (GTK_WIDGET_REALIZED (widget))
 	{
@@ -183,14 +207,6 @@
 				  paned->handle_pos.height);
 	}
       
-      child1_allocation.height = child2_allocation.height = MAX (1, (gint) allocation->height - border_width * 2);
-      child1_allocation.width = MAX (1, paned->child1_size);
-      child1_allocation.x = widget->allocation.x + border_width;
-      child1_allocation.y = child2_allocation.y = widget->allocation.y + border_width;
-      
-      child2_allocation.x = child1_allocation.x + paned->child1_size + paned->handle_pos.width;
-      child2_allocation.width = MAX (1, widget->allocation.x + widget->allocation.width - child2_allocation.x - border_width);
-
       /* Now allocate the childen, making sure, when resizing not to
        * overlap the windows
        */
