Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support publish notify icon dbclicked event #552

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions notifyicon.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func notifyIconWndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) (resul
case win.WM_LBUTTONUP:
ni.publishMouseEvent(&ni.mouseUpPublisher, LeftButton)

case win.WM_LBUTTONDBLCLK:
ni.publishMouseEvent(&ni.mouseDbClickedPublisher, LeftButton)

case win.WM_RBUTTONDOWN:
ni.publishMouseEvent(&ni.mouseDownPublisher, RightButton)

Expand All @@ -35,6 +38,9 @@ func notifyIconWndProc(hwnd win.HWND, msg uint32, wParam, lParam uintptr) (resul

win.SendMessage(hwnd, msg, wParam, win.WM_CONTEXTMENU)

case win.WM_RBUTTONDBLCLK:
ni.publishMouseEvent(&ni.mouseDbClickedPublisher, RightButton)

case win.WM_CONTEXTMENU:
if ni.contextMenu.Actions().Len() == 0 {
break
Expand Down Expand Up @@ -82,6 +88,7 @@ type NotifyIcon struct {
mouseDownPublisher MouseEventPublisher
mouseUpPublisher MouseEventPublisher
messageClickedPublisher EventPublisher
mouseDbClickedPublisher MouseEventPublisher
}

// NewNotifyIcon creates and returns a new NotifyIcon.
Expand Down Expand Up @@ -377,3 +384,9 @@ func (ni *NotifyIcon) MouseUp() *MouseEvent {
func (ni *NotifyIcon) MessageClicked() *Event {
return ni.messageClickedPublisher.Event()
}

// MouseDbClicked returns the event that is published when a mouse button is double clicked
// while the cursor is over the NotifyIcon.
func (ni *NotifyIcon) MouseDbClicked() *MouseEvent {
return ni.mouseDbClickedPublisher.Event()
}