mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[mac] events updates
This commit is contained in:
parent
5cde12b42a
commit
7fafee8a6c
4 changed files with 11 additions and 8 deletions
|
|
@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- [windows] Window class name option by [windom](https://github.com/windom/) in [#3682](https://github.com/wailsapp/wails/pull/3682)
|
||||
- Services have been expanded to provide plugin functionality. By [atterpac](https://github.com/atterpac) and [leaanthony](https://github.com/leaanthony) in [#3570](https://github.com/wailsapp/wails/pull/3570)
|
||||
|
||||
### Changed
|
||||
- Events API change: `On`/`Emit` -> user events, `OnApplicationEvent` -> Application Events `OnWindowEvent` -> Window Events, by [leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Fixed
|
||||
- [linux] Fixed linux compile error introduced by IgnoreMouseEvents addition by [atterpac](https://github.com/atterpac) in [#3721](https://github.com/wailsapp/wails/pull/3721)
|
||||
- [windows] Fixed syso icon file generation bug by [atterpac](https://github.com/atterpac) in [#3675](https://github.com/wailsapp/wails/pull/3675)
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ func (m *macosApp) setApplicationMenu(menu *Menu) {
|
|||
|
||||
func (m *macosApp) run() error {
|
||||
// Add a hook to the ApplicationDidFinishLaunching event
|
||||
m.parent.On(events.Mac.ApplicationDidFinishLaunching, func(*ApplicationEvent) {
|
||||
m.parent.OnApplicationEvent(events.Mac.ApplicationDidFinishLaunching, func(*ApplicationEvent) {
|
||||
C.setApplicationShouldTerminateAfterLastWindowClosed(C.bool(m.parent.options.Mac.ApplicationShouldTerminateAfterLastWindowClosed))
|
||||
C.setActivationPolicy(C.int(m.parent.options.Mac.ActivationPolicy))
|
||||
C.activateIgnoringOtherApps()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ func (m *macosApp) setupCommonEvents() {
|
|||
for sourceEvent, targetEvent := range commonApplicationEventMap {
|
||||
sourceEvent := sourceEvent
|
||||
targetEvent := targetEvent
|
||||
m.parent.On(sourceEvent, func(event *ApplicationEvent) {
|
||||
m.parent.OnApplicationEvent(sourceEvent, func(event *ApplicationEvent) {
|
||||
event.Id = uint(targetEvent)
|
||||
applicationEvents <- event
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1240,7 +1240,7 @@ func (w *macosWebviewWindow) run() {
|
|||
w.setURL(startURL)
|
||||
|
||||
// We need to wait for the HTML to load before we can execute the javascript
|
||||
w.parent.On(events.Mac.WebViewDidFinishNavigation, func(_ *WindowEvent) {
|
||||
w.parent.OnWindowEvent(events.Mac.WebViewDidFinishNavigation, func(_ *WindowEvent) {
|
||||
InvokeAsync(func() {
|
||||
if options.JS != "" {
|
||||
w.execJS(options.JS)
|
||||
|
|
@ -1254,7 +1254,7 @@ func (w *macosWebviewWindow) run() {
|
|||
} else {
|
||||
// We have to wait until the window is shown before we can remove the shadow
|
||||
var cancel func()
|
||||
cancel = w.parent.On(events.Mac.WindowDidBecomeKey, func(_ *WindowEvent) {
|
||||
cancel = w.parent.OnWindowEvent(events.Mac.WindowDidBecomeKey, func(_ *WindowEvent) {
|
||||
w.setHasShadow(!options.Mac.DisableShadow)
|
||||
cancel()
|
||||
})
|
||||
|
|
@ -1263,18 +1263,18 @@ func (w *macosWebviewWindow) run() {
|
|||
})
|
||||
|
||||
// Translate ShouldClose to common WindowClosing event
|
||||
w.parent.On(events.Mac.WindowShouldClose, func(_ *WindowEvent) {
|
||||
w.parent.OnWindowEvent(events.Mac.WindowShouldClose, func(_ *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowClosing)
|
||||
})
|
||||
|
||||
// Translate WindowDidResignKey to common WindowLostFocus event
|
||||
w.parent.On(events.Mac.WindowDidResignKey, func(_ *WindowEvent) {
|
||||
w.parent.OnWindowEvent(events.Mac.WindowDidResignKey, func(_ *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowLostFocus)
|
||||
})
|
||||
w.parent.On(events.Mac.WindowDidResignMain, func(_ *WindowEvent) {
|
||||
w.parent.OnWindowEvent(events.Mac.WindowDidResignMain, func(_ *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowLostFocus)
|
||||
})
|
||||
w.parent.On(events.Mac.WindowDidResize, func(_ *WindowEvent) {
|
||||
w.parent.OnWindowEvent(events.Mac.WindowDidResize, func(_ *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowDidResize)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue