]> khamidou — GitHub mirrors - electron.git/commitdiff
Implement 'right-clicked' tray event on Windows.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 15 Jul 2015 12:03:05 +0000 (20:03 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 15 Jul 2015 12:03:05 +0000 (20:03 +0800)
atom/browser/ui/win/notify_icon.cc

index 955a047fe1f552a05969618db279229941532cf8..64329a63e5e44750b66156684d55e4d6877ee8e8 100644 (file)
@@ -47,21 +47,22 @@ NotifyIcon::~NotifyIcon() {
 
 void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos,
                                   bool left_mouse_click) {
+  NOTIFYICONIDENTIFIER icon_id;
+  memset(&icon_id, 0, sizeof(NOTIFYICONIDENTIFIER));
+  icon_id.uID = icon_id_;
+  icon_id.hWnd = window_;
+  icon_id.cbSize = sizeof(NOTIFYICONIDENTIFIER);
+  RECT rect = { 0 };
+  Shell_NotifyIconGetRect(&icon_id, &rect);
+
   // Pass to the observer if appropriate.
   if (left_mouse_click) {
-    NOTIFYICONIDENTIFIER icon_id;
-    memset(&icon_id, 0, sizeof(NOTIFYICONIDENTIFIER));
-    icon_id.uID = icon_id_;
-    icon_id.hWnd = window_;
-    icon_id.cbSize = sizeof(NOTIFYICONIDENTIFIER);
-
-    RECT rect = { 0 };
-    Shell_NotifyIconGetRect(&icon_id, &rect);
-
     NotifyClicked(gfx::Rect(rect));
     return;
   }
 
+  NotifyRightClicked(gfx::Rect(rect));
+
   if (!menu_model_)
     return;