]> khamidou — GitHub mirrors - electron.git/commitdiff
mac: make tray's behavior more official when getting clicked quickly
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Aug 2015 08:28:22 +0000 (16:28 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 26 Aug 2015 08:28:22 +0000 (16:28 +0800)
multiple times.

atom/browser/ui/tray_icon_cocoa.mm

index d69fa8636b4fb26fc7616170c0bd3e35f833c7c4..ec6a6a3e1964158cbc0aabd7bda34b0d27a5e59c 100644 (file)
@@ -207,8 +207,14 @@ const CGFloat kVerticalTitleMargin = 2;
   }
   inMouseEventSequence_ = NO;
 
-  // Show menu when single clicked on the icon.
-  if (event.clickCount == 1 && menuController_)
+  // Show menu when there is a context menu.
+  // NB(hokein): Make tray's behavior more like official one's.
+  // When the tray icon gets clicked quickly multiple times, the
+  // event.clickCount doesn't always return 1. Instead, it returns a value that
+  // counts the clicked times.
+  // So we don't check the clickCount here, just pop up the menu for each click
+  // event.
+  if (menuController_)
     [statusItem_ popUpStatusItemMenu:[menuController_ menu]];
 
   // Don't emit click events when menu is showing.