Index: gtk/gtkmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkmenuitem.c,v
retrieving revision 1.89
diff -u -b -B -p -r1.89 gtkmenuitem.c
--- gtk/gtkmenuitem.c	20 Oct 2002 22:29:57 -0000	1.89
+++ gtk/gtkmenuitem.c	27 Oct 2002 23:00:33 -0000
@@ -222,6 +222,9 @@ gtk_menu_item_init (GtkMenuItem *menu_it
   menu_item->toggle_size = 0;
   menu_item->accelerator_width = 0;
   menu_item->show_submenu_indicator = FALSE;
+  if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
+    menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+  else
   menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
   menu_item->submenu_placement = GTK_TOP_BOTTOM;
   menu_item->right_justify = FALSE;
@@ -463,6 +466,9 @@ gtk_menu_item_size_request (GtkWidget   
     {
       GtkRequisition child_requisition;
       
+      if (GTK_IS_ACCEL_LABEL (bin->child))
+	gtk_accel_label_refetch (GTK_ACCEL_LABEL (bin->child));
+
       gtk_widget_size_request (bin->child, &child_requisition);
 
       requisition->width += child_requisition.width;
@@ -486,6 +492,7 @@ gtk_menu_item_size_allocate (GtkWidget  
   GtkMenuItem *menu_item;
   GtkBin *bin;
   GtkAllocation child_allocation;
+  GtkTextDirection direction;
 
   g_return_if_fail (GTK_IS_MENU_ITEM (widget));
   g_return_if_fail (allocation != NULL);
@@ -493,6 +500,8 @@ gtk_menu_item_size_allocate (GtkWidget  
   menu_item = GTK_MENU_ITEM (widget);
   bin = GTK_BIN (widget);
   
+  direction = gtk_widget_get_direction (widget);
+
   widget->allocation = *allocation;
 
   if (bin->child)
@@ -506,6 +515,7 @@ gtk_menu_item_size_allocate (GtkWidget  
 			    widget->style->ythickness);
       child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
       child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
+      if (direction == GTK_TEXT_DIR_LTR)
       child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
       child_allocation.width -= GTK_MENU_ITEM (widget)->toggle_size;
       child_allocation.x += widget->allocation.x;
@@ -513,7 +523,11 @@ gtk_menu_item_size_allocate (GtkWidget  
 
       gtk_widget_get_child_requisition (bin->child, &child_requisition);
       if (menu_item->submenu && menu_item->show_submenu_indicator)
+	{
+	  if (direction == GTK_TEXT_DIR_RTL)
+	    child_allocation.x += child_requisition.height;
 	child_allocation.width -= child_requisition.height;
+	}
 
       if (child_allocation.width < 1)
 	child_allocation.width = 1;
@@ -638,6 +652,10 @@ gtk_menu_item_paint (GtkWidget    *widge
 	  gint arrow_x, arrow_y;
 	  gint arrow_size;
 	  gint arrow_extent;
+	  GtkTextDirection direction;
+	  GtkArrowType arrow_type;
+
+	  direction = gtk_widget_get_direction (widget);
 
 	  gtk_widget_get_child_requisition (GTK_BIN (menu_item)->child,
 					    &child_requisition);
@@ -649,13 +667,21 @@ gtk_menu_item_paint (GtkWidget    *widge
 	  if (state_type == GTK_STATE_PRELIGHT)
 	    shadow_type = GTK_SHADOW_IN;
 
+	  if (direction == GTK_TEXT_DIR_LTR) {
 	  arrow_x = x + width - 1 - arrow_size + (arrow_size - arrow_extent) / 2;
+	    arrow_type = GTK_ARROW_RIGHT;
+	  }
+	  else {
+	    arrow_x = x + 1 + (arrow_size - arrow_extent) / 2;
+	    arrow_type = GTK_ARROW_LEFT;
+	  }
+
 	  arrow_y = y + (height - arrow_extent) / 2;
 
 	  gtk_paint_arrow (widget->style, widget->window,
 			   state_type, shadow_type, 
 			   area, widget, "menuitem", 
-			   GTK_ARROW_RIGHT, TRUE,
+			   arrow_type, TRUE,
 			   arrow_x, arrow_y,
 			   arrow_extent, arrow_extent);
 	}
@@ -869,24 +895,24 @@ gtk_menu_item_select_timeout (gpointer d
 static void
 gtk_menu_item_popup_submenu (gpointer data)
 {
+  GtkWidget *widget;
   GtkMenuItem *menu_item;
 
-  menu_item = GTK_MENU_ITEM (data);
+  widget = GTK_WIDGET (data);
+  menu_item = GTK_MENU_ITEM (widget);
 
   if (menu_item->timer)
     gtk_timeout_remove (menu_item->timer);
   menu_item->timer = 0;
 
   if (GTK_WIDGET_IS_SENSITIVE (menu_item->submenu))
-    {
       gtk_menu_popup (GTK_MENU (menu_item->submenu),
-		      GTK_WIDGET (menu_item)->parent,
-		      GTK_WIDGET (menu_item),
+		    widget->parent,
+		    widget,
 		      gtk_menu_item_position_menu,
 		      menu_item,
-		      GTK_MENU_SHELL (GTK_WIDGET (menu_item)->parent)->button,
+		    GTK_MENU_SHELL (widget->parent)->button,
 		      0);
-    }
 }
 
 static void
@@ -904,6 +930,7 @@ gtk_menu_item_position_menu (GtkMenu  *m
   gint screen_height;
   gint twidth, theight;
   gint tx, ty;
+  GtkTextDirection direction;
 
   g_return_if_fail (menu != NULL);
   g_return_if_fail (x != NULL);
@@ -912,6 +939,8 @@ gtk_menu_item_position_menu (GtkMenu  *m
   menu_item = GTK_MENU_ITEM (user_data);
   widget = GTK_WIDGET (user_data);
 
+  direction = gtk_widget_get_direction (widget);
+
   twidth = GTK_WIDGET (menu)->requisition.width;
   theight = GTK_WIDGET (menu)->requisition.height;
 
@@ -931,6 +960,14 @@ gtk_menu_item_position_menu (GtkMenu  *m
   switch (menu_item->submenu_placement)
     {
     case GTK_TOP_BOTTOM:
+      if (direction == GTK_TEXT_DIR_LTR)
+	menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+      else 
+	{
+	  menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+	  tx += widget->allocation.width - twidth;
+	}
+
       if ((ty + widget->allocation.height + theight) <= screen_height)
 	ty += widget->allocation.height;
       else if ((ty - theight) >= 0)
@@ -942,10 +979,13 @@ gtk_menu_item_position_menu (GtkMenu  *m
       break;
 
     case GTK_LEFT_RIGHT:
-      menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
       parent_menu_item = GTK_MENU (widget->parent)->parent_menu_item;
-      if (parent_menu_item)
+      if (parent_menu_item && !GTK_MENU (widget->parent)->torn_off)
 	menu_item->submenu_direction = GTK_MENU_ITEM (parent_menu_item)->submenu_direction;
+      else if (direction == GTK_TEXT_DIR_LTR)
+	menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+      else
+	menu_item->submenu_direction = GTK_DIRECTION_LEFT;
 
       switch (menu_item->submenu_direction)
 	{
Index: gtk/gtkimagemenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkimagemenuitem.c,v
retrieving revision 1.17
diff -u -b -B -p -r1.17 gtkimagemenuitem.c
--- gtk/gtkimagemenuitem.c	11 Oct 2002 20:36:13 -0000	1.17
+++ gtk/gtkimagemenuitem.c	27 Oct 2002 23:00:33 -0000
@@ -235,7 +235,7 @@ gtk_image_menu_item_size_allocate (GtkWi
 
   if (image_menu_item->image)
     {
-      gint width, height, x, y;
+      gint width, height, x, y, offset;
       GtkAllocation child_allocation;
       
       /* Man this is lame hardcoding action, but I can't
@@ -244,9 +244,14 @@ gtk_image_menu_item_size_allocate (GtkWi
       
       width = image_menu_item->image->requisition.width;
       height = image_menu_item->image->requisition.height;
+      offset = GTK_CONTAINER (image_menu_item)->border_width +
+	widget->style->xthickness; 
 
-      x = (GTK_CONTAINER (image_menu_item)->border_width +
-	   widget->style->xthickness) +
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) 
+	  x = offset + (GTK_MENU_ITEM (image_menu_item)->toggle_size - width) / 2;
+	else
+	x = widget->allocation.width - 
+	  GTK_MENU_ITEM (image_menu_item)->toggle_size - offset +
         (GTK_MENU_ITEM (image_menu_item)->toggle_size - width) / 2;
       y = (widget->allocation.height - height) / 2;
 
Index: gtk/gtkradiomenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkradiomenuitem.c,v
retrieving revision 1.24
diff -u -b -B -p -r1.24 gtkradiomenuitem.c
--- gtk/gtkradiomenuitem.c	5 Oct 2002 01:51:16 -0000	1.24
+++ gtk/gtkradiomenuitem.c	27 Oct 2002 23:00:33 -0000
@@ -306,6 +306,7 @@ gtk_radio_menu_item_draw_indicator (GtkC
   GtkShadowType shadow_type;
   gint width, height;
   gint x, y;
+  gint offset;
 
   g_return_if_fail (GTK_IS_RADIO_MENU_ITEM (check_menu_item));
 
@@ -315,8 +316,12 @@ gtk_radio_menu_item_draw_indicator (GtkC
 
       width = 8;
       height = 8;
-      x = widget->allocation.x + (GTK_CONTAINER (check_menu_item)->border_width +
-				  widget->style->xthickness + 2);
+      offset = GTK_CONTAINER (check_menu_item)->border_width +
+	widget->style->xthickness + 2;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) 
+	x = widget->allocation.x + offset;
+      else 
+	x = widget->allocation.x + widget->allocation.width - width - offset;
       y = widget->allocation.y + (widget->allocation.height - height) / 2;
 
       if (check_menu_item->active ||
Index: gtk/gtkcheckmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkcheckmenuitem.c,v
retrieving revision 1.41
diff -u -b -B -p -r1.41 gtkcheckmenuitem.c
--- gtk/gtkcheckmenuitem.c	5 Oct 2002 01:51:16 -0000	1.41
+++ gtk/gtkcheckmenuitem.c	27 Oct 2002 23:00:33 -0000
@@ -348,6 +348,7 @@ gtk_real_check_menu_item_draw_indicator 
   GtkShadowType shadow_type;
   gint width, height;
   gint x, y;
+  gint offset;
 
   if (GTK_WIDGET_DRAWABLE (check_menu_item))
     {
@@ -355,8 +356,12 @@ gtk_real_check_menu_item_draw_indicator 
 
       width = 8;
       height = 8;
-      x = widget->allocation.x + (GTK_CONTAINER (check_menu_item)->border_width +
-				  widget->style->xthickness + 2);
+      offset = GTK_CONTAINER (check_menu_item)->border_width +
+	widget->style->xthickness + 2;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) 
+	x = widget->allocation.x + offset;
+      else 
+	x = widget->allocation.x + widget->allocation.width - width - offset;
       y = widget->allocation.y + (widget->allocation.height - height) / 2;
 
       if (check_menu_item->active ||
Index: gtk/gtktearoffmenuitem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktearoffmenuitem.c,v
retrieving revision 1.13
diff -u -b -B -p -r1.13 gtktearoffmenuitem.c
--- gtk/gtktearoffmenuitem.c	16 Oct 2002 15:13:43 -0000	1.13
+++ gtk/gtktearoffmenuitem.c	27 Oct 2002 23:00:33 -0000
@@ -132,12 +132,16 @@ gtk_tearoff_menu_item_paint (GtkWidget  
   gint width, height;
   gint x, y;
   gint right_max;
+  GtkArrowType arrow_type;
+  GtkTextDirection direction;
 
   if (GTK_WIDGET_DRAWABLE (widget))
     {
       menu_item = GTK_MENU_ITEM (widget);
       tearoff_item = GTK_TEAROFF_MENU_ITEM (widget);
 
+      direction = gtk_widget_get_direction (widget);
+
       x = widget->allocation.x + GTK_CONTAINER (menu_item)->border_width;
       y = widget->allocation.y + GTK_CONTAINER (menu_item)->border_width;
       width = widget->allocation.width - x * 2;
@@ -172,12 +176,26 @@ gtk_tearoff_menu_item_paint (GtkWidget  
 
 	  if (menu_item->toggle_size > ARROW_SIZE)
 	    {
+	      if (direction == GTK_TEXT_DIR_LTR) {
 	      arrow_x = x + (menu_item->toggle_size - ARROW_SIZE)/2;
+		arrow_type = GTK_ARROW_LEFT;
+	      }
+	      else {
+		arrow_x = x + width - menu_item->toggle_size + (menu_item->toggle_size - ARROW_SIZE)/2; 
+		arrow_type = GTK_ARROW_RIGHT;	    
+	      }
 	      x += menu_item->toggle_size + BORDER_SPACING;
 	    }
 	  else
 	    {
+	      if (direction == GTK_TEXT_DIR_LTR) {
 	      arrow_x = ARROW_SIZE / 2;
+		arrow_type = GTK_ARROW_LEFT;
+	      }
+	      else {
+		arrow_x = x + width - 2 * ARROW_SIZE + ARROW_SIZE / 2; 
+		arrow_type = GTK_ARROW_RIGHT;	    
+	      }
 	      x += 2 * ARROW_SIZE;
 	    }
 	  
@@ -184,17 +203,27 @@ gtk_tearoff_menu_item_paint (GtkWidget  
 	  gtk_paint_arrow (widget->style, widget->window,
 			   widget->state, shadow_type,
 			   NULL, widget, "tearoffmenuitem",
-			   GTK_ARROW_LEFT, FALSE,
+			   arrow_type, FALSE,
 			   arrow_x, y + height / 2 - 5, 
 			   ARROW_SIZE, ARROW_SIZE);
 	}
 
       while (x < right_max)
 	{
+	  gint x1, x2;
+
+	  if (direction == GTK_TEXT_DIR_LTR) {
+	    x1 = x;
+	    x2 = MIN (x + TEAR_LENGTH, right_max);
+	  }
+	  else {
+	    x1 = right_max - x;
+	    x2 = MAX (right_max - x - TEAR_LENGTH, 0);
+	  }
+	  
 	  gtk_paint_hline (widget->style, widget->window, GTK_STATE_NORMAL,
 			   NULL, widget, "tearoffmenuitem",
-			   x, MIN (x + TEAR_LENGTH, right_max),
-			   y + (height - widget->style->ythickness) / 2);
+			   x1, x2, y + (height - widget->style->ythickness) / 2);
 	  x += 2 * TEAR_LENGTH;
 	}
     }
