5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-21 19:39:29 +08:00

Improve window teardown on termination

This commit adds a robust teardown process for windows on application shutdown. It introduces a field to track the destruction state of each window and checks such before performing window operations. Also, it enhances the destroy functions within application for thorough clean up. Finally, redundant event handlers related to application termination were removed while fixing file generating challenge in go tasks.
This commit is contained in:
Lea Anthony 2024-01-09 07:45:56 +11:00
parent 68e779d64e
commit 1195464acb
14 changed files with 502 additions and 486 deletions

View File

@ -48,7 +48,6 @@ export const EventTypes = {
ApplicationWillTerminate: "mac:ApplicationWillTerminate", ApplicationWillTerminate: "mac:ApplicationWillTerminate",
ApplicationWillUnhide: "mac:ApplicationWillUnhide", ApplicationWillUnhide: "mac:ApplicationWillUnhide",
ApplicationWillUpdate: "mac:ApplicationWillUpdate", ApplicationWillUpdate: "mac:ApplicationWillUpdate",
ApplicationTerminate: "mac:ApplicationTerminate",
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme!", ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme!",
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen!", ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen!",
WindowDidBecomeKey: "mac:WindowDidBecomeKey", WindowDidBecomeKey: "mac:WindowDidBecomeKey",

View File

@ -48,7 +48,6 @@ export declare const EventTypes: {
ApplicationWillTerminate: string, ApplicationWillTerminate: string,
ApplicationWillUnhide: string, ApplicationWillUnhide: string,
ApplicationWillUpdate: string, ApplicationWillUpdate: string,
ApplicationTerminate: string,
ApplicationDidChangeTheme: string, ApplicationDidChangeTheme: string,
ApplicationShouldHandleReopen: string, ApplicationShouldHandleReopen: string,
WindowDidBecomeKey: string, WindowDidBecomeKey: string,

View File

@ -290,6 +290,9 @@ type App struct {
// Keybindings // Keybindings
keyBindings map[string]func(window *WebviewWindow) keyBindings map[string]func(window *WebviewWindow)
//
shutdownOnce sync.Once
} }
func (a *App) init() { func (a *App) init() {
@ -604,14 +607,17 @@ func (a *App) Quit() {
for _, window := range a.windows { for _, window := range a.windows {
window.Destroy() window.Destroy()
} }
a.windows = nil
a.windowsLock.RUnlock() a.windowsLock.RUnlock()
a.systemTraysLock.Lock() a.systemTraysLock.Lock()
for _, systray := range a.systemTrays { for _, systray := range a.systemTrays {
systray.Destroy() systray.Destroy()
} }
a.systemTrays = nil
a.systemTraysLock.Unlock() a.systemTraysLock.Unlock()
if a.impl != nil { if a.impl != nil {
a.impl.destroy() a.impl.destroy()
a.impl = nil
} }
}) })
} }

View File

@ -334,6 +334,11 @@ func processMenuItemClick(menuID C.uint) {
menuItemClicked <- uint(menuID) menuItemClicked <- uint(menuID)
} }
//export quitApplication
func quitApplication() {
globalApplication.Quit()
}
func (a *App) logPlatformInfo() { func (a *App) logPlatformInfo() {
info, err := operatingsystem.Info() info, err := operatingsystem.Info()
if err != nil { if err != nil {

View File

@ -1,8 +1,9 @@
//go:build darwin //go:build darwin
#import "application_darwin_delegate.h" #import "application_darwin_delegate.h"
#import "../events/events_darwin.h" #import "../events/events_darwin.h"
#import "message.h"
extern bool hasListeners(unsigned int); extern bool hasListeners(unsigned int);
extern void quitApplication();
@implementation AppDelegate @implementation AppDelegate
- (void)dealloc - (void)dealloc
{ {
@ -19,14 +20,13 @@ extern bool hasListeners(unsigned int);
} }
} }
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
processApplicationEvent(EventApplicationTerminate, NULL); quitApplication();
return NSTerminateCancel; return NSTerminateCancel;
} }
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
{ {
return YES; return YES;
} }
- (BOOL)applicationShouldHandleReopen:(NSNotification *)notification - (BOOL)applicationShouldHandleReopen:(NSNotification *)notification
hasVisibleWindows:(BOOL)flag { hasVisibleWindows:(BOOL)flag {
if( hasListeners(EventApplicationShouldHandleReopen) ) { if( hasListeners(EventApplicationShouldHandleReopen) ) {
@ -156,11 +156,5 @@ extern bool hasListeners(unsigned int);
} }
} }
- (void)applicationTerminate:(NSNotification *)notification {
if( hasListeners(EventApplicationTerminate) ) {
processApplicationEvent(EventApplicationTerminate, NULL);
}
}
// GENERATED EVENTS END // GENERATED EVENTS END
@end @end

View File

@ -7,7 +7,6 @@ import "github.com/wailsapp/wails/v3/pkg/events"
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{ var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
events.Mac.ApplicationDidFinishLaunching: events.Common.ApplicationStarted, events.Mac.ApplicationDidFinishLaunching: events.Common.ApplicationStarted,
events.Mac.ApplicationDidChangeTheme: events.Common.ThemeChanged, events.Mac.ApplicationDidChangeTheme: events.Common.ThemeChanged,
events.Mac.ApplicationTerminate: events.Common.ApplicationTerminate,
} }
func (m *macosApp) setupCommonEvents() { func (m *macosApp) setupCommonEvents() {

View File

@ -122,6 +122,10 @@ type WebviewWindow struct {
// keyBindings holds the keybindings for the window // keyBindings holds the keybindings for the window
keyBindings map[string]func(window *WebviewWindow) keyBindings map[string]func(window *WebviewWindow)
// Indicates that the window is destroyed
destroyed bool
destroyedLock sync.RWMutex
} }
var windowID uint var windowID uint
@ -142,6 +146,12 @@ func (w *WebviewWindow) onApplicationEvent(eventType events.ApplicationEventType
w.addCancellationFunction(cancelFn) w.addCancellationFunction(cancelFn)
} }
func (w *WebviewWindow) markAsDestroyed() {
w.destroyedLock.Lock()
defer w.destroyedLock.Unlock()
w.destroyed = true
}
func (w *WebviewWindow) setupEventMapping() { func (w *WebviewWindow) setupEventMapping() {
var mapping map[events.WindowEventType]events.WindowEventType var mapping map[events.WindowEventType]events.WindowEventType
@ -353,7 +363,7 @@ func (w *WebviewWindow) Show() Window {
if globalApplication.impl == nil { if globalApplication.impl == nil {
return w return w
} }
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
InvokeSync(w.Run) InvokeSync(w.Run)
return w return w
} }
@ -483,7 +493,7 @@ func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window {
// ExecJS executes the given javascript in the context of the window. // ExecJS executes the given javascript in the context of the window.
func (w *WebviewWindow) ExecJS(_callID, js string) { func (w *WebviewWindow) ExecJS(_callID, js string) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
w.impl.execJS(js) w.impl.execJS(js)
@ -491,7 +501,7 @@ func (w *WebviewWindow) ExecJS(_callID, js string) {
// Fullscreen sets the window to fullscreen mode. Min/Max size constraints are disabled. // Fullscreen sets the window to fullscreen mode. Min/Max size constraints are disabled.
func (w *WebviewWindow) Fullscreen() Window { func (w *WebviewWindow) Fullscreen() Window {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
w.options.StartState = WindowStateFullscreen w.options.StartState = WindowStateFullscreen
return w return w
} }
@ -515,7 +525,7 @@ func (w *WebviewWindow) SetFullscreenButtonEnabled(enabled bool) Window {
// Flash flashes the window's taskbar button/icon. // Flash flashes the window's taskbar button/icon.
// Useful to indicate that attention is required. Windows only. // Useful to indicate that attention is required. Windows only.
func (w *WebviewWindow) Flash(enabled bool) { func (w *WebviewWindow) Flash(enabled bool) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -525,7 +535,7 @@ func (w *WebviewWindow) Flash(enabled bool) {
// IsMinimised returns true if the window is minimised // IsMinimised returns true if the window is minimised
func (w *WebviewWindow) IsMinimised() bool { func (w *WebviewWindow) IsMinimised() bool {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return false return false
} }
return InvokeSyncWithResult(w.impl.isMinimised) return InvokeSyncWithResult(w.impl.isMinimised)
@ -533,7 +543,7 @@ func (w *WebviewWindow) IsMinimised() bool {
// IsVisible returns true if the window is visible // IsVisible returns true if the window is visible
func (w *WebviewWindow) IsVisible() bool { func (w *WebviewWindow) IsVisible() bool {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return false return false
} }
return InvokeSyncWithResult(w.impl.isVisible) return InvokeSyncWithResult(w.impl.isVisible)
@ -541,7 +551,7 @@ func (w *WebviewWindow) IsVisible() bool {
// IsMaximised returns true if the window is maximised // IsMaximised returns true if the window is maximised
func (w *WebviewWindow) IsMaximised() bool { func (w *WebviewWindow) IsMaximised() bool {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return false return false
} }
return InvokeSyncWithResult(w.impl.isMaximised) return InvokeSyncWithResult(w.impl.isMaximised)
@ -549,7 +559,7 @@ func (w *WebviewWindow) IsMaximised() bool {
// Size returns the size of the window // Size returns the size of the window
func (w *WebviewWindow) Size() (int, int) { func (w *WebviewWindow) Size() (int, int) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0, 0 return 0, 0
} }
var width, height int var width, height int
@ -561,7 +571,7 @@ func (w *WebviewWindow) Size() (int, int) {
// IsFocused returns true if the window is currently focused // IsFocused returns true if the window is currently focused
func (w *WebviewWindow) IsFocused() bool { func (w *WebviewWindow) IsFocused() bool {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return false return false
} }
return InvokeSyncWithResult(w.impl.isFocused) return InvokeSyncWithResult(w.impl.isFocused)
@ -569,7 +579,7 @@ func (w *WebviewWindow) IsFocused() bool {
// IsFullscreen returns true if the window is fullscreen // IsFullscreen returns true if the window is fullscreen
func (w *WebviewWindow) IsFullscreen() bool { func (w *WebviewWindow) IsFullscreen() bool {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return false return false
} }
return InvokeSyncWithResult(w.impl.isFullscreen) return InvokeSyncWithResult(w.impl.isFullscreen)
@ -615,7 +625,7 @@ func (w *WebviewWindow) HandleMessage(message string) {
} }
func (w *WebviewWindow) startResize(border string) error { func (w *WebviewWindow) startResize(border string) error {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return nil return nil
} }
return InvokeSyncWithResult(func() error { return InvokeSyncWithResult(func() error {
@ -625,7 +635,7 @@ func (w *WebviewWindow) startResize(border string) error {
// Center centers the window on the screen // Center centers the window on the screen
func (w *WebviewWindow) Center() { func (w *WebviewWindow) Center() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
w.options.Centered = true w.options.Centered = true
return return
} }
@ -696,7 +706,7 @@ func (w *WebviewWindow) HandleWindowEvent(id uint) {
// Width returns the width of the window // Width returns the width of the window
func (w *WebviewWindow) Width() int { func (w *WebviewWindow) Width() int {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0 return 0
} }
return InvokeSyncWithResult(w.impl.width) return InvokeSyncWithResult(w.impl.width)
@ -704,7 +714,7 @@ func (w *WebviewWindow) Width() int {
// Height returns the height of the window // Height returns the height of the window
func (w *WebviewWindow) Height() int { func (w *WebviewWindow) Height() int {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0 return 0
} }
return InvokeSyncWithResult(w.impl.height) return InvokeSyncWithResult(w.impl.height)
@ -712,7 +722,7 @@ func (w *WebviewWindow) Height() int {
// RelativePosition returns the relative position of the window to the screen // RelativePosition returns the relative position of the window to the screen
func (w *WebviewWindow) RelativePosition() (int, int) { func (w *WebviewWindow) RelativePosition() (int, int) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0, 0 return 0, 0
} }
var x, y int var x, y int
@ -724,7 +734,7 @@ func (w *WebviewWindow) RelativePosition() (int, int) {
// AbsolutePosition returns the absolute position of the window to the screen // AbsolutePosition returns the absolute position of the window to the screen
func (w *WebviewWindow) AbsolutePosition() (int, int) { func (w *WebviewWindow) AbsolutePosition() (int, int) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0, 0 return 0, 0
} }
var x, y int var x, y int
@ -735,7 +745,7 @@ func (w *WebviewWindow) AbsolutePosition() (int, int) {
} }
func (w *WebviewWindow) Destroy() { func (w *WebviewWindow) Destroy() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
@ -749,7 +759,7 @@ func (w *WebviewWindow) Destroy() {
// Reload reloads the page assets // Reload reloads the page assets
func (w *WebviewWindow) Reload() { func (w *WebviewWindow) Reload() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.reload) InvokeSync(w.impl.reload)
@ -757,7 +767,7 @@ func (w *WebviewWindow) Reload() {
// ForceReload forces the window to reload the page assets // ForceReload forces the window to reload the page assets
func (w *WebviewWindow) ForceReload() { func (w *WebviewWindow) ForceReload() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.forceReload) InvokeSync(w.impl.forceReload)
@ -765,7 +775,7 @@ func (w *WebviewWindow) ForceReload() {
// ToggleFullscreen toggles the window between fullscreen and normal // ToggleFullscreen toggles the window between fullscreen and normal
func (w *WebviewWindow) ToggleFullscreen() { func (w *WebviewWindow) ToggleFullscreen() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -778,7 +788,7 @@ func (w *WebviewWindow) ToggleFullscreen() {
} }
func (w *WebviewWindow) ToggleDevTools() { func (w *WebviewWindow) ToggleDevTools() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.toggleDevTools) InvokeSync(w.impl.toggleDevTools)
@ -796,7 +806,7 @@ func (w *WebviewWindow) ZoomReset() Window {
// ZoomIn increases the zoom level of the webview content // ZoomIn increases the zoom level of the webview content
func (w *WebviewWindow) ZoomIn() { func (w *WebviewWindow) ZoomIn() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.zoomIn) InvokeSync(w.impl.zoomIn)
@ -806,7 +816,7 @@ func (w *WebviewWindow) ZoomIn() {
// ZoomOut decreases the zoom level of the webview content // ZoomOut decreases the zoom level of the webview content
func (w *WebviewWindow) ZoomOut() { func (w *WebviewWindow) ZoomOut() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.zoomOut) InvokeSync(w.impl.zoomOut)
@ -815,14 +825,14 @@ func (w *WebviewWindow) ZoomOut() {
// Close closes the window // Close closes the window
func (w *WebviewWindow) Close() { func (w *WebviewWindow) Close() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
w.emit(events.Common.WindowClosing) w.emit(events.Common.WindowClosing)
} }
func (w *WebviewWindow) Zoom() { func (w *WebviewWindow) Zoom() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(w.impl.zoom) InvokeSync(w.impl.zoom)
@ -854,7 +864,7 @@ func (w *WebviewWindow) SetRelativePosition(x, y int) Window {
// Minimise minimises the window. // Minimise minimises the window.
func (w *WebviewWindow) Minimise() Window { func (w *WebviewWindow) Minimise() Window {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
w.options.StartState = WindowStateMinimised w.options.StartState = WindowStateMinimised
return w return w
} }
@ -867,7 +877,7 @@ func (w *WebviewWindow) Minimise() Window {
// Maximise maximises the window. Min/Max size constraints are disabled. // Maximise maximises the window. Min/Max size constraints are disabled.
func (w *WebviewWindow) Maximise() Window { func (w *WebviewWindow) Maximise() Window {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
w.options.StartState = WindowStateMaximised w.options.StartState = WindowStateMaximised
return w return w
} }
@ -881,7 +891,7 @@ func (w *WebviewWindow) Maximise() Window {
// UnMinimise un-minimises the window. Min/Max size constraints are re-enabled. // UnMinimise un-minimises the window. Min/Max size constraints are re-enabled.
func (w *WebviewWindow) UnMinimise() { func (w *WebviewWindow) UnMinimise() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
if w.IsMinimised() { if w.IsMinimised() {
@ -892,7 +902,7 @@ func (w *WebviewWindow) UnMinimise() {
// UnMaximise un-maximises the window. // UnMaximise un-maximises the window.
func (w *WebviewWindow) UnMaximise() { func (w *WebviewWindow) UnMaximise() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
if w.IsMaximised() { if w.IsMaximised() {
@ -904,7 +914,7 @@ func (w *WebviewWindow) UnMaximise() {
// UnFullscreen un-fullscreens the window. // UnFullscreen un-fullscreens the window.
func (w *WebviewWindow) UnFullscreen() { func (w *WebviewWindow) UnFullscreen() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
if w.IsFullscreen() { if w.IsFullscreen() {
@ -916,7 +926,7 @@ func (w *WebviewWindow) UnFullscreen() {
// Restore restores the window to its previous state if it was previously minimised, maximised or fullscreen. // Restore restores the window to its previous state if it was previously minimised, maximised or fullscreen.
func (w *WebviewWindow) Restore() { func (w *WebviewWindow) Restore() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -932,7 +942,7 @@ func (w *WebviewWindow) Restore() {
} }
func (w *WebviewWindow) DisableSizeConstraints() { func (w *WebviewWindow) DisableSizeConstraints() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -946,7 +956,7 @@ func (w *WebviewWindow) DisableSizeConstraints() {
} }
func (w *WebviewWindow) EnableSizeConstraints() { func (w *WebviewWindow) EnableSizeConstraints() {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -961,7 +971,7 @@ func (w *WebviewWindow) EnableSizeConstraints() {
// GetScreen returns the screen that the window is on // GetScreen returns the screen that the window is on
func (w *WebviewWindow) GetScreen() (*Screen, error) { func (w *WebviewWindow) GetScreen() (*Screen, error) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return nil, nil return nil, nil
} }
return InvokeSyncWithResultAndError(w.impl.getScreen) return InvokeSyncWithResultAndError(w.impl.getScreen)
@ -1027,7 +1037,7 @@ func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData) {
} }
} }
menu.setContextData(data) menu.setContextData(data)
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -1044,7 +1054,7 @@ func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu) {
// NativeWindowHandle returns the platform native window handle for the window. // NativeWindowHandle returns the platform native window handle for the window.
func (w *WebviewWindow) NativeWindowHandle() (uintptr, error) { func (w *WebviewWindow) NativeWindowHandle() (uintptr, error) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return 0, errors.New("native handle unavailable as window is not running") return 0, errors.New("native handle unavailable as window is not running")
} }
return w.impl.nativeWindowHandle(), nil return w.impl.nativeWindowHandle(), nil
@ -1063,21 +1073,21 @@ func (w *WebviewWindow) emit(eventType events.WindowEventType) {
} }
func (w *WebviewWindow) startDrag() error { func (w *WebviewWindow) startDrag() error {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return nil return nil
} }
return InvokeSyncWithError(w.impl.startDrag) return InvokeSyncWithError(w.impl.startDrag)
} }
func (w *WebviewWindow) Print() error { func (w *WebviewWindow) Print() error {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return nil return nil
} }
return InvokeSyncWithError(w.impl.print) return InvokeSyncWithError(w.impl.print)
} }
func (w *WebviewWindow) SetEnabled(enabled bool) { func (w *WebviewWindow) SetEnabled(enabled bool) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -1087,7 +1097,7 @@ func (w *WebviewWindow) SetEnabled(enabled bool) {
func (w *WebviewWindow) SetAbsolutePosition(x int, y int) { func (w *WebviewWindow) SetAbsolutePosition(x int, y int) {
// set absolute position // set absolute position
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
@ -1110,10 +1120,16 @@ func (w *WebviewWindow) processKeyBinding(acceleratorString string) bool {
} }
func (w *WebviewWindow) HandleKeyEvent(acceleratorString string) { func (w *WebviewWindow) HandleKeyEvent(acceleratorString string) {
if w.impl == nil { if w.impl == nil && !w.isDestroyed() {
return return
} }
InvokeSync(func() { InvokeSync(func() {
w.impl.handleKeyEvent(acceleratorString) w.impl.handleKeyEvent(acceleratorString)
}) })
} }
func (w *WebviewWindow) isDestroyed() bool {
w.destroyedLock.RLock()
defer w.destroyedLock.RUnlock()
return w.destroyed
}

View File

@ -1222,6 +1222,7 @@ func (w *macosWebviewWindow) absolutePosition() (int, int) {
} }
func (w *macosWebviewWindow) destroy() { func (w *macosWebviewWindow) destroy() {
w.parent.markAsDestroyed()
C.windowDestroy(w.nsWindow) C.windowDestroy(w.nsWindow)
} }

View File

@ -455,6 +455,7 @@ func (w *linuxWebviewWindow) relativePosition() (int, int) {
} }
func (w *linuxWebviewWindow) destroy() { func (w *linuxWebviewWindow) destroy() {
w.parent.markAsDestroyed()
windowDestroy(w.window) windowDestroy(w.window)
} }

View File

@ -392,7 +392,7 @@ func (w *windowsWebviewWindow) relativePosition() (int, int) {
} }
func (w *windowsWebviewWindow) destroy() { func (w *windowsWebviewWindow) destroy() {
// Not sure if we have anything to destroy... w.parent.markAsDestroyed()
if w.dropTarget != nil { if w.dropTarget != nil {
w.dropTarget.Release() w.dropTarget.Release()
} }

View File

@ -31,27 +31,27 @@ type commonEvents struct {
func newCommonEvents() commonEvents { func newCommonEvents() commonEvents {
return commonEvents{ return commonEvents{
ApplicationStarted: 1175, ApplicationStarted: 1174,
WindowMaximise: 1176, WindowMaximise: 1175,
WindowUnMaximise: 1177, WindowUnMaximise: 1176,
WindowFullscreen: 1178, WindowFullscreen: 1177,
WindowUnFullscreen: 1179, WindowUnFullscreen: 1178,
WindowRestore: 1180, WindowRestore: 1179,
WindowMinimise: 1181, WindowMinimise: 1180,
WindowUnMinimise: 1182, WindowUnMinimise: 1181,
WindowClosing: 1183, WindowClosing: 1182,
WindowZoom: 1184, WindowZoom: 1183,
WindowZoomIn: 1185, WindowZoomIn: 1184,
WindowZoomOut: 1186, WindowZoomOut: 1185,
WindowZoomReset: 1187, WindowZoomReset: 1186,
WindowFocus: 1188, WindowFocus: 1187,
WindowLostFocus: 1189, WindowLostFocus: 1188,
WindowShow: 1190, WindowShow: 1189,
WindowHide: 1191, WindowHide: 1190,
WindowDPIChanged: 1192, WindowDPIChanged: 1191,
WindowFilesDropped: 1193, WindowFilesDropped: 1192,
ThemeChanged: 1194, ThemeChanged: 1193,
ApplicationTerminate: 1195, ApplicationTerminate: 1194,
} }
} }
@ -90,7 +90,6 @@ type macEvents struct {
ApplicationWillTerminate ApplicationEventType ApplicationWillTerminate ApplicationEventType
ApplicationWillUnhide ApplicationEventType ApplicationWillUnhide ApplicationEventType
ApplicationWillUpdate ApplicationEventType ApplicationWillUpdate ApplicationEventType
ApplicationTerminate ApplicationEventType
ApplicationDidChangeTheme ApplicationEventType ApplicationDidChangeTheme ApplicationEventType
ApplicationShouldHandleReopen ApplicationEventType ApplicationShouldHandleReopen ApplicationEventType
WindowDidBecomeKey WindowEventType WindowDidBecomeKey WindowEventType
@ -219,111 +218,110 @@ func newMacEvents() macEvents {
ApplicationWillTerminate: 1042, ApplicationWillTerminate: 1042,
ApplicationWillUnhide: 1043, ApplicationWillUnhide: 1043,
ApplicationWillUpdate: 1044, ApplicationWillUpdate: 1044,
ApplicationTerminate: 1045, ApplicationDidChangeTheme: 1045,
ApplicationDidChangeTheme: 1046, ApplicationShouldHandleReopen: 1046,
ApplicationShouldHandleReopen: 1047, WindowDidBecomeKey: 1047,
WindowDidBecomeKey: 1048, WindowDidBecomeMain: 1048,
WindowDidBecomeMain: 1049, WindowDidBeginSheet: 1049,
WindowDidBeginSheet: 1050, WindowDidChangeAlpha: 1050,
WindowDidChangeAlpha: 1051, WindowDidChangeBackingLocation: 1051,
WindowDidChangeBackingLocation: 1052, WindowDidChangeBackingProperties: 1052,
WindowDidChangeBackingProperties: 1053, WindowDidChangeCollectionBehavior: 1053,
WindowDidChangeCollectionBehavior: 1054, WindowDidChangeEffectiveAppearance: 1054,
WindowDidChangeEffectiveAppearance: 1055, WindowDidChangeOcclusionState: 1055,
WindowDidChangeOcclusionState: 1056, WindowDidChangeOrderingMode: 1056,
WindowDidChangeOrderingMode: 1057, WindowDidChangeScreen: 1057,
WindowDidChangeScreen: 1058, WindowDidChangeScreenParameters: 1058,
WindowDidChangeScreenParameters: 1059, WindowDidChangeScreenProfile: 1059,
WindowDidChangeScreenProfile: 1060, WindowDidChangeScreenSpace: 1060,
WindowDidChangeScreenSpace: 1061, WindowDidChangeScreenSpaceProperties: 1061,
WindowDidChangeScreenSpaceProperties: 1062, WindowDidChangeSharingType: 1062,
WindowDidChangeSharingType: 1063, WindowDidChangeSpace: 1063,
WindowDidChangeSpace: 1064, WindowDidChangeSpaceOrderingMode: 1064,
WindowDidChangeSpaceOrderingMode: 1065, WindowDidChangeTitle: 1065,
WindowDidChangeTitle: 1066, WindowDidChangeToolbar: 1066,
WindowDidChangeToolbar: 1067, WindowDidChangeVisibility: 1067,
WindowDidChangeVisibility: 1068, WindowDidDeminiaturize: 1068,
WindowDidDeminiaturize: 1069, WindowDidEndSheet: 1069,
WindowDidEndSheet: 1070, WindowDidEnterFullScreen: 1070,
WindowDidEnterFullScreen: 1071, WindowDidEnterVersionBrowser: 1071,
WindowDidEnterVersionBrowser: 1072, WindowDidExitFullScreen: 1072,
WindowDidExitFullScreen: 1073, WindowDidExitVersionBrowser: 1073,
WindowDidExitVersionBrowser: 1074, WindowDidExpose: 1074,
WindowDidExpose: 1075, WindowDidFocus: 1075,
WindowDidFocus: 1076, WindowDidMiniaturize: 1076,
WindowDidMiniaturize: 1077, WindowDidMove: 1077,
WindowDidMove: 1078, WindowDidOrderOffScreen: 1078,
WindowDidOrderOffScreen: 1079, WindowDidOrderOnScreen: 1079,
WindowDidOrderOnScreen: 1080, WindowDidResignKey: 1080,
WindowDidResignKey: 1081, WindowDidResignMain: 1081,
WindowDidResignMain: 1082, WindowDidResize: 1082,
WindowDidResize: 1083, WindowDidUpdate: 1083,
WindowDidUpdate: 1084, WindowDidUpdateAlpha: 1084,
WindowDidUpdateAlpha: 1085, WindowDidUpdateCollectionBehavior: 1085,
WindowDidUpdateCollectionBehavior: 1086, WindowDidUpdateCollectionProperties: 1086,
WindowDidUpdateCollectionProperties: 1087, WindowDidUpdateShadow: 1087,
WindowDidUpdateShadow: 1088, WindowDidUpdateTitle: 1088,
WindowDidUpdateTitle: 1089, WindowDidUpdateToolbar: 1089,
WindowDidUpdateToolbar: 1090, WindowDidUpdateVisibility: 1090,
WindowDidUpdateVisibility: 1091, WindowShouldClose: 1091,
WindowShouldClose: 1092, WindowWillBecomeKey: 1092,
WindowWillBecomeKey: 1093, WindowWillBecomeMain: 1093,
WindowWillBecomeMain: 1094, WindowWillBeginSheet: 1094,
WindowWillBeginSheet: 1095, WindowWillChangeOrderingMode: 1095,
WindowWillChangeOrderingMode: 1096, WindowWillClose: 1096,
WindowWillClose: 1097, WindowWillDeminiaturize: 1097,
WindowWillDeminiaturize: 1098, WindowWillEnterFullScreen: 1098,
WindowWillEnterFullScreen: 1099, WindowWillEnterVersionBrowser: 1099,
WindowWillEnterVersionBrowser: 1100, WindowWillExitFullScreen: 1100,
WindowWillExitFullScreen: 1101, WindowWillExitVersionBrowser: 1101,
WindowWillExitVersionBrowser: 1102, WindowWillFocus: 1102,
WindowWillFocus: 1103, WindowWillMiniaturize: 1103,
WindowWillMiniaturize: 1104, WindowWillMove: 1104,
WindowWillMove: 1105, WindowWillOrderOffScreen: 1105,
WindowWillOrderOffScreen: 1106, WindowWillOrderOnScreen: 1106,
WindowWillOrderOnScreen: 1107, WindowWillResignMain: 1107,
WindowWillResignMain: 1108, WindowWillResize: 1108,
WindowWillResize: 1109, WindowWillUnfocus: 1109,
WindowWillUnfocus: 1110, WindowWillUpdate: 1110,
WindowWillUpdate: 1111, WindowWillUpdateAlpha: 1111,
WindowWillUpdateAlpha: 1112, WindowWillUpdateCollectionBehavior: 1112,
WindowWillUpdateCollectionBehavior: 1113, WindowWillUpdateCollectionProperties: 1113,
WindowWillUpdateCollectionProperties: 1114, WindowWillUpdateShadow: 1114,
WindowWillUpdateShadow: 1115, WindowWillUpdateTitle: 1115,
WindowWillUpdateTitle: 1116, WindowWillUpdateToolbar: 1116,
WindowWillUpdateToolbar: 1117, WindowWillUpdateVisibility: 1117,
WindowWillUpdateVisibility: 1118, WindowWillUseStandardFrame: 1118,
WindowWillUseStandardFrame: 1119, MenuWillOpen: 1119,
MenuWillOpen: 1120, MenuDidOpen: 1120,
MenuDidOpen: 1121, MenuDidClose: 1121,
MenuDidClose: 1122, MenuWillSendAction: 1122,
MenuWillSendAction: 1123, MenuDidSendAction: 1123,
MenuDidSendAction: 1124, MenuWillHighlightItem: 1124,
MenuWillHighlightItem: 1125, MenuDidHighlightItem: 1125,
MenuDidHighlightItem: 1126, MenuWillDisplayItem: 1126,
MenuWillDisplayItem: 1127, MenuDidDisplayItem: 1127,
MenuDidDisplayItem: 1128, MenuWillAddItem: 1128,
MenuWillAddItem: 1129, MenuDidAddItem: 1129,
MenuDidAddItem: 1130, MenuWillRemoveItem: 1130,
MenuWillRemoveItem: 1131, MenuDidRemoveItem: 1131,
MenuDidRemoveItem: 1132, MenuWillBeginTracking: 1132,
MenuWillBeginTracking: 1133, MenuDidBeginTracking: 1133,
MenuDidBeginTracking: 1134, MenuWillEndTracking: 1134,
MenuWillEndTracking: 1135, MenuDidEndTracking: 1135,
MenuDidEndTracking: 1136, MenuWillUpdate: 1136,
MenuWillUpdate: 1137, MenuDidUpdate: 1137,
MenuDidUpdate: 1138, MenuWillPopUp: 1138,
MenuWillPopUp: 1139, MenuDidPopUp: 1139,
MenuDidPopUp: 1140, MenuWillSendActionToItem: 1140,
MenuWillSendActionToItem: 1141, MenuDidSendActionToItem: 1141,
MenuDidSendActionToItem: 1142, WebViewDidStartProvisionalNavigation: 1142,
WebViewDidStartProvisionalNavigation: 1143, WebViewDidReceiveServerRedirectForProvisionalNavigation: 1143,
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1144, WebViewDidFinishNavigation: 1144,
WebViewDidFinishNavigation: 1145, WebViewDidCommitNavigation: 1145,
WebViewDidCommitNavigation: 1146, WindowFileDraggingEntered: 1146,
WindowFileDraggingEntered: 1147, WindowFileDraggingPerformed: 1147,
WindowFileDraggingPerformed: 1148, WindowFileDraggingExited: 1148,
WindowFileDraggingExited: 1149,
} }
} }
@ -359,31 +357,31 @@ type windowsEvents struct {
func newWindowsEvents() windowsEvents { func newWindowsEvents() windowsEvents {
return windowsEvents{ return windowsEvents{
SystemThemeChanged: 1150, SystemThemeChanged: 1149,
APMPowerStatusChange: 1151, APMPowerStatusChange: 1150,
APMSuspend: 1152, APMSuspend: 1151,
APMResumeAutomatic: 1153, APMResumeAutomatic: 1152,
APMResumeSuspend: 1154, APMResumeSuspend: 1153,
APMPowerSettingChange: 1155, APMPowerSettingChange: 1154,
ApplicationStarted: 1156, ApplicationStarted: 1155,
WebViewNavigationCompleted: 1157, WebViewNavigationCompleted: 1156,
WindowInactive: 1158, WindowInactive: 1157,
WindowActive: 1159, WindowActive: 1158,
WindowClickActive: 1160, WindowClickActive: 1159,
WindowMaximise: 1161, WindowMaximise: 1160,
WindowUnMaximise: 1162, WindowUnMaximise: 1161,
WindowFullscreen: 1163, WindowFullscreen: 1162,
WindowUnFullscreen: 1164, WindowUnFullscreen: 1163,
WindowRestore: 1165, WindowRestore: 1164,
WindowMinimise: 1166, WindowMinimise: 1165,
WindowUnMinimise: 1167, WindowUnMinimise: 1166,
WindowClose: 1168, WindowClose: 1167,
WindowSetFocus: 1169, WindowSetFocus: 1168,
WindowKillFocus: 1170, WindowKillFocus: 1169,
WindowDragDrop: 1171, WindowDragDrop: 1170,
WindowDragEnter: 1172, WindowDragEnter: 1171,
WindowDragLeave: 1173, WindowDragLeave: 1172,
WindowDragOver: 1174, WindowDragOver: 1173,
} }
} }
@ -413,155 +411,154 @@ var eventToJS = map[uint]string{
1042: "mac:ApplicationWillTerminate", 1042: "mac:ApplicationWillTerminate",
1043: "mac:ApplicationWillUnhide", 1043: "mac:ApplicationWillUnhide",
1044: "mac:ApplicationWillUpdate", 1044: "mac:ApplicationWillUpdate",
1045: "mac:ApplicationTerminate", 1045: "mac:ApplicationDidChangeTheme!",
1046: "mac:ApplicationDidChangeTheme!", 1046: "mac:ApplicationShouldHandleReopen!",
1047: "mac:ApplicationShouldHandleReopen!", 1047: "mac:WindowDidBecomeKey",
1048: "mac:WindowDidBecomeKey", 1048: "mac:WindowDidBecomeMain",
1049: "mac:WindowDidBecomeMain", 1049: "mac:WindowDidBeginSheet",
1050: "mac:WindowDidBeginSheet", 1050: "mac:WindowDidChangeAlpha",
1051: "mac:WindowDidChangeAlpha", 1051: "mac:WindowDidChangeBackingLocation",
1052: "mac:WindowDidChangeBackingLocation", 1052: "mac:WindowDidChangeBackingProperties",
1053: "mac:WindowDidChangeBackingProperties", 1053: "mac:WindowDidChangeCollectionBehavior",
1054: "mac:WindowDidChangeCollectionBehavior", 1054: "mac:WindowDidChangeEffectiveAppearance",
1055: "mac:WindowDidChangeEffectiveAppearance", 1055: "mac:WindowDidChangeOcclusionState",
1056: "mac:WindowDidChangeOcclusionState", 1056: "mac:WindowDidChangeOrderingMode",
1057: "mac:WindowDidChangeOrderingMode", 1057: "mac:WindowDidChangeScreen",
1058: "mac:WindowDidChangeScreen", 1058: "mac:WindowDidChangeScreenParameters",
1059: "mac:WindowDidChangeScreenParameters", 1059: "mac:WindowDidChangeScreenProfile",
1060: "mac:WindowDidChangeScreenProfile", 1060: "mac:WindowDidChangeScreenSpace",
1061: "mac:WindowDidChangeScreenSpace", 1061: "mac:WindowDidChangeScreenSpaceProperties",
1062: "mac:WindowDidChangeScreenSpaceProperties", 1062: "mac:WindowDidChangeSharingType",
1063: "mac:WindowDidChangeSharingType", 1063: "mac:WindowDidChangeSpace",
1064: "mac:WindowDidChangeSpace", 1064: "mac:WindowDidChangeSpaceOrderingMode",
1065: "mac:WindowDidChangeSpaceOrderingMode", 1065: "mac:WindowDidChangeTitle",
1066: "mac:WindowDidChangeTitle", 1066: "mac:WindowDidChangeToolbar",
1067: "mac:WindowDidChangeToolbar", 1067: "mac:WindowDidChangeVisibility",
1068: "mac:WindowDidChangeVisibility", 1068: "mac:WindowDidDeminiaturize",
1069: "mac:WindowDidDeminiaturize", 1069: "mac:WindowDidEndSheet",
1070: "mac:WindowDidEndSheet", 1070: "mac:WindowDidEnterFullScreen",
1071: "mac:WindowDidEnterFullScreen", 1071: "mac:WindowDidEnterVersionBrowser",
1072: "mac:WindowDidEnterVersionBrowser", 1072: "mac:WindowDidExitFullScreen",
1073: "mac:WindowDidExitFullScreen", 1073: "mac:WindowDidExitVersionBrowser",
1074: "mac:WindowDidExitVersionBrowser", 1074: "mac:WindowDidExpose",
1075: "mac:WindowDidExpose", 1075: "mac:WindowDidFocus",
1076: "mac:WindowDidFocus", 1076: "mac:WindowDidMiniaturize",
1077: "mac:WindowDidMiniaturize", 1077: "mac:WindowDidMove",
1078: "mac:WindowDidMove", 1078: "mac:WindowDidOrderOffScreen",
1079: "mac:WindowDidOrderOffScreen", 1079: "mac:WindowDidOrderOnScreen",
1080: "mac:WindowDidOrderOnScreen", 1080: "mac:WindowDidResignKey",
1081: "mac:WindowDidResignKey", 1081: "mac:WindowDidResignMain",
1082: "mac:WindowDidResignMain", 1082: "mac:WindowDidResize",
1083: "mac:WindowDidResize", 1083: "mac:WindowDidUpdate",
1084: "mac:WindowDidUpdate", 1084: "mac:WindowDidUpdateAlpha",
1085: "mac:WindowDidUpdateAlpha", 1085: "mac:WindowDidUpdateCollectionBehavior",
1086: "mac:WindowDidUpdateCollectionBehavior", 1086: "mac:WindowDidUpdateCollectionProperties",
1087: "mac:WindowDidUpdateCollectionProperties", 1087: "mac:WindowDidUpdateShadow",
1088: "mac:WindowDidUpdateShadow", 1088: "mac:WindowDidUpdateTitle",
1089: "mac:WindowDidUpdateTitle", 1089: "mac:WindowDidUpdateToolbar",
1090: "mac:WindowDidUpdateToolbar", 1090: "mac:WindowDidUpdateVisibility",
1091: "mac:WindowDidUpdateVisibility", 1091: "mac:WindowShouldClose!",
1092: "mac:WindowShouldClose!", 1092: "mac:WindowWillBecomeKey",
1093: "mac:WindowWillBecomeKey", 1093: "mac:WindowWillBecomeMain",
1094: "mac:WindowWillBecomeMain", 1094: "mac:WindowWillBeginSheet",
1095: "mac:WindowWillBeginSheet", 1095: "mac:WindowWillChangeOrderingMode",
1096: "mac:WindowWillChangeOrderingMode", 1096: "mac:WindowWillClose",
1097: "mac:WindowWillClose", 1097: "mac:WindowWillDeminiaturize",
1098: "mac:WindowWillDeminiaturize", 1098: "mac:WindowWillEnterFullScreen",
1099: "mac:WindowWillEnterFullScreen", 1099: "mac:WindowWillEnterVersionBrowser",
1100: "mac:WindowWillEnterVersionBrowser", 1100: "mac:WindowWillExitFullScreen",
1101: "mac:WindowWillExitFullScreen", 1101: "mac:WindowWillExitVersionBrowser",
1102: "mac:WindowWillExitVersionBrowser", 1102: "mac:WindowWillFocus",
1103: "mac:WindowWillFocus", 1103: "mac:WindowWillMiniaturize",
1104: "mac:WindowWillMiniaturize", 1104: "mac:WindowWillMove",
1105: "mac:WindowWillMove", 1105: "mac:WindowWillOrderOffScreen",
1106: "mac:WindowWillOrderOffScreen", 1106: "mac:WindowWillOrderOnScreen",
1107: "mac:WindowWillOrderOnScreen", 1107: "mac:WindowWillResignMain",
1108: "mac:WindowWillResignMain", 1108: "mac:WindowWillResize",
1109: "mac:WindowWillResize", 1109: "mac:WindowWillUnfocus",
1110: "mac:WindowWillUnfocus", 1110: "mac:WindowWillUpdate",
1111: "mac:WindowWillUpdate", 1111: "mac:WindowWillUpdateAlpha",
1112: "mac:WindowWillUpdateAlpha", 1112: "mac:WindowWillUpdateCollectionBehavior",
1113: "mac:WindowWillUpdateCollectionBehavior", 1113: "mac:WindowWillUpdateCollectionProperties",
1114: "mac:WindowWillUpdateCollectionProperties", 1114: "mac:WindowWillUpdateShadow",
1115: "mac:WindowWillUpdateShadow", 1115: "mac:WindowWillUpdateTitle",
1116: "mac:WindowWillUpdateTitle", 1116: "mac:WindowWillUpdateToolbar",
1117: "mac:WindowWillUpdateToolbar", 1117: "mac:WindowWillUpdateVisibility",
1118: "mac:WindowWillUpdateVisibility", 1118: "mac:WindowWillUseStandardFrame",
1119: "mac:WindowWillUseStandardFrame", 1119: "mac:MenuWillOpen",
1120: "mac:MenuWillOpen", 1120: "mac:MenuDidOpen",
1121: "mac:MenuDidOpen", 1121: "mac:MenuDidClose",
1122: "mac:MenuDidClose", 1122: "mac:MenuWillSendAction",
1123: "mac:MenuWillSendAction", 1123: "mac:MenuDidSendAction",
1124: "mac:MenuDidSendAction", 1124: "mac:MenuWillHighlightItem",
1125: "mac:MenuWillHighlightItem", 1125: "mac:MenuDidHighlightItem",
1126: "mac:MenuDidHighlightItem", 1126: "mac:MenuWillDisplayItem",
1127: "mac:MenuWillDisplayItem", 1127: "mac:MenuDidDisplayItem",
1128: "mac:MenuDidDisplayItem", 1128: "mac:MenuWillAddItem",
1129: "mac:MenuWillAddItem", 1129: "mac:MenuDidAddItem",
1130: "mac:MenuDidAddItem", 1130: "mac:MenuWillRemoveItem",
1131: "mac:MenuWillRemoveItem", 1131: "mac:MenuDidRemoveItem",
1132: "mac:MenuDidRemoveItem", 1132: "mac:MenuWillBeginTracking",
1133: "mac:MenuWillBeginTracking", 1133: "mac:MenuDidBeginTracking",
1134: "mac:MenuDidBeginTracking", 1134: "mac:MenuWillEndTracking",
1135: "mac:MenuWillEndTracking", 1135: "mac:MenuDidEndTracking",
1136: "mac:MenuDidEndTracking", 1136: "mac:MenuWillUpdate",
1137: "mac:MenuWillUpdate", 1137: "mac:MenuDidUpdate",
1138: "mac:MenuDidUpdate", 1138: "mac:MenuWillPopUp",
1139: "mac:MenuWillPopUp", 1139: "mac:MenuDidPopUp",
1140: "mac:MenuDidPopUp", 1140: "mac:MenuWillSendActionToItem",
1141: "mac:MenuWillSendActionToItem", 1141: "mac:MenuDidSendActionToItem",
1142: "mac:MenuDidSendActionToItem", 1142: "mac:WebViewDidStartProvisionalNavigation",
1143: "mac:WebViewDidStartProvisionalNavigation", 1143: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
1144: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation", 1144: "mac:WebViewDidFinishNavigation",
1145: "mac:WebViewDidFinishNavigation", 1145: "mac:WebViewDidCommitNavigation",
1146: "mac:WebViewDidCommitNavigation", 1146: "mac:WindowFileDraggingEntered",
1147: "mac:WindowFileDraggingEntered", 1147: "mac:WindowFileDraggingPerformed",
1148: "mac:WindowFileDraggingPerformed", 1148: "mac:WindowFileDraggingExited",
1149: "mac:WindowFileDraggingExited", 1149: "windows:SystemThemeChanged",
1150: "windows:SystemThemeChanged", 1150: "windows:APMPowerStatusChange",
1151: "windows:APMPowerStatusChange", 1151: "windows:APMSuspend",
1152: "windows:APMSuspend", 1152: "windows:APMResumeAutomatic",
1153: "windows:APMResumeAutomatic", 1153: "windows:APMResumeSuspend",
1154: "windows:APMResumeSuspend", 1154: "windows:APMPowerSettingChange",
1155: "windows:APMPowerSettingChange", 1155: "windows:ApplicationStarted",
1156: "windows:ApplicationStarted", 1156: "windows:WebViewNavigationCompleted",
1157: "windows:WebViewNavigationCompleted", 1157: "windows:WindowInactive",
1158: "windows:WindowInactive", 1158: "windows:WindowActive",
1159: "windows:WindowActive", 1159: "windows:WindowClickActive",
1160: "windows:WindowClickActive", 1160: "windows:WindowMaximise",
1161: "windows:WindowMaximise", 1161: "windows:WindowUnMaximise",
1162: "windows:WindowUnMaximise", 1162: "windows:WindowFullscreen",
1163: "windows:WindowFullscreen", 1163: "windows:WindowUnFullscreen",
1164: "windows:WindowUnFullscreen", 1164: "windows:WindowRestore",
1165: "windows:WindowRestore", 1165: "windows:WindowMinimise",
1166: "windows:WindowMinimise", 1166: "windows:WindowUnMinimise",
1167: "windows:WindowUnMinimise", 1167: "windows:WindowClose",
1168: "windows:WindowClose", 1168: "windows:WindowSetFocus",
1169: "windows:WindowSetFocus", 1169: "windows:WindowKillFocus",
1170: "windows:WindowKillFocus", 1170: "windows:WindowDragDrop",
1171: "windows:WindowDragDrop", 1171: "windows:WindowDragEnter",
1172: "windows:WindowDragEnter", 1172: "windows:WindowDragLeave",
1173: "windows:WindowDragLeave", 1173: "windows:WindowDragOver",
1174: "windows:WindowDragOver", 1174: "common:ApplicationStarted",
1175: "common:ApplicationStarted", 1175: "common:WindowMaximise",
1176: "common:WindowMaximise", 1176: "common:WindowUnMaximise",
1177: "common:WindowUnMaximise", 1177: "common:WindowFullscreen",
1178: "common:WindowFullscreen", 1178: "common:WindowUnFullscreen",
1179: "common:WindowUnFullscreen", 1179: "common:WindowRestore",
1180: "common:WindowRestore", 1180: "common:WindowMinimise",
1181: "common:WindowMinimise", 1181: "common:WindowUnMinimise",
1182: "common:WindowUnMinimise", 1182: "common:WindowClosing",
1183: "common:WindowClosing", 1183: "common:WindowZoom",
1184: "common:WindowZoom", 1184: "common:WindowZoomIn",
1185: "common:WindowZoomIn", 1185: "common:WindowZoomOut",
1186: "common:WindowZoomOut", 1186: "common:WindowZoomReset",
1187: "common:WindowZoomReset", 1187: "common:WindowFocus",
1188: "common:WindowFocus", 1188: "common:WindowLostFocus",
1189: "common:WindowLostFocus", 1189: "common:WindowShow",
1190: "common:WindowShow", 1190: "common:WindowHide",
1191: "common:WindowHide", 1191: "common:WindowDPIChanged",
1192: "common:WindowDPIChanged", 1192: "common:WindowFilesDropped",
1193: "common:WindowFilesDropped", 1193: "common:ThemeChanged",
1194: "common:ThemeChanged", 1194: "common:ApplicationTerminate",
1195: "common:ApplicationTerminate",
} }

View File

@ -19,7 +19,6 @@ mac:ApplicationWillResignActive
mac:ApplicationWillTerminate mac:ApplicationWillTerminate
mac:ApplicationWillUnhide mac:ApplicationWillUnhide
mac:ApplicationWillUpdate mac:ApplicationWillUpdate
mac:ApplicationTerminate
mac:ApplicationDidChangeTheme! mac:ApplicationDidChangeTheme!
mac:ApplicationShouldHandleReopen! mac:ApplicationShouldHandleReopen!
mac:WindowDidBecomeKey mac:WindowDidBecomeKey

View File

@ -1,137 +1,137 @@
//go:build darwin //go:build darwin
#ifndef _events_darwin_h #ifndef _events_h
#define _events_darwin_h #define _events_h
extern void processApplicationEvent(unsigned int, void* data); extern void processApplicationEvent(unsigned int, void* data);
extern void processWindowEvent(unsigned int, unsigned int); extern void processWindowEvent(unsigned int, unsigned int);
#define EventApplicationDidBecomeActive 1024 #define EventApplicationDidBecomeActive 1025
#define EventApplicationDidChangeBackingProperties 1025 #define EventApplicationDidChangeBackingProperties 1026
#define EventApplicationDidChangeEffectiveAppearance 1026 #define EventApplicationDidChangeEffectiveAppearance 1027
#define EventApplicationDidChangeIcon 1027 #define EventApplicationDidChangeIcon 1028
#define EventApplicationDidChangeOcclusionState 1028 #define EventApplicationDidChangeOcclusionState 1029
#define EventApplicationDidChangeScreenParameters 1029 #define EventApplicationDidChangeScreenParameters 1030
#define EventApplicationDidChangeStatusBarFrame 1030 #define EventApplicationDidChangeStatusBarFrame 1031
#define EventApplicationDidChangeStatusBarOrientation 1031 #define EventApplicationDidChangeStatusBarOrientation 1032
#define EventApplicationDidFinishLaunching 1032 #define EventApplicationDidFinishLaunching 1033
#define EventApplicationDidHide 1033 #define EventApplicationDidHide 1034
#define EventApplicationDidResignActiveNotification 1034 #define EventApplicationDidResignActiveNotification 1035
#define EventApplicationDidUnhide 1035 #define EventApplicationDidUnhide 1036
#define EventApplicationDidUpdate 1036 #define EventApplicationDidUpdate 1037
#define EventApplicationWillBecomeActive 1037 #define EventApplicationWillBecomeActive 1038
#define EventApplicationWillFinishLaunching 1038 #define EventApplicationWillFinishLaunching 1039
#define EventApplicationWillHide 1039 #define EventApplicationWillHide 1040
#define EventApplicationWillResignActive 1040 #define EventApplicationWillResignActive 1041
#define EventApplicationWillTerminate 1041 #define EventApplicationWillTerminate 1042
#define EventApplicationWillUnhide 1042 #define EventApplicationWillUnhide 1043
#define EventApplicationWillUpdate 1043 #define EventApplicationWillUpdate 1044
#define EventApplicationDidChangeTheme 1044 #define EventApplicationDidChangeTheme 1045
#define EventApplicationShouldHandleReopen 1045 #define EventApplicationShouldHandleReopen 1046
#define EventWindowDidBecomeKey 1046 #define EventWindowDidBecomeKey 1047
#define EventWindowDidBecomeMain 1047 #define EventWindowDidBecomeMain 1048
#define EventWindowDidBeginSheet 1048 #define EventWindowDidBeginSheet 1049
#define EventWindowDidChangeAlpha 1049 #define EventWindowDidChangeAlpha 1050
#define EventWindowDidChangeBackingLocation 1050 #define EventWindowDidChangeBackingLocation 1051
#define EventWindowDidChangeBackingProperties 1051 #define EventWindowDidChangeBackingProperties 1052
#define EventWindowDidChangeCollectionBehavior 1052 #define EventWindowDidChangeCollectionBehavior 1053
#define EventWindowDidChangeEffectiveAppearance 1053 #define EventWindowDidChangeEffectiveAppearance 1054
#define EventWindowDidChangeOcclusionState 1054 #define EventWindowDidChangeOcclusionState 1055
#define EventWindowDidChangeOrderingMode 1055 #define EventWindowDidChangeOrderingMode 1056
#define EventWindowDidChangeScreen 1056 #define EventWindowDidChangeScreen 1057
#define EventWindowDidChangeScreenParameters 1057 #define EventWindowDidChangeScreenParameters 1058
#define EventWindowDidChangeScreenProfile 1058 #define EventWindowDidChangeScreenProfile 1059
#define EventWindowDidChangeScreenSpace 1059 #define EventWindowDidChangeScreenSpace 1060
#define EventWindowDidChangeScreenSpaceProperties 1060 #define EventWindowDidChangeScreenSpaceProperties 1061
#define EventWindowDidChangeSharingType 1061 #define EventWindowDidChangeSharingType 1062
#define EventWindowDidChangeSpace 1062 #define EventWindowDidChangeSpace 1063
#define EventWindowDidChangeSpaceOrderingMode 1063 #define EventWindowDidChangeSpaceOrderingMode 1064
#define EventWindowDidChangeTitle 1064 #define EventWindowDidChangeTitle 1065
#define EventWindowDidChangeToolbar 1065 #define EventWindowDidChangeToolbar 1066
#define EventWindowDidChangeVisibility 1066 #define EventWindowDidChangeVisibility 1067
#define EventWindowDidDeminiaturize 1067 #define EventWindowDidDeminiaturize 1068
#define EventWindowDidEndSheet 1068 #define EventWindowDidEndSheet 1069
#define EventWindowDidEnterFullScreen 1069 #define EventWindowDidEnterFullScreen 1070
#define EventWindowDidEnterVersionBrowser 1070 #define EventWindowDidEnterVersionBrowser 1071
#define EventWindowDidExitFullScreen 1071 #define EventWindowDidExitFullScreen 1072
#define EventWindowDidExitVersionBrowser 1072 #define EventWindowDidExitVersionBrowser 1073
#define EventWindowDidExpose 1073 #define EventWindowDidExpose 1074
#define EventWindowDidFocus 1074 #define EventWindowDidFocus 1075
#define EventWindowDidMiniaturize 1075 #define EventWindowDidMiniaturize 1076
#define EventWindowDidMove 1076 #define EventWindowDidMove 1077
#define EventWindowDidOrderOffScreen 1077 #define EventWindowDidOrderOffScreen 1078
#define EventWindowDidOrderOnScreen 1078 #define EventWindowDidOrderOnScreen 1079
#define EventWindowDidResignKey 1079 #define EventWindowDidResignKey 1080
#define EventWindowDidResignMain 1080 #define EventWindowDidResignMain 1081
#define EventWindowDidResize 1081 #define EventWindowDidResize 1082
#define EventWindowDidUpdate 1082 #define EventWindowDidUpdate 1083
#define EventWindowDidUpdateAlpha 1083 #define EventWindowDidUpdateAlpha 1084
#define EventWindowDidUpdateCollectionBehavior 1084 #define EventWindowDidUpdateCollectionBehavior 1085
#define EventWindowDidUpdateCollectionProperties 1085 #define EventWindowDidUpdateCollectionProperties 1086
#define EventWindowDidUpdateShadow 1086 #define EventWindowDidUpdateShadow 1087
#define EventWindowDidUpdateTitle 1087 #define EventWindowDidUpdateTitle 1088
#define EventWindowDidUpdateToolbar 1088 #define EventWindowDidUpdateToolbar 1089
#define EventWindowDidUpdateVisibility 1089 #define EventWindowDidUpdateVisibility 1090
#define EventWindowShouldClose 1090 #define EventWindowShouldClose 1091
#define EventWindowWillBecomeKey 1091 #define EventWindowWillBecomeKey 1092
#define EventWindowWillBecomeMain 1092 #define EventWindowWillBecomeMain 1093
#define EventWindowWillBeginSheet 1093 #define EventWindowWillBeginSheet 1094
#define EventWindowWillChangeOrderingMode 1094 #define EventWindowWillChangeOrderingMode 1095
#define EventWindowWillClose 1095 #define EventWindowWillClose 1096
#define EventWindowWillDeminiaturize 1096 #define EventWindowWillDeminiaturize 1097
#define EventWindowWillEnterFullScreen 1097 #define EventWindowWillEnterFullScreen 1098
#define EventWindowWillEnterVersionBrowser 1098 #define EventWindowWillEnterVersionBrowser 1099
#define EventWindowWillExitFullScreen 1099 #define EventWindowWillExitFullScreen 1100
#define EventWindowWillExitVersionBrowser 1100 #define EventWindowWillExitVersionBrowser 1101
#define EventWindowWillFocus 1101 #define EventWindowWillFocus 1102
#define EventWindowWillMiniaturize 1102 #define EventWindowWillMiniaturize 1103
#define EventWindowWillMove 1103 #define EventWindowWillMove 1104
#define EventWindowWillOrderOffScreen 1104 #define EventWindowWillOrderOffScreen 1105
#define EventWindowWillOrderOnScreen 1105 #define EventWindowWillOrderOnScreen 1106
#define EventWindowWillResignMain 1106 #define EventWindowWillResignMain 1107
#define EventWindowWillResize 1107 #define EventWindowWillResize 1108
#define EventWindowWillUnfocus 1108 #define EventWindowWillUnfocus 1109
#define EventWindowWillUpdate 1109 #define EventWindowWillUpdate 1110
#define EventWindowWillUpdateAlpha 1110 #define EventWindowWillUpdateAlpha 1111
#define EventWindowWillUpdateCollectionBehavior 1111 #define EventWindowWillUpdateCollectionBehavior 1112
#define EventWindowWillUpdateCollectionProperties 1112 #define EventWindowWillUpdateCollectionProperties 1113
#define EventWindowWillUpdateShadow 1113 #define EventWindowWillUpdateShadow 1114
#define EventWindowWillUpdateTitle 1114 #define EventWindowWillUpdateTitle 1115
#define EventWindowWillUpdateToolbar 1115 #define EventWindowWillUpdateToolbar 1116
#define EventWindowWillUpdateVisibility 1116 #define EventWindowWillUpdateVisibility 1117
#define EventWindowWillUseStandardFrame 1117 #define EventWindowWillUseStandardFrame 1118
#define EventMenuWillOpen 1118 #define EventMenuWillOpen 1119
#define EventMenuDidOpen 1119 #define EventMenuDidOpen 1120
#define EventMenuDidClose 1120 #define EventMenuDidClose 1121
#define EventMenuWillSendAction 1121 #define EventMenuWillSendAction 1122
#define EventMenuDidSendAction 1122 #define EventMenuDidSendAction 1123
#define EventMenuWillHighlightItem 1123 #define EventMenuWillHighlightItem 1124
#define EventMenuDidHighlightItem 1124 #define EventMenuDidHighlightItem 1125
#define EventMenuWillDisplayItem 1125 #define EventMenuWillDisplayItem 1126
#define EventMenuDidDisplayItem 1126 #define EventMenuDidDisplayItem 1127
#define EventMenuWillAddItem 1127 #define EventMenuWillAddItem 1128
#define EventMenuDidAddItem 1128 #define EventMenuDidAddItem 1129
#define EventMenuWillRemoveItem 1129 #define EventMenuWillRemoveItem 1130
#define EventMenuDidRemoveItem 1130 #define EventMenuDidRemoveItem 1131
#define EventMenuWillBeginTracking 1131 #define EventMenuWillBeginTracking 1132
#define EventMenuDidBeginTracking 1132 #define EventMenuDidBeginTracking 1133
#define EventMenuWillEndTracking 1133 #define EventMenuWillEndTracking 1134
#define EventMenuDidEndTracking 1134 #define EventMenuDidEndTracking 1135
#define EventMenuWillUpdate 1135 #define EventMenuWillUpdate 1136
#define EventMenuDidUpdate 1136 #define EventMenuDidUpdate 1137
#define EventMenuWillPopUp 1137 #define EventMenuWillPopUp 1138
#define EventMenuDidPopUp 1138 #define EventMenuDidPopUp 1139
#define EventMenuWillSendActionToItem 1139 #define EventMenuWillSendActionToItem 1140
#define EventMenuDidSendActionToItem 1140 #define EventMenuDidSendActionToItem 1141
#define EventWebViewDidStartProvisionalNavigation 1141 #define EventWebViewDidStartProvisionalNavigation 1142
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1142 #define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1143
#define EventWebViewDidFinishNavigation 1143 #define EventWebViewDidFinishNavigation 1144
#define EventWebViewDidCommitNavigation 1144 #define EventWebViewDidCommitNavigation 1145
#define EventWindowFileDraggingEntered 1145 #define EventWindowFileDraggingEntered 1146
#define EventWindowFileDraggingPerformed 1146 #define EventWindowFileDraggingPerformed 1147
#define EventWindowFileDraggingExited 1147 #define EventWindowFileDraggingExited 1148
#define MAX_EVENTS 1148 #define MAX_EVENTS 1149
#endif #endif

View File

@ -298,7 +298,7 @@ func main() {
// Save the eventsH template substituting the values and decls // Save the eventsH template substituting the values and decls
templateToWrite = strings.ReplaceAll(eventsH, "$$CHEADEREVENTS", cHeaderEvents.String()) templateToWrite = strings.ReplaceAll(eventsH, "$$CHEADEREVENTS", cHeaderEvents.String())
err = os.WriteFile("../../pkg/events/events.h", []byte(templateToWrite), 0644) err = os.WriteFile("../../pkg/events/events_darwin.h", []byte(templateToWrite), 0644)
if err != nil { if err != nil {
panic(err) panic(err)
} }