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	26 Oct 2002 23:21:46 -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;
@@ -869,9 +894,12 @@ gtk_menu_item_select_timeout (gpointer d
 static void
 gtk_menu_item_popup_submenu (gpointer data)
 {
+  GtkWidget *widget;
+  GtkWidget *parent_menu_item;
   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);
@@ -879,12 +907,20 @@ gtk_menu_item_popup_submenu (gpointer da
 
   if (GTK_WIDGET_IS_SENSITIVE (menu_item->submenu))
     {
+      if (menu_item->submenu_placement == GTK_TOP_BOTTOM) 
+	{
+	  if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+	    menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+	  else
+	    menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+	}
+
       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);
     }
 }
@@ -904,6 +940,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 +949,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 +970,8 @@ gtk_menu_item_position_menu (GtkMenu  *m
   switch (menu_item->submenu_placement)
     {
     case GTK_TOP_BOTTOM:
+      if (direction == GTK_TEXT_DIR_RTL) 
+	tx += widget->allocation.width - twidth;
       if ((ty + widget->allocation.height + theight) <= screen_height)
 	ty += widget->allocation.height;
       else if ((ty - theight) >= 0)
@@ -942,10 +983,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)
 	menu_item->submenu_direction = GTK_MENU_ITEM (parent_menu_item)->submenu_direction;
+      else if (direction == GTK_TEXT_DIR_RTL)
+	menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+      else
+	menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
 
       switch (menu_item->submenu_direction)
 	{








