Skip to content

Commit

Permalink
consistent placing of systray menu on right vs left click
Browse files Browse the repository at this point in the history
  • Loading branch information
tw1nk committed Feb 26, 2024
1 parent 45712b1 commit e79d829
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions v3/pkg/application/systemtray_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ func (s *windowsSystemTray) openMenu() {

// Show the menu at the tray bounds
s.menu.ShowAt(trayBounds.X, trayBounds.Y)

}

func (s *windowsSystemTray) positionWindow(window *WebviewWindow, offset int) error {

// Get the current screen trayBounds
currentScreen, err := s.getScreen()
if err != nil {
Expand Down Expand Up @@ -211,7 +209,7 @@ func (s *windowsSystemTray) run() {
if s.parent.rightClickHandler == nil {
s.parent.rightClickHandler = func() {
if s.menu != nil {
s.menu.ShowAtCursor()
s.openMenu()
}
}
}
Expand All @@ -226,11 +224,9 @@ func (s *windowsSystemTray) run() {

// Register the system tray
getNativeApplication().registerSystemTray(s)

}

func (s *windowsSystemTray) updateIcon() {

var newIcon w32.HICON
if w32.IsCurrentlyDarkMode() {
newIcon = s.darkModeIcon
Expand Down Expand Up @@ -275,6 +271,7 @@ func (s *windowsSystemTray) setIcon(icon []byte) {
// Update the icon
s.updateIcon()
}

func (s *windowsSystemTray) setDarkModeIcon(icon []byte) {
var err error
s.darkModeIcon, err = w32.CreateSmallHIconFromImage(icon)
Expand Down Expand Up @@ -324,7 +321,7 @@ func (s *windowsSystemTray) wndProc(msg uint32, wParam, lParam uintptr) uintptr
s.parent.mouseLeaveHandler()
}
}
//println(w32.WMMessageToString(msg))
// println(w32.WMMessageToString(msg))

// Menu processing
case w32.WM_COMMAND:
Expand All @@ -334,8 +331,8 @@ func (s *windowsSystemTray) wndProc(msg uint32, wParam, lParam uintptr) uintptr
s.menu.ProcessCommand(cmdMsgID)
}
default:
//msg := int(wParam & 0xffff)
//println(w32.WMMessageToString(uintptr(msg)))
// msg := int(wParam & 0xffff)
// println(w32.WMMessageToString(uintptr(msg)))
}

return w32.DefWindowProc(s.hwnd, msg, wParam, lParam)
Expand Down

0 comments on commit e79d829

Please sign in to comment.