Index: gtk/gtkmenu.c
===================================================================
--- gtk/gtkmenu.c	(revision 17599)
+++ gtk/gtkmenu.c	(working copy)
@@ -1429,6 +1429,19 @@ gtk_menu_popup (GtkMenu		    *menu,
 
   gtk_menu_scroll_to (menu, menu->scroll_offset);
 
+  /* if no item is selected, select the first one */
+  if (!menu_shell->active_menu_item)
+    {
+      gboolean popup_on_click;
+
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
+                    "gtk-menu-popup-on-click", &popup_on_click,
+                    NULL);
+
+      if (popup_on_click)
+        gtk_menu_shell_select_first (menu_shell, TRUE);
+    }
+
   /* Once everything is set up correctly, map the toplevel window on
      the screen.
    */
@@ -2905,7 +2918,7 @@ gtk_menu_motion_notify  (GtkWidget	   *w
 
   if (definitely_within_item (menu_item, event->x, event->y))
     menu_shell->activate_time = 0;
-  
+
   need_enter = (menu->navigation_region != NULL || menu_shell->ignore_enter);
 
   /* Check to see if we are within an active submenu's navigation region
Index: gtk/gtkmenushell.c
===================================================================
--- gtk/gtkmenushell.c	(revision 17599)
+++ gtk/gtkmenushell.c	(working copy)
@@ -32,6 +32,7 @@
 #include "gtkkeyhash.h"
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
+#include "gtkmenu.h"
 #include "gtkmenubar.h"
 #include "gtkmenuitem.h"
 #include "gtkmenushell.h"
@@ -133,6 +134,7 @@ struct _GtkMenuShellPrivate
   GtkKeyHash *key_hash;
 
   gboolean take_focus;
+  gboolean activated_submenu;
 };
 
 static void gtk_menu_shell_set_property      (GObject           *object,
@@ -339,6 +341,12 @@ gtk_menu_shell_class_init (GtkMenuShellC
 							 TRUE,
 							 GTK_PARAM_READWRITE));
 
+  gtk_settings_install_property (g_param_spec_boolean ("gtk-menu-popup-on-click",
+						       P_("Open submenus on click"),
+						       P_("Whether submenus should open on click rather than on hovering the parent menu item with the mouse"),
+						       FALSE,
+						       GTK_PARAM_READWRITE));
+
   g_type_class_add_private (object_class, sizeof (GtkMenuShellPrivate));
 }
 
@@ -365,6 +373,7 @@ gtk_menu_shell_init (GtkMenuShell *menu_
   priv->mnemonic_hash = NULL;
   priv->key_hash = NULL;
   priv->take_focus = TRUE;
+  priv->activated_submenu = FALSE;
 }
 
 static void
@@ -517,29 +526,32 @@ static gint
 gtk_menu_shell_button_press (GtkWidget      *widget,
 			     GdkEventButton *event)
 {
+  GtkMenuShellPrivate *priv;
   GtkMenuShell *menu_shell;
   GtkWidget *menu_item;
-
-  g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
+  gboolean popup_on_click;
 
   if (event->type != GDK_BUTTON_PRESS)
     return FALSE;
 
   menu_shell = GTK_MENU_SHELL (widget);
+  priv = GTK_MENU_SHELL_GET_PRIVATE (widget);
+
+  g_object_get (gtk_widget_get_settings (widget),
+                "gtk-menu-popup-on-click", &popup_on_click,
+                NULL);
 
   if (menu_shell->parent_menu_shell)
-    {
-      return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
-    }
-  else if (!menu_shell->active || !menu_shell->button)
+    return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
+
+  menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);
+
+  if (!menu_shell->active || !menu_shell->button)
     {
       _gtk_menu_shell_activate (menu_shell);
       
       menu_shell->button = event->button;
 
-      menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent *)event);
-
       if (menu_item && _gtk_menu_item_is_selectable (menu_item))
 	{
 	  if ((menu_item->parent == widget) &&
@@ -564,6 +576,23 @@ gtk_menu_shell_button_press (GtkWidget  
 	}
     }
 
+  /* Activate submenu on button press, so that we can drag-move into it if
+   * necessary.
+   */
+  if (popup_on_click &&
+      menu_item && _gtk_menu_item_is_selectable (menu_item) &&
+      GTK_MENU_ITEM (menu_item)->submenu != NULL &&
+      !GTK_WIDGET_VISIBLE (GTK_MENU_ITEM (menu_item)->submenu))
+    {
+      if (GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT)
+        gtk_menu_shell_select_item (menu_shell, menu_item);
+
+      _gtk_menu_item_popup_submenu (menu_item, FALSE);
+
+      priv = GTK_MENU_SHELL_GET_PRIVATE (menu_item->parent);
+      priv->activated_submenu = TRUE;
+    }
+
   return TRUE;
 }
 
