From 2b051e38845f4658d46f2ffd99a206e0c9f17ad8 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 26 Aug 2015 16:28:22 +0800 Subject: [PATCH] mac: make tray's behavior more official when getting clicked quickly multiple times. --- atom/browser/ui/tray_icon_cocoa.mm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/atom/browser/ui/tray_icon_cocoa.mm b/atom/browser/ui/tray_icon_cocoa.mm index d69fa863..ec6a6a3e 100644 --- a/atom/browser/ui/tray_icon_cocoa.mm +++ b/atom/browser/ui/tray_icon_cocoa.mm @@ -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. -- 2.43.0