From 1268dfd50641f45693d68d23425ac5a999924af9 Mon Sep 17 00:00:00 2001 From: Aaron Klotz Date: Thu, 6 Mar 2025 15:37:41 -0700 Subject: [PATCH] notifyicon.go: move WM_ENTERMENULOOP and WM_EXITMENULOOP handlers to the notifyIconWindow WndProc These messages are sent directly to the window, as opposed to being encapsulated by notifyIconMessageID. Fixes #129 Signed-off-by: Aaron Klotz --- notifyicon.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/notifyicon.go b/notifyicon.go index 622dc17a..187525ec 100644 --- a/notifyicon.go +++ b/notifyicon.go @@ -69,6 +69,10 @@ func (niw *notifyIconWindow) WndProc(hwnd win.HWND, msg uint32, wParam, lParam u win.SetWindowPos(hwnd, 0, 0, 0, 0, 0, win.SWP_HIDEWINDOW|win.SWP_NOACTIVATE|win.SWP_NOSIZE|win.SWP_NOZORDER) case win.WM_DPICHANGED: niw.forIcon(func(ni *NotifyIcon) { ni.applyDPI() }) + case win.WM_ENTERMENULOOP: + niw.forIcon(func(ni *NotifyIcon) { ni.activeContextMenus++ }) + case win.WM_EXITMENULOOP: + niw.forIcon(func(ni *NotifyIcon) { ni.activeContextMenus-- }) default: } @@ -136,12 +140,6 @@ func (ni *NotifyIcon) wndProc(hwnd win.HWND, msg uint16, wParam uintptr) { case win.NIN_BALLOONUSERCLICK: ni.reEnableToolTip() ni.messageClickedPublisher.Publish() - - case win.WM_ENTERMENULOOP: - ni.activeContextMenus++ - - case win.WM_EXITMENULOOP: - ni.activeContextMenus-- } }