From: Haojian Wu Date: Wed, 15 Jul 2015 12:03:05 +0000 (+0800) Subject: Implement 'right-clicked' tray event on Windows. X-Git-Tag: v0.30.1~16^2~8 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=5ad3fff6a08c1df45e3fb601ecbf202b776ab82b;p=electron.git Implement 'right-clicked' tray event on Windows. --- diff --git a/atom/browser/ui/win/notify_icon.cc b/atom/browser/ui/win/notify_icon.cc index 955a047f..64329a63 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;