diff --git a/atom/browser/api/atom_api_tray.cc b/atom/browser/api/atom_api_tray.cc index 2e2bc0ac18cc..81f837869190 100644 --- a/atom/browser/api/atom_api_tray.cc +++ b/atom/browser/api/atom_api_tray.cc @@ -41,6 +41,10 @@ void Tray::OnDoubleClicked() { Emit("double-clicked"); } +void Tray::OnBalloonClicked() { + Emit("balloon-clicked"); +} + void Tray::Destroy() { tray_icon_.reset(); } diff --git a/atom/browser/api/atom_api_tray.h b/atom/browser/api/atom_api_tray.h index 7257f2acdcce..74b5b1ed7d3f 100644 --- a/atom/browser/api/atom_api_tray.h +++ b/atom/browser/api/atom_api_tray.h @@ -43,6 +43,7 @@ class Tray : public mate::EventEmitter, // TrayIconObserver: void OnClicked() override; void OnDoubleClicked() override; + void OnBalloonClicked() override; void Destroy(); void SetImage(mate::Arguments* args, const gfx::ImageSkia& image); diff --git a/atom/browser/ui/tray_icon.cc b/atom/browser/ui/tray_icon.cc index 538f259dbb1d..32cb710ad948 100644 --- a/atom/browser/ui/tray_icon.cc +++ b/atom/browser/ui/tray_icon.cc @@ -31,4 +31,8 @@ void TrayIcon::NotifyDoubleClicked() { FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnDoubleClicked()); } +void TrayIcon::NotifyBalloonClicked() { + FOR_EACH_OBSERVER(TrayIconObserver, observers_, OnBalloonClicked()); +} + } // namespace atom diff --git a/atom/browser/ui/tray_icon.h b/atom/browser/ui/tray_icon.h index 0aa28ad07646..cb0fdb9f3f9e 100644 --- a/atom/browser/ui/tray_icon.h +++ b/atom/browser/ui/tray_icon.h @@ -52,6 +52,7 @@ class TrayIcon { void RemoveObserver(TrayIconObserver* obs) { observers_.RemoveObserver(obs); } void NotifyClicked(); void NotifyDoubleClicked(); + void NotifyBalloonClicked(); protected: TrayIcon(); diff --git a/atom/browser/ui/tray_icon_observer.h b/atom/browser/ui/tray_icon_observer.h index 51ef92e11483..76a1a4663229 100644 --- a/atom/browser/ui/tray_icon_observer.h +++ b/atom/browser/ui/tray_icon_observer.h @@ -11,6 +11,7 @@ class TrayIconObserver { public: virtual void OnClicked() {} virtual void OnDoubleClicked() {} + virtual void OnBalloonClicked() {} protected: virtual ~TrayIconObserver() {} diff --git a/atom/browser/ui/win/notify_icon.cc b/atom/browser/ui/win/notify_icon.cc index dc22773688be..2d6fec06466a 100644 --- a/atom/browser/ui/win/notify_icon.cc +++ b/atom/browser/ui/win/notify_icon.cc @@ -71,6 +71,10 @@ void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos, ui::MENU_SOURCE_MOUSE)); } +void NotifyIcon::HandleBalloonClickEvent() { + NotifyBalloonClicked(); +} + void NotifyIcon::ResetIcon() { NOTIFYICONDATA icon_data; InitIconData(&icon_data); diff --git a/atom/browser/ui/win/notify_icon.h b/atom/browser/ui/win/notify_icon.h index 2ac309d5dbaf..37b0ee793391 100644 --- a/atom/browser/ui/win/notify_icon.h +++ b/atom/browser/ui/win/notify_icon.h @@ -35,6 +35,9 @@ class NotifyIcon : public TrayIcon { // otherwise displays the context menu if there is one. void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click); + // Handles a click on the balloon from the user. + void HandleBalloonClickEvent(); + // Re-creates the status tray icon now after the taskbar has been created. void ResetIcon(); diff --git a/atom/browser/ui/win/notify_icon_host.cc b/atom/browser/ui/win/notify_icon_host.cc index c9ef82a760a9..83ee6e485a18 100644 --- a/atom/browser/ui/win/notify_icon_host.cc +++ b/atom/browser/ui/win/notify_icon_host.cc @@ -132,6 +132,10 @@ LRESULT CALLBACK NotifyIconHost::WndProc(HWND hwnd, return TRUE; switch (lparam) { + case TB_INDETERMINATE: + win_icon->HandleBalloonClickEvent(); + return TRUE; + case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_CONTEXTMENU: