}
void NotifyIcon::HandleClickEvent(const gfx::Point& cursor_pos,
- bool left_mouse_click) {
+ bool left_mouse_click,
+ bool double_button_click) {
NOTIFYICONIDENTIFIER icon_id;
memset(&icon_id, 0, sizeof(NOTIFYICONIDENTIFIER));
icon_id.uID = icon_id_;
RECT rect = { 0 };
Shell_NotifyIconGetRect(&icon_id, &rect);
- // Pass to the observer if appropriate.
if (left_mouse_click) {
- NotifyClicked(gfx::Rect(rect));
+ if (double_button_click) // double left click
+ NotifyDoubleClicked(gfx::Rect(rect));
+ else // single left click
+ NotifyClicked(gfx::Rect(rect));
return;
+ } else if (!double_button_click) { // single right click
+ NotifyRightClicked(gfx::Rect(rect));
+ PopContextMenu(cursor_pos);
}
-
- NotifyRightClicked(gfx::Rect(rect));
- PopContextMenu(cursor_pos);
}
void NotifyIcon::ResetIcon() {
// Handles a click event from the user - if |left_button_click| is true and
// there is a registered observer, passes the click event to the observer,
// otherwise displays the context menu if there is one.
- void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click);
+ void HandleClickEvent(const gfx::Point& cursor_pos,
+ bool left_button_click,
+ bool double_button_click);
// Re-creates the status tray icon now after the taskbar has been created.
void ResetIcon();
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
+ case WM_LBUTTONDBLCLK:
+ case WM_RBUTTONDBLCLK:
case WM_CONTEXTMENU:
// Walk our icons, find which one was clicked on, and invoke its
// HandleClickEvent() method.
gfx::Point cursor_pos(
gfx::Screen::GetNativeScreen()->GetCursorScreenPoint());
- win_icon->HandleClickEvent(cursor_pos, lparam == WM_LBUTTONDOWN);
+ win_icon->HandleClickEvent(
+ cursor_pos,
+ (lparam == WM_LBUTTONDOWN || lparam == WM_LBUTTONDBLCLK),
+ (lparam == WM_LBUTTONDBLCLK || lparam == WM_RBUTTONDBLCLK));
return TRUE;
}
}