mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 03:20:09 +08:00
[v2, darwin] Fix updating menus (#4057)
This commit is contained in:
parent
bedebe0c06
commit
49b524d169
@ -32,6 +32,8 @@ func init() {
|
||||
|
||||
type Window struct {
|
||||
context unsafe.Pointer
|
||||
|
||||
applicationMenu *menu.Menu
|
||||
}
|
||||
|
||||
func bool2Cint(value bool) C.int {
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user