:apple: Fix context menus selecting first item by default.
authorDaniel Pham <pham.dany@gmail.com>
Fri, 17 Jun 2016 18:02:01 +0000 (14:02 -0400)
committerDaniel Pham <pham.dany@gmail.com>
Fri, 17 Jun 2016 21:03:15 +0000 (17:03 -0400)
atom/browser/api/atom_api_menu_mac.h
atom/browser/api/atom_api_menu_views.h
lib/browser/api/menu.js

index 293e8ec..062fd9b 100644 (file)
@@ -19,7 +19,7 @@ class MenuMac : public Menu {
  protected:
   explicit MenuMac(v8::Isolate* isolate);
 
-  void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
+  void PopupAt(Window* window, int x, int y, int positioning_item) override;
 
   base::scoped_nsobject<AtomMenuController> menu_controller_;
 
index e1daa49..9a7a740 100644 (file)
@@ -17,7 +17,7 @@ class MenuViews : public Menu {
   explicit MenuViews(v8::Isolate* isolate);
 
  protected:
-  void PopupAt(Window* window, int x, int y, int positioning_item = 0) override;
+  void PopupAt(Window* window, int x, int y, int positioning_item) override;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MenuViews);
index e05637e..b122fc3 100644 (file)
@@ -150,10 +150,12 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
     window = BrowserWindow.getFocusedWindow()
   }
 
-  // Default parameters.
+  // Default to showing under mouse location.
   if (typeof x !== 'number') x = -1
   if (typeof y !== 'number') y = -1
-  if (typeof positioningItem !== 'number') positioningItem = 0
+
+  // Default to not highlighting any item.
+  if (typeof positioningItem !== 'number') positioningItem = -1
 
   this.popupAt(window, x, y, positioningItem)
 }