Index: gtk/gtkmenu.c
===================================================================
--- gtk/gtkmenu.c	(revision 17570)
+++ gtk/gtkmenu.c	(working copy)
@@ -2579,17 +2600,54 @@ gtk_menu_button_scroll (GtkMenu        *
 }
 
 static gboolean
+pointer_in_menu_tree (GtkWidget *widget,
+                      gdouble    x_root,
+                      gdouble    y_root)
+{
+  GtkMenu *menu = GTK_MENU (widget);
+
+  if (GTK_WIDGET_MAPPED (menu->toplevel))
+    {
+      GtkMenuShell *menu_shell;
+      gint          window_x, window_y;
+
+      gdk_window_get_position (menu->toplevel->window, &window_x, &window_y);
+
+      if (x_root >= window_x && x_root < window_x + widget->allocation.width &&
+          y_root >= window_y && y_root < window_x + widget->allocation.height)
+        return TRUE;
+
+      menu_shell = GTK_MENU_SHELL (widget);
+
+      if (GTK_IS_MENU (menu_shell->parent_menu_shell))
+        return pointer_in_menu_tree (menu_shell->parent_menu_shell,
+                                     x_root, y_root);
+    }
+
+  return FALSE;
+}
+
+static gboolean
 gtk_menu_button_press (GtkWidget      *widget,
                        GdkEventButton *event)
 {
   if (event->type != GDK_BUTTON_PRESS)
     return FALSE;
 
-  /* Don't pop down the menu for presses over scroll arrows
+  /* Don't pass down to menu shell for presses over scroll arrows
    */
   if (gtk_menu_button_scroll (GTK_MENU (widget), event))
     return TRUE;
 
+  if (GTK_IS_MENU_SHELL (gtk_get_event_widget ((GdkEvent *) event)))
+    {
+      /*  Don't pass down to menu shell if a non-menuitem part of the menu
+       *  was clicked.
+       */
+      if (pointer_in_menu_tree (widget, event->x_root, event->y_root))
+        return TRUE;
+    }
+
   return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_press_event (widget, event);
 }
 
@@ -2608,11 +2666,20 @@ gtk_menu_button_release (GtkWidget      
   if (event->type != GDK_BUTTON_RELEASE)
     return FALSE;
 
-  /* Don't pop down the menu for releases over scroll arrows
+  /* Don't pass down to menu shell for releases over scroll arrows
    */
   if (gtk_menu_button_scroll (GTK_MENU (widget), event))
     return TRUE;
 
+  if (GTK_IS_MENU_SHELL (gtk_get_event_widget ((GdkEvent *) event)))
+    {
+      /*  Don't pass down to menu shell if a non-menuitem part of the menu
+       *  was clicked.
+       */
+      if (pointer_in_menu_tree (widget, event->x_root, event->y_root))
+        return TRUE;
+    }
+
   return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_release_event (widget, event);
 }
 