@@ -591,16 +620,17 @@ static gint
 gtk_menu_shell_button_release (GtkWidget      *widget,
 			       GdkEventButton *event)
 {
+  GtkMenuShellPrivate *priv;
   GtkMenuShell *menu_shell;
-  GtkWidget *menu_item;
-  gint deactivate;
-
-  g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
-  g_return_val_if_fail (event != NULL, FALSE);
 
   menu_shell = GTK_MENU_SHELL (widget);
+  priv = GTK_MENU_SHELL_GET_PRIVATE (widget);
+
   if (menu_shell->active)
     {
+      GtkWidget *menu_item;
+      gboolean   deactivate = TRUE;
+
       if (menu_shell->button && (event->button != menu_shell->button))
 	{
 	  menu_shell->button = 0;
@@ -611,63 +641,79 @@ gtk_menu_shell_button_release (GtkWidget
       menu_shell->button = 0;
       menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent*) event);
 
-      deactivate = TRUE;
-
       if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT)
-	{
-	  if (menu_item && (menu_shell->active_menu_item == menu_item) &&
-	      _gtk_menu_item_is_selectable (menu_item))
-	    {
-	      if (GTK_MENU_ITEM (menu_item)->submenu == NULL)
-		{
-		  gtk_menu_shell_activate_item (menu_shell, menu_item, TRUE);
-		  return TRUE;
-		}
-	      else if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
-		{
-		  gtk_menu_item_select (GTK_MENU_ITEM (menu_item));
-		  return TRUE;
-		}
-	    }
-	  else if (menu_item &&
-		   !_gtk_menu_item_is_selectable (menu_item) &&
-		   GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
-	    {
-	      deactivate = FALSE;
-	    }
-	  else if (menu_shell->parent_menu_shell)
-	    {
-	      menu_shell->active = TRUE;
-	      gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
-	      return TRUE;
-	    }
+        {
+          if (menu_item && (menu_shell->active_menu_item == menu_item) &&
+              _gtk_menu_item_is_selectable (menu_item))
+            {
+              if (GTK_MENU_ITEM (menu_item)->submenu == NULL)
+                {
+                  gtk_menu_shell_activate_item (menu_shell, menu_item, TRUE);
 
-	  /* If we ended up on an item with a submenu, leave the menu up.
-	   */
-	  if (menu_item && (menu_shell->active_menu_item == menu_item) &&
-	      GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
-	    {
-	      deactivate = FALSE;
-	    }
-	}
+                  deactivate = FALSE;
+                }
+              else
+                {
+                  gboolean popup_on_click;
+
+                  g_object_get (gtk_widget_get_settings (widget),
+                                "gtk-menu-popup-on-click", &popup_on_click,
+                                NULL);
+
+                  if (popup_on_click)
+                    {
+                      if (!priv->activated_submenu)
+                        _gtk_menu_item_popdown_submenu (menu_item);
+
+                      priv->activated_submenu = FALSE;
+                    }
+                  else if (GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
+                    {
+                      gtk_menu_item_select (GTK_MENU_ITEM (menu_item));
+                    }
+
+                  deactivate = FALSE;
+                }
+            }
+          else if (menu_item &&
+                   !_gtk_menu_item_is_selectable (menu_item) &&
+                   GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
+            {
+              deactivate = FALSE;
+            }
+          else if (menu_shell->parent_menu_shell)
+            {
+              menu_shell->active = TRUE;
+              gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event);
+              deactivate = FALSE;
+            }
+
+          /* If we ended up on an item with a submenu, leave the menu up.
+           */
+          if (menu_item && (menu_shell->active_menu_item == menu_item) &&
+              GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement != GTK_TOP_BOTTOM)
+            {
+              deactivate = FALSE;
+            }
+        }
       else /* a very fast press-release */
-	{
-	  /* We only ever want to prevent deactivation on the first
+        {
+          /* We only ever want to prevent deactivation on the first
            * press/release. Setting the time to zero is a bit of a
-	   * hack, since we could be being triggered in the first
-	   * few fractions of a second after a server time wraparound.
-	   * the chances of that happening are ~1/10^6, without
-	   * serious harm if we lose.
-	   */
-	  menu_shell->activate_time = 0;
-	  deactivate = FALSE;
-	}
-      
+           * hack, since we could be being triggered in the first
+           * few fractions of a second after a server time wraparound.
+           * the chances of that happening are ~1/10^6, without
+           * serious harm if we lose.
+           */
+          menu_shell->activate_time = 0;
+          deactivate = FALSE;
+        }
+
       if (deactivate)
-	{
-	  gtk_menu_shell_deactivate (menu_shell);
-	  g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
-	}
+        {
+          gtk_menu_shell_deactivate (menu_shell);
+          g_signal_emit (menu_shell, menu_shell_signals[SELECTION_DONE], 0);
+        }
     }
 
   return TRUE;
@@ -706,7 +752,6 @@ gtk_menu_shell_enter_notify (GtkWidget  
 			     GdkEventCrossing *event)
 {
   GtkMenuShell *menu_shell;
-  GtkWidget *menu_item;
 
   g_return_val_if_fail (GTK_IS_MENU_SHELL (widget), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
@@ -715,6 +760,8 @@ gtk_menu_shell_enter_notify (GtkWidget  
 
   if (menu_shell->active)
     {
+      GtkWidget *menu_item;
+
       menu_item = gtk_get_event_widget ((GdkEvent*) event);
 
       if (!menu_item ||
@@ -732,7 +779,30 @@ gtk_menu_shell_enter_notify (GtkWidget  
 	  if ((event->detail != GDK_NOTIFY_INFERIOR) &&
 	      (GTK_WIDGET_STATE (menu_item) != GTK_STATE_PRELIGHT))
 	    {
+              gboolean popup_on_click;
+
 	      gtk_menu_shell_select_item (menu_shell, menu_item);
+
+              g_object_get (gtk_widget_get_settings (widget),
+                            "gtk-menu-popup-on-click", &popup_on_click,
+                            NULL);
+
+              /* If the pen is down, and there is a submenu that is not
+               * yet visible, activate it
+               */
+              if (popup_on_click &&
+                  (event->state & GDK_BUTTON1_MASK) &&
+                  GTK_MENU_ITEM (menu_item)->submenu != NULL &&
+                  !GTK_WIDGET_VISIBLE (GTK_MENU_ITEM (menu_item)->submenu))
+                {
+                  GtkMenuShellPrivate *priv;
+
+                  priv = GTK_MENU_SHELL_GET_PRIVATE (menu_item->parent);
+
+                  _gtk_menu_item_popup_submenu (menu_item, TRUE);
+
+                  priv->activated_submenu = TRUE;
+                }
 	    }
 	}
       else if (menu_shell->parent_menu_shell)
@@ -1169,7 +1239,7 @@ gtk_menu_shell_select_submenu_first (Gtk
   
   if (menu_item->submenu)
     {
-      _gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item));
+      _gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item), FALSE);
       gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
       if (GTK_MENU_SHELL (menu_item->submenu)->active_menu_item)
 	return TRUE;
@@ -1179,8 +1249,8 @@ gtk_menu_shell_select_submenu_first (Gtk
 }
 
 static void
-gtk_real_menu_shell_move_current (GtkMenuShell      *menu_shell,
-				  GtkMenuDirectionType direction)
+gtk_real_menu_shell_move_current (GtkMenuShell         *menu_shell,
+				  GtkMenuDirectionType  direction)
 {
   GtkMenuShell *parent_menu_shell = NULL;
   gboolean had_selection;
@@ -1195,6 +1265,19 @@ gtk_real_menu_shell_move_current (GtkMen
     case GTK_MENU_DIR_PARENT:
       if (parent_menu_shell)
 	{
+          gboolean popup_on_click;
+
+          g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
+                        "gtk-menu-popup-on-click", &popup_on_click,
+                        NULL);
+
+          if (popup_on_click)
+            {
+              /* close menu when returning from submenu. */
+              _gtk_menu_item_popdown_submenu (GTK_MENU (menu_shell)->parent_menu_item);
+              break;
+            }
+
 	  if (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
               GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement)
 	    gtk_menu_shell_deselect (menu_shell);
@@ -1276,13 +1359,12 @@ gtk_real_menu_shell_activate_current (Gt
   if (menu_shell->active_menu_item &&
       _gtk_menu_item_is_selectable (menu_shell->active_menu_item))
   {
-   
     if (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu == NULL)
       gtk_menu_shell_activate_item (menu_shell,
 				    menu_shell->active_menu_item,
 				    force_hide);
     else
-      _gtk_menu_item_popup_submenu (menu_shell->active_menu_item);
+      _gtk_menu_item_popup_submenu (menu_shell->active_menu_item, FALSE);
   }
 }
 
Index: gtk/gtkmenuitem.c
===================================================================
--- gtk/gtkmenuitem.c	(revision 17599)
+++ gtk/gtkmenuitem.c	(working copy)
@@ -79,7 +79,7 @@ static void gtk_real_menu_item_toggle_si
 static gboolean gtk_menu_item_mnemonic_activate     (GtkWidget   *widget,
 						     gboolean     group_cycling);
 
-static gint gtk_menu_item_select_timeout (gpointer          data);
+static gint gtk_menu_item_popup_timeout  (gpointer          data);
 static void gtk_menu_item_position_menu  (GtkMenu          *menu,
 					  gint             *x,
 					  gint             *y,
@@ -900,47 +900,24 @@ static void
 gtk_real_menu_item_select (GtkItem *item)
 {
   GtkMenuItem *menu_item;
+  gboolean popup_on_click;
 
   g_return_if_fail (GTK_IS_MENU_ITEM (item));
 
   menu_item = GTK_MENU_ITEM (item);
 
-  if (menu_item->submenu &&
+  g_object_get (gtk_widget_get_settings (GTK_WIDGET (item)),
+                "gtk-menu-popup-on-click", &popup_on_click,
+                NULL);
+
+  if (!popup_on_click &&
+      menu_item->submenu &&
       (!GTK_WIDGET_MAPPED (menu_item->submenu) ||
        GTK_MENU (menu_item->submenu)->tearoff_active))
     {
-      gint popup_delay;
-
-      if (menu_item->timer)
-	{
-	  g_source_remove (menu_item->timer);
-	  menu_item->timer = 0;
-	  popup_delay = 0;
-	}
-      else
-	popup_delay = get_popup_delay (menu_item);
-      
-      if (popup_delay > 0)
-	{
-	  GdkEvent *event = gtk_get_current_event ();
-	  
-	  menu_item->timer = gdk_threads_add_timeout (popup_delay,
-					    gtk_menu_item_select_timeout,
-					    menu_item);
-	  if (event &&
-	      event->type != GDK_BUTTON_PRESS &&
-	      event->type != GDK_ENTER_NOTIFY)
-	    menu_item->timer_from_keypress = TRUE;
-	  else
-	    menu_item->timer_from_keypress = FALSE;
-
-	  if (event)
-	    gdk_event_free (event);
-	}
-      else
-	_gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item));
+      _gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item), TRUE);
     }
-  
+
   gtk_widget_set_state (GTK_WIDGET (menu_item), GTK_STATE_PRELIGHT);
   gtk_widget_queue_draw (GTK_WIDGET (menu_item));
 }
@@ -955,15 +932,7 @@ gtk_real_menu_item_deselect (GtkItem *it
   menu_item = GTK_MENU_ITEM (item);
 
   if (menu_item->submenu)
-    {
-      if (menu_item->timer)
-	{
-	  g_source_remove (menu_item->timer);
-	  menu_item->timer = 0;
-	}
-      else
-	gtk_menu_popdown (GTK_MENU (menu_item->submenu));
-    }
+    _gtk_menu_item_popdown_submenu (GTK_WIDGET (menu_item));
 
   gtk_widget_set_state (GTK_WIDGET (menu_item), GTK_STATE_NORMAL);
   gtk_widget_queue_draw (GTK_WIDGET (menu_item));
@@ -987,7 +956,6 @@ gtk_menu_item_mnemonic_activate (GtkWidg
   return TRUE;
 }
 
-
 static void
 gtk_real_menu_item_activate_item (GtkMenuItem *menu_item)
 {
@@ -1009,13 +977,14 @@ gtk_real_menu_item_activate_item (GtkMen
 
 	  _gtk_menu_shell_activate (menu_shell);
 
-	  gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget); 
-	  _gtk_menu_item_popup_submenu (widget); 
+	  gtk_menu_shell_select_item (GTK_MENU_SHELL (widget->parent), widget);
+	  _gtk_menu_item_popup_submenu (widget, FALSE);
 
 	  gtk_menu_shell_select_first (GTK_MENU_SHELL (menu_item->submenu), TRUE);
 	}
     }
 }
+
 static void
 gtk_real_menu_item_toggle_size_request (GtkMenuItem *menu_item,
 					gint        *requisition)
@@ -1035,7 +1004,7 @@ gtk_real_menu_item_toggle_size_allocate 
 }
 
 static gint
-gtk_menu_item_select_timeout (gpointer data)
+gtk_menu_item_popup_timeout (gpointer data)
 {
   GtkMenuItem *menu_item;
   GtkWidget *parent;
@@ -1047,24 +1016,56 @@ gtk_menu_item_select_timeout (gpointer d
   if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->active) || 
       (GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off))
     {
-      _gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item));
+      _gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item), FALSE);
       if (menu_item->timer_from_keypress && menu_item->submenu)
 	GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
     }
 
+  menu_item->timer = 0;
+
   return FALSE;  
 }
 
 void
-_gtk_menu_item_popup_submenu (GtkWidget *widget)
+_gtk_menu_item_popup_submenu (GtkWidget *widget,
+                              gboolean   with_delay)
 {
   GtkMenuItem *menu_item;
 
   menu_item = GTK_MENU_ITEM (widget);
 
   if (menu_item->timer)
-    g_source_remove (menu_item->timer);
-  menu_item->timer = 0;
+    {
+      g_source_remove (menu_item->timer);
+      menu_item->timer = 0;
+      with_delay = FALSE;
+    }
+
+  if (with_delay)
+    {
+      gint popup_delay = get_popup_delay (menu_item);
+
+      if (popup_delay > 0)
+	{
+	  GdkEvent *event = gtk_get_current_event ();
+
+	  menu_item->timer = gdk_threads_add_timeout (popup_delay,
+                                                      gtk_menu_item_popup_timeout,
+                                                      menu_item);
+
+	  if (event &&
+	      event->type != GDK_BUTTON_PRESS &&
+	      event->type != GDK_ENTER_NOTIFY)
+	    menu_item->timer_from_keypress = TRUE;
+	  else
+	    menu_item->timer_from_keypress = FALSE;
+
+	  if (event)
+	    gdk_event_free (event);
+
+          return;
+        }
+    }
 
   if (GTK_WIDGET_IS_SENSITIVE (menu_item->submenu))
     {
@@ -1082,6 +1083,32 @@ _gtk_menu_item_popup_submenu (GtkWidget 
                       GTK_MENU_SHELL (widget->parent)->button,
                       0);
     }
+
+  /* Enable themeing of the parent menu item depending on whether
+   * its submenu is shown or not.
+   */
+  gtk_widget_queue_draw (widget);
+}
+
+void
+_gtk_menu_item_popdown_submenu (GtkWidget *widget)
+{
+  GtkMenuItem *menu_item;
+
+  menu_item = GTK_MENU_ITEM (widget);
+
+  if (menu_item->submenu)
+    {
+      if (menu_item->timer)
+        {
+          g_source_remove (menu_item->timer);
+          menu_item->timer = 0;
+        }
+      else
+        gtk_menu_popdown (GTK_MENU (menu_item->submenu));
+
+      gtk_widget_queue_draw (widget);
+    }
 }
 
 static void
Index: gtk/gtkmenuitem.h
===================================================================
--- gtk/gtkmenuitem.h	(revision 17599)
+++ gtk/gtkmenuitem.h	(working copy)
@@ -119,7 +119,9 @@ void	  _gtk_menu_item_refresh_accel_path
 					       GtkAccelGroup	   *accel_group,
 					       gboolean		    group_changed);
 gboolean  _gtk_menu_item_is_selectable        (GtkWidget           *menu_item);
-void      _gtk_menu_item_popup_submenu        (GtkWidget           *menu_item);
+void      _gtk_menu_item_popup_submenu        (GtkWidget           *menu_item,
+                                               gboolean             with_delay);
+void      _gtk_menu_item_popdown_submenu      (GtkWidget           *menu_item);
 
 #ifndef GTK_DISABLE_DEPRECATED
 #define gtk_menu_item_right_justify(menu_item) gtk_menu_item_set_right_justified ((menu_item), TRUE)
