From 5ad3fff6a08c1df45e3fb601ecbf202b776ab82b Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Wed, 15 Jul 2015 20:03:05 +0800 Subject: [PATCH] Implement 'right-clicked' tray event on Windows. --- atom/browser/ui/win/notify_icon.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/atom/browser/ui/win/notify_icon.cc b/atom/browser/ui/win/notify_icon.cc index 955a047fe1f..64329a63e5e 100644 --- a/atom/browser/ui/win/notify_icon.cc +++ b/atom/browser/ui/win/notify_icon.cc @@ -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;