Skip to content

Commit

Permalink
[v2, darwin] Fix updating menus (#4057)
Browse files Browse the repository at this point in the history
  • Loading branch information
stffabi authored Feb 10, 2025
1 parent bedebe0 commit 49b524d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
12 changes: 9 additions & 3 deletions v2/internal/frontend/desktop/darwin/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ func init() {

type Window struct {
context unsafe.Pointer

applicationMenu *menu.Menu
}

func bool2Cint(value bool) C.int {
Expand Down Expand Up @@ -292,12 +294,16 @@ func (w *Window) Size() (int, int) {
}

func (w *Window) SetApplicationMenu(inMenu *menu.Menu) {
mainMenu := NewNSMenu(w.context, "")
processMenu(mainMenu, inMenu)
C.SetAsApplicationMenu(w.context, mainMenu.nsmenu)
w.applicationMenu = inMenu
w.UpdateApplicationMenu()
}

func (w *Window) UpdateApplicationMenu() {
mainMenu := NewNSMenu(w.context, "")
if w.applicationMenu != nil {
processMenu(mainMenu, w.applicationMenu)
}
C.SetAsApplicationMenu(w.context, mainMenu.nsmenu)
C.UpdateApplicationMenu(w.context)
}

Expand Down
1 change: 1 addition & 0 deletions website/src/pages/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed Dispatcher.ProcessMessage crash process instead of return error [PR](https://github.com/wailsapp/wails/pull/4016) [#4015](https://github.com/wailsapp/wails/issues/4015) by [@ronaldinho_x86](https://github.com/RonaldinhoL)
- Fixed Windows SaveDialog crash by [@leaanthony](https://github.com/leaanthony)
- Fixed `buildvcs` errors by [@leaanthony](https://github.com/leaanthony)
- Fixed updating menus on MacOS by [@stffabi](https://github.com/stffabi)

### Changed
- Removed documentation references for 'The default module name in go.mod is "changeme". You should change this to something more appropriate.' as it appears to be no longer relevant.
Expand Down

0 comments on commit 49b524d

Please sign in to comment.