diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/src/event_types.js b/v3/internal/runtime/desktop/@wailsio/runtime/src/event_types.js index 76aa8135e..b5d0015ef 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/src/event_types.js +++ b/v3/internal/runtime/desktop/@wailsio/runtime/src/event_types.js @@ -155,6 +155,9 @@ export const EventTypes = { }, Linux: { SystemThemeChanged: "linux:SystemThemeChanged", + WindowLoadChanged: "linux:WindowLoadChanged", + WindowDeleteEvent: "linux:WindowDeleteEvent", + ApplicationStartup: "linux:ApplicationStartup", }, Common: { ApplicationStarted: "common:ApplicationStarted", diff --git a/v3/internal/runtime/desktop/@wailsio/runtime/types/event_types.d.ts b/v3/internal/runtime/desktop/@wailsio/runtime/types/event_types.d.ts index 6c04c9e6b..dad1f2f7a 100644 --- a/v3/internal/runtime/desktop/@wailsio/runtime/types/event_types.d.ts +++ b/v3/internal/runtime/desktop/@wailsio/runtime/types/event_types.d.ts @@ -155,6 +155,9 @@ export declare const EventTypes: { }, Linux: { SystemThemeChanged: string, + WindowLoadChanged: string, + WindowDeleteEvent: string, + ApplicationStartup: string, }, Common: { ApplicationStarted: string, diff --git a/v3/pkg/application/application_darwin_delegate.m b/v3/pkg/application/application_darwin_delegate.m index aae5b0bd7..2b91eb4d2 100644 --- a/v3/pkg/application/application_darwin_delegate.m +++ b/v3/pkg/application/application_darwin_delegate.m @@ -4,7 +4,6 @@ extern bool hasListeners(unsigned int); extern bool shouldQuitApplication(); extern void cleanup(); - @implementation AppDelegate - (void)dealloc { diff --git a/v3/pkg/application/application_linux.go b/v3/pkg/application/application_linux.go index f098a1fc4..4272cd5c3 100644 --- a/v3/pkg/application/application_linux.go +++ b/v3/pkg/application/application_linux.go @@ -2,6 +2,7 @@ package application +import "C" import ( "fmt" "log" @@ -213,3 +214,11 @@ func (a *App) logPlatformInfo() { a.info("Platform Info:", platformInfo...) } + +//export processWindowEvent +func processWindowEvent(windowID C.uint, eventID C.uint) { + windowEvents <- &windowEvent{ + WindowID: uint(windowID), + EventID: uint(eventID), + } +} diff --git a/v3/pkg/application/linux_cgo.go b/v3/pkg/application/linux_cgo.go index a669fe84c..36db3d506 100644 --- a/v3/pkg/application/linux_cgo.go +++ b/v3/pkg/application/linux_cgo.go @@ -58,8 +58,10 @@ typedef struct WindowEvent { // exported below void activateLinux(gpointer data); extern void emit(WindowEvent* data); +extern gboolean handleDeleteEvent(GtkWidget*, GdkEvent*, uintptr_t); +extern void handleLoadChanged(WebKitWebView*, WebKitLoadEvent, uintptr_t); void handleClick(void*); -extern gboolean onButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer user_data); +extern gboolean onButtonEvent(GtkWidget *widget, GdkEventButton *event, uintptr_t user_data); extern void onDragNDrop( void *target, GdkDragContext* context, @@ -69,7 +71,7 @@ extern void onDragNDrop( guint info, guint time, gpointer data); -extern gboolean onKeyPressEvent (GtkWidget *widget, GdkEventKey *event, gpointer user_data); +extern gboolean onKeyPressEvent (GtkWidget *widget, GdkEventKey *event, uintptr_t user_data); extern void onProcessRequest(void *request, gpointer user_data); extern void sendMessageToBackend(WebKitUserContentManager *contentManager, WebKitJavascriptResult *result, void *data); // exported below (end) @@ -145,6 +147,31 @@ static int GetNumScreens(){ */ import "C" +// Calloc handles alloc/dealloc of C data +type Calloc struct { + pool []unsafe.Pointer +} + +// NewCalloc creates a new allocator +func NewCalloc() Calloc { + return Calloc{} +} + +// String creates a new C string and retains a reference to it +func (c Calloc) String(in string) *C.char { + result := C.CString(in) + c.pool = append(c.pool, unsafe.Pointer(result)) + return result +} + +// Free frees all allocated C memory +func (c Calloc) Free() { + for _, str := range c.pool { + C.free(str) + } + c.pool = []unsafe.Pointer{} +} + type windowPointer *C.GtkWindow type identifier C.uint type pointer unsafe.Pointer @@ -910,36 +937,36 @@ func emit(we *C.WindowEvent) { } } -func windowSetupSignalHandlers(windowId uint, window, webview pointer, emit func(e events.WindowEventType)) { - event := C.CString("delete-event") - defer C.free(unsafe.Pointer(event)) - wEvent := C.WindowEvent{ - id: C.uint(windowId), - event: C.uint(events.Common.WindowClosing), +//export handleDeleteEvent +func handleDeleteEvent(widget *C.GtkWidget, event *C.GdkEvent, data C.uintptr_t) C.gboolean { + processWindowEvent(C.uint(data), C.uint(events.Linux.WindowDeleteEvent)) + return C.gboolean(0) +} + +//export handleLoadChanged +func handleLoadChanged(webview *C.WebKitWebView, event C.WebKitLoadEvent, data C.uintptr_t) { + switch event { + case C.WEBKIT_LOAD_FINISHED: + processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadChanged)) } - C.signal_connect(unsafe.Pointer(window), event, C.emit, unsafe.Pointer(&wEvent)) +} + +func windowSetupSignalHandlers(windowId uint, window, webview pointer, emit func(e events.WindowEventType)) { + + c := NewCalloc() + defer c.Free() + + winID := unsafe.Pointer(uintptr(C.uint(windowId))) + + // Set up the window close event + C.signal_connect(unsafe.Pointer(window), c.String("delete-event"), C.handleDeleteEvent, winID) + C.signal_connect(unsafe.Pointer(webview), c.String("load-changed"), C.handleLoadChanged, winID) contentManager := C.webkit_web_view_get_user_content_manager((*C.WebKitWebView)(webview)) - event = C.CString("script-message-received::external") - defer C.free(unsafe.Pointer(event)) - C.signal_connect(unsafe.Pointer(contentManager), event, C.sendMessageToBackend, nil) - - /* - event = C.CString("load-changed") - defer C.free(unsafe.Pointer(event)) - C.signal_connect(webview, event, C.webviewLoadChanged, unsafe.Pointer(&w.parent.id)) - */ - id := C.uint(windowId) - event = C.CString("button-press-event") - C.signal_connect(unsafe.Pointer(webview), event, C.onButtonEvent, unsafe.Pointer(&id)) - C.free(unsafe.Pointer(event)) - event = C.CString("button-release-event") - defer C.free(unsafe.Pointer(event)) - C.signal_connect(unsafe.Pointer(webview), event, C.onButtonEvent, unsafe.Pointer(&id)) - - event = C.CString("key-press-event") - defer C.free(unsafe.Pointer(event)) - C.signal_connect(unsafe.Pointer(webview), event, C.onKeyPressEvent, unsafe.Pointer(&id)) + C.signal_connect(unsafe.Pointer(contentManager), c.String("script-message-received::external"), C.sendMessageToBackend, nil) + C.signal_connect(unsafe.Pointer(webview), c.String("button-press-event"), C.onButtonEvent, winID) + C.signal_connect(unsafe.Pointer(webview), c.String("button-release-event"), C.onButtonEvent, winID) + C.signal_connect(unsafe.Pointer(webview), c.String("key-press-event"), C.onKeyPressEvent, winID) } func windowShowDevTools(webview pointer) { @@ -1004,13 +1031,13 @@ func windowMove(window pointer, x, y int) { // FIXME Change this to reflect mouse button! // //export onButtonEvent -func onButtonEvent(_ *C.GtkWidget, event *C.GdkEventButton, data unsafe.Pointer) C.gboolean { +func onButtonEvent(_ *C.GtkWidget, event *C.GdkEventButton, data C.uintptr_t) C.gboolean { // Constants (defined here to be easier to use with purego) GdkButtonPress := C.GDK_BUTTON_PRESS // 4 Gdk2ButtonPress := C.GDK_2BUTTON_PRESS // 5 for double-click GdkButtonRelease := C.GDK_BUTTON_RELEASE // 7 - windowId := uint(*((*C.uint)(data))) + windowId := uint(C.uint(data)) window := globalApplication.getWindowForID(windowId) if window == nil { return C.gboolean(0) @@ -1068,8 +1095,8 @@ func onDragNDrop(target unsafe.Pointer, context *C.GdkDragContext, x C.gint, y C } //export onKeyPressEvent -func onKeyPressEvent(widget *C.GtkWidget, event *C.GdkEventKey, userData unsafe.Pointer) C.gboolean { - windowID := uint(*((*C.uint)(userData))) +func onKeyPressEvent(widget *C.GtkWidget, event *C.GdkEventKey, userData C.uintptr_t) C.gboolean { + windowID := uint(C.uint(userData)) accelerator, ok := getKeyboardState(event) if !ok { return C.gboolean(1) diff --git a/v3/pkg/application/webview_window_linux.go b/v3/pkg/application/webview_window_linux.go index 748d8a6a4..1f36059ee 100644 --- a/v3/pkg/application/webview_window_linux.go +++ b/v3/pkg/application/webview_window_linux.go @@ -6,6 +6,7 @@ import ( "fmt" "github.com/wailsapp/wails/v3/internal/assetserver" "github.com/wailsapp/wails/v3/internal/capabilities" + "github.com/wailsapp/wails/v3/internal/runtime" "github.com/wailsapp/wails/v3/pkg/events" ) @@ -395,6 +396,7 @@ func (w *linuxWebviewWindow) run() { w.minimise() case WindowStateFullscreen: w.fullscreen() + case WindowStateNormal: } startURL, err := assetserver.GetStartURL(w.parent.options.URL) @@ -414,6 +416,9 @@ func (w *linuxWebviewWindow) run() { w.execJS(js) } }) + w.parent.RegisterHook(events.Linux.WindowLoadChanged, func(e *WindowEvent) { + w.execJS(runtime.Core()) + }) if w.parent.options.HTML != "" { w.setHTML(w.parent.options.HTML) } diff --git a/v3/pkg/events/events.go b/v3/pkg/events/events.go index 505308c12..1923c87e7 100644 --- a/v3/pkg/events/events.go +++ b/v3/pkg/events/events.go @@ -31,27 +31,27 @@ type commonEvents struct { func newCommonEvents() commonEvents { return commonEvents{ - ApplicationStarted: 1174, - WindowMaximise: 1175, - WindowUnMaximise: 1176, - WindowFullscreen: 1177, - WindowUnFullscreen: 1178, - WindowRestore: 1179, - WindowMinimise: 1180, - WindowUnMinimise: 1181, - WindowClosing: 1182, - WindowZoom: 1183, - WindowZoomIn: 1184, - WindowZoomOut: 1185, - WindowZoomReset: 1186, - WindowFocus: 1187, - WindowLostFocus: 1188, - WindowShow: 1189, - WindowHide: 1190, - WindowDPIChanged: 1191, - WindowFilesDropped: 1192, - WindowRuntimeReady: 1193, - ThemeChanged: 1194, + ApplicationStarted: 1177, + WindowMaximise: 1178, + WindowUnMaximise: 1179, + WindowFullscreen: 1180, + WindowUnFullscreen: 1181, + WindowRestore: 1182, + WindowMinimise: 1183, + WindowUnMinimise: 1184, + WindowClosing: 1185, + WindowZoom: 1186, + WindowZoomIn: 1187, + WindowZoomOut: 1188, + WindowZoomReset: 1189, + WindowFocus: 1190, + WindowLostFocus: 1191, + WindowShow: 1192, + WindowHide: 1193, + WindowDPIChanged: 1194, + WindowFilesDropped: 1195, + WindowRuntimeReady: 1196, + ThemeChanged: 1197, } } @@ -59,11 +59,17 @@ var Linux = newLinuxEvents() type linuxEvents struct { SystemThemeChanged ApplicationEventType + WindowLoadChanged WindowEventType + WindowDeleteEvent WindowEventType + ApplicationStartup ApplicationEventType } func newLinuxEvents() linuxEvents { return linuxEvents{ SystemThemeChanged: 1024, + WindowLoadChanged: 1025, + WindowDeleteEvent: 1026, + ApplicationStartup: 1027, } } @@ -198,130 +204,130 @@ type macEvents struct { func newMacEvents() macEvents { return macEvents{ - ApplicationDidBecomeActive: 1025, - ApplicationDidChangeBackingProperties: 1026, - ApplicationDidChangeEffectiveAppearance: 1027, - ApplicationDidChangeIcon: 1028, - ApplicationDidChangeOcclusionState: 1029, - ApplicationDidChangeScreenParameters: 1030, - ApplicationDidChangeStatusBarFrame: 1031, - ApplicationDidChangeStatusBarOrientation: 1032, - ApplicationDidFinishLaunching: 1033, - ApplicationDidHide: 1034, - ApplicationDidResignActiveNotification: 1035, - ApplicationDidUnhide: 1036, - ApplicationDidUpdate: 1037, - ApplicationWillBecomeActive: 1038, - ApplicationWillFinishLaunching: 1039, - ApplicationWillHide: 1040, - ApplicationWillResignActive: 1041, - ApplicationWillTerminate: 1042, - ApplicationWillUnhide: 1043, - ApplicationWillUpdate: 1044, - ApplicationDidChangeTheme: 1045, - ApplicationShouldHandleReopen: 1046, - WindowDidBecomeKey: 1047, - WindowDidBecomeMain: 1048, - WindowDidBeginSheet: 1049, - WindowDidChangeAlpha: 1050, - WindowDidChangeBackingLocation: 1051, - WindowDidChangeBackingProperties: 1052, - WindowDidChangeCollectionBehavior: 1053, - WindowDidChangeEffectiveAppearance: 1054, - WindowDidChangeOcclusionState: 1055, - WindowDidChangeOrderingMode: 1056, - WindowDidChangeScreen: 1057, - WindowDidChangeScreenParameters: 1058, - WindowDidChangeScreenProfile: 1059, - WindowDidChangeScreenSpace: 1060, - WindowDidChangeScreenSpaceProperties: 1061, - WindowDidChangeSharingType: 1062, - WindowDidChangeSpace: 1063, - WindowDidChangeSpaceOrderingMode: 1064, - WindowDidChangeTitle: 1065, - WindowDidChangeToolbar: 1066, - WindowDidChangeVisibility: 1067, - WindowDidDeminiaturize: 1068, - WindowDidEndSheet: 1069, - WindowDidEnterFullScreen: 1070, - WindowDidEnterVersionBrowser: 1071, - WindowDidExitFullScreen: 1072, - WindowDidExitVersionBrowser: 1073, - WindowDidExpose: 1074, - WindowDidFocus: 1075, - WindowDidMiniaturize: 1076, - WindowDidMove: 1077, - WindowDidOrderOffScreen: 1078, - WindowDidOrderOnScreen: 1079, - WindowDidResignKey: 1080, - WindowDidResignMain: 1081, - WindowDidResize: 1082, - WindowDidUpdate: 1083, - WindowDidUpdateAlpha: 1084, - WindowDidUpdateCollectionBehavior: 1085, - WindowDidUpdateCollectionProperties: 1086, - WindowDidUpdateShadow: 1087, - WindowDidUpdateTitle: 1088, - WindowDidUpdateToolbar: 1089, - WindowDidUpdateVisibility: 1090, - WindowShouldClose: 1091, - WindowWillBecomeKey: 1092, - WindowWillBecomeMain: 1093, - WindowWillBeginSheet: 1094, - WindowWillChangeOrderingMode: 1095, - WindowWillClose: 1096, - WindowWillDeminiaturize: 1097, - WindowWillEnterFullScreen: 1098, - WindowWillEnterVersionBrowser: 1099, - WindowWillExitFullScreen: 1100, - WindowWillExitVersionBrowser: 1101, - WindowWillFocus: 1102, - WindowWillMiniaturize: 1103, - WindowWillMove: 1104, - WindowWillOrderOffScreen: 1105, - WindowWillOrderOnScreen: 1106, - WindowWillResignMain: 1107, - WindowWillResize: 1108, - WindowWillUnfocus: 1109, - WindowWillUpdate: 1110, - WindowWillUpdateAlpha: 1111, - WindowWillUpdateCollectionBehavior: 1112, - WindowWillUpdateCollectionProperties: 1113, - WindowWillUpdateShadow: 1114, - WindowWillUpdateTitle: 1115, - WindowWillUpdateToolbar: 1116, - WindowWillUpdateVisibility: 1117, - WindowWillUseStandardFrame: 1118, - MenuWillOpen: 1119, - MenuDidOpen: 1120, - MenuDidClose: 1121, - MenuWillSendAction: 1122, - MenuDidSendAction: 1123, - MenuWillHighlightItem: 1124, - MenuDidHighlightItem: 1125, - MenuWillDisplayItem: 1126, - MenuDidDisplayItem: 1127, - MenuWillAddItem: 1128, - MenuDidAddItem: 1129, - MenuWillRemoveItem: 1130, - MenuDidRemoveItem: 1131, - MenuWillBeginTracking: 1132, - MenuDidBeginTracking: 1133, - MenuWillEndTracking: 1134, - MenuDidEndTracking: 1135, - MenuWillUpdate: 1136, - MenuDidUpdate: 1137, - MenuWillPopUp: 1138, - MenuDidPopUp: 1139, - MenuWillSendActionToItem: 1140, - MenuDidSendActionToItem: 1141, - WebViewDidStartProvisionalNavigation: 1142, - WebViewDidReceiveServerRedirectForProvisionalNavigation: 1143, - WebViewDidFinishNavigation: 1144, - WebViewDidCommitNavigation: 1145, - WindowFileDraggingEntered: 1146, - WindowFileDraggingPerformed: 1147, - WindowFileDraggingExited: 1148, + ApplicationDidBecomeActive: 1028, + ApplicationDidChangeBackingProperties: 1029, + ApplicationDidChangeEffectiveAppearance: 1030, + ApplicationDidChangeIcon: 1031, + ApplicationDidChangeOcclusionState: 1032, + ApplicationDidChangeScreenParameters: 1033, + ApplicationDidChangeStatusBarFrame: 1034, + ApplicationDidChangeStatusBarOrientation: 1035, + ApplicationDidFinishLaunching: 1036, + ApplicationDidHide: 1037, + ApplicationDidResignActiveNotification: 1038, + ApplicationDidUnhide: 1039, + ApplicationDidUpdate: 1040, + ApplicationWillBecomeActive: 1041, + ApplicationWillFinishLaunching: 1042, + ApplicationWillHide: 1043, + ApplicationWillResignActive: 1044, + ApplicationWillTerminate: 1045, + ApplicationWillUnhide: 1046, + ApplicationWillUpdate: 1047, + ApplicationDidChangeTheme: 1048, + ApplicationShouldHandleReopen: 1049, + WindowDidBecomeKey: 1050, + WindowDidBecomeMain: 1051, + WindowDidBeginSheet: 1052, + WindowDidChangeAlpha: 1053, + WindowDidChangeBackingLocation: 1054, + WindowDidChangeBackingProperties: 1055, + WindowDidChangeCollectionBehavior: 1056, + WindowDidChangeEffectiveAppearance: 1057, + WindowDidChangeOcclusionState: 1058, + WindowDidChangeOrderingMode: 1059, + WindowDidChangeScreen: 1060, + WindowDidChangeScreenParameters: 1061, + WindowDidChangeScreenProfile: 1062, + WindowDidChangeScreenSpace: 1063, + WindowDidChangeScreenSpaceProperties: 1064, + WindowDidChangeSharingType: 1065, + WindowDidChangeSpace: 1066, + WindowDidChangeSpaceOrderingMode: 1067, + WindowDidChangeTitle: 1068, + WindowDidChangeToolbar: 1069, + WindowDidChangeVisibility: 1070, + WindowDidDeminiaturize: 1071, + WindowDidEndSheet: 1072, + WindowDidEnterFullScreen: 1073, + WindowDidEnterVersionBrowser: 1074, + WindowDidExitFullScreen: 1075, + WindowDidExitVersionBrowser: 1076, + WindowDidExpose: 1077, + WindowDidFocus: 1078, + WindowDidMiniaturize: 1079, + WindowDidMove: 1080, + WindowDidOrderOffScreen: 1081, + WindowDidOrderOnScreen: 1082, + WindowDidResignKey: 1083, + WindowDidResignMain: 1084, + WindowDidResize: 1085, + WindowDidUpdate: 1086, + WindowDidUpdateAlpha: 1087, + WindowDidUpdateCollectionBehavior: 1088, + WindowDidUpdateCollectionProperties: 1089, + WindowDidUpdateShadow: 1090, + WindowDidUpdateTitle: 1091, + WindowDidUpdateToolbar: 1092, + WindowDidUpdateVisibility: 1093, + WindowShouldClose: 1094, + WindowWillBecomeKey: 1095, + WindowWillBecomeMain: 1096, + WindowWillBeginSheet: 1097, + WindowWillChangeOrderingMode: 1098, + WindowWillClose: 1099, + WindowWillDeminiaturize: 1100, + WindowWillEnterFullScreen: 1101, + WindowWillEnterVersionBrowser: 1102, + WindowWillExitFullScreen: 1103, + WindowWillExitVersionBrowser: 1104, + WindowWillFocus: 1105, + WindowWillMiniaturize: 1106, + WindowWillMove: 1107, + WindowWillOrderOffScreen: 1108, + WindowWillOrderOnScreen: 1109, + WindowWillResignMain: 1110, + WindowWillResize: 1111, + WindowWillUnfocus: 1112, + WindowWillUpdate: 1113, + WindowWillUpdateAlpha: 1114, + WindowWillUpdateCollectionBehavior: 1115, + WindowWillUpdateCollectionProperties: 1116, + WindowWillUpdateShadow: 1117, + WindowWillUpdateTitle: 1118, + WindowWillUpdateToolbar: 1119, + WindowWillUpdateVisibility: 1120, + WindowWillUseStandardFrame: 1121, + MenuWillOpen: 1122, + MenuDidOpen: 1123, + MenuDidClose: 1124, + MenuWillSendAction: 1125, + MenuDidSendAction: 1126, + MenuWillHighlightItem: 1127, + MenuDidHighlightItem: 1128, + MenuWillDisplayItem: 1129, + MenuDidDisplayItem: 1130, + MenuWillAddItem: 1131, + MenuDidAddItem: 1132, + MenuWillRemoveItem: 1133, + MenuDidRemoveItem: 1134, + MenuWillBeginTracking: 1135, + MenuDidBeginTracking: 1136, + MenuWillEndTracking: 1137, + MenuDidEndTracking: 1138, + MenuWillUpdate: 1139, + MenuDidUpdate: 1140, + MenuWillPopUp: 1141, + MenuDidPopUp: 1142, + MenuWillSendActionToItem: 1143, + MenuDidSendActionToItem: 1144, + WebViewDidStartProvisionalNavigation: 1145, + WebViewDidReceiveServerRedirectForProvisionalNavigation: 1146, + WebViewDidFinishNavigation: 1147, + WebViewDidCommitNavigation: 1148, + WindowFileDraggingEntered: 1149, + WindowFileDraggingPerformed: 1150, + WindowFileDraggingExited: 1151, } } @@ -357,31 +363,31 @@ type windowsEvents struct { func newWindowsEvents() windowsEvents { return windowsEvents{ - SystemThemeChanged: 1149, - APMPowerStatusChange: 1150, - APMSuspend: 1151, - APMResumeAutomatic: 1152, - APMResumeSuspend: 1153, - APMPowerSettingChange: 1154, - ApplicationStarted: 1155, - WebViewNavigationCompleted: 1156, - WindowInactive: 1157, - WindowActive: 1158, - WindowClickActive: 1159, - WindowMaximise: 1160, - WindowUnMaximise: 1161, - WindowFullscreen: 1162, - WindowUnFullscreen: 1163, - WindowRestore: 1164, - WindowMinimise: 1165, - WindowUnMinimise: 1166, - WindowClose: 1167, - WindowSetFocus: 1168, - WindowKillFocus: 1169, - WindowDragDrop: 1170, - WindowDragEnter: 1171, - WindowDragLeave: 1172, - WindowDragOver: 1173, + SystemThemeChanged: 1152, + APMPowerStatusChange: 1153, + APMSuspend: 1154, + APMResumeAutomatic: 1155, + APMResumeSuspend: 1156, + APMPowerSettingChange: 1157, + ApplicationStarted: 1158, + WebViewNavigationCompleted: 1159, + WindowInactive: 1160, + WindowActive: 1161, + WindowClickActive: 1162, + WindowMaximise: 1163, + WindowUnMaximise: 1164, + WindowFullscreen: 1165, + WindowUnFullscreen: 1166, + WindowRestore: 1167, + WindowMinimise: 1168, + WindowUnMinimise: 1169, + WindowClose: 1170, + WindowSetFocus: 1171, + WindowKillFocus: 1172, + WindowDragDrop: 1173, + WindowDragEnter: 1174, + WindowDragLeave: 1175, + WindowDragOver: 1176, } } @@ -391,174 +397,177 @@ func JSEvent(event uint) string { var eventToJS = map[uint]string{ 1024: "linux:SystemThemeChanged", - 1025: "mac:ApplicationDidBecomeActive", - 1026: "mac:ApplicationDidChangeBackingProperties", - 1027: "mac:ApplicationDidChangeEffectiveAppearance", - 1028: "mac:ApplicationDidChangeIcon", - 1029: "mac:ApplicationDidChangeOcclusionState", - 1030: "mac:ApplicationDidChangeScreenParameters", - 1031: "mac:ApplicationDidChangeStatusBarFrame", - 1032: "mac:ApplicationDidChangeStatusBarOrientation", - 1033: "mac:ApplicationDidFinishLaunching", - 1034: "mac:ApplicationDidHide", - 1035: "mac:ApplicationDidResignActiveNotification", - 1036: "mac:ApplicationDidUnhide", - 1037: "mac:ApplicationDidUpdate", - 1038: "mac:ApplicationWillBecomeActive", - 1039: "mac:ApplicationWillFinishLaunching", - 1040: "mac:ApplicationWillHide", - 1041: "mac:ApplicationWillResignActive", - 1042: "mac:ApplicationWillTerminate", - 1043: "mac:ApplicationWillUnhide", - 1044: "mac:ApplicationWillUpdate", - 1045: "mac:ApplicationDidChangeTheme!", - 1046: "mac:ApplicationShouldHandleReopen!", - 1047: "mac:WindowDidBecomeKey", - 1048: "mac:WindowDidBecomeMain", - 1049: "mac:WindowDidBeginSheet", - 1050: "mac:WindowDidChangeAlpha", - 1051: "mac:WindowDidChangeBackingLocation", - 1052: "mac:WindowDidChangeBackingProperties", - 1053: "mac:WindowDidChangeCollectionBehavior", - 1054: "mac:WindowDidChangeEffectiveAppearance", - 1055: "mac:WindowDidChangeOcclusionState", - 1056: "mac:WindowDidChangeOrderingMode", - 1057: "mac:WindowDidChangeScreen", - 1058: "mac:WindowDidChangeScreenParameters", - 1059: "mac:WindowDidChangeScreenProfile", - 1060: "mac:WindowDidChangeScreenSpace", - 1061: "mac:WindowDidChangeScreenSpaceProperties", - 1062: "mac:WindowDidChangeSharingType", - 1063: "mac:WindowDidChangeSpace", - 1064: "mac:WindowDidChangeSpaceOrderingMode", - 1065: "mac:WindowDidChangeTitle", - 1066: "mac:WindowDidChangeToolbar", - 1067: "mac:WindowDidChangeVisibility", - 1068: "mac:WindowDidDeminiaturize", - 1069: "mac:WindowDidEndSheet", - 1070: "mac:WindowDidEnterFullScreen", - 1071: "mac:WindowDidEnterVersionBrowser", - 1072: "mac:WindowDidExitFullScreen", - 1073: "mac:WindowDidExitVersionBrowser", - 1074: "mac:WindowDidExpose", - 1075: "mac:WindowDidFocus", - 1076: "mac:WindowDidMiniaturize", - 1077: "mac:WindowDidMove", - 1078: "mac:WindowDidOrderOffScreen", - 1079: "mac:WindowDidOrderOnScreen", - 1080: "mac:WindowDidResignKey", - 1081: "mac:WindowDidResignMain", - 1082: "mac:WindowDidResize", - 1083: "mac:WindowDidUpdate", - 1084: "mac:WindowDidUpdateAlpha", - 1085: "mac:WindowDidUpdateCollectionBehavior", - 1086: "mac:WindowDidUpdateCollectionProperties", - 1087: "mac:WindowDidUpdateShadow", - 1088: "mac:WindowDidUpdateTitle", - 1089: "mac:WindowDidUpdateToolbar", - 1090: "mac:WindowDidUpdateVisibility", - 1091: "mac:WindowShouldClose!", - 1092: "mac:WindowWillBecomeKey", - 1093: "mac:WindowWillBecomeMain", - 1094: "mac:WindowWillBeginSheet", - 1095: "mac:WindowWillChangeOrderingMode", - 1096: "mac:WindowWillClose", - 1097: "mac:WindowWillDeminiaturize", - 1098: "mac:WindowWillEnterFullScreen", - 1099: "mac:WindowWillEnterVersionBrowser", - 1100: "mac:WindowWillExitFullScreen", - 1101: "mac:WindowWillExitVersionBrowser", - 1102: "mac:WindowWillFocus", - 1103: "mac:WindowWillMiniaturize", - 1104: "mac:WindowWillMove", - 1105: "mac:WindowWillOrderOffScreen", - 1106: "mac:WindowWillOrderOnScreen", - 1107: "mac:WindowWillResignMain", - 1108: "mac:WindowWillResize", - 1109: "mac:WindowWillUnfocus", - 1110: "mac:WindowWillUpdate", - 1111: "mac:WindowWillUpdateAlpha", - 1112: "mac:WindowWillUpdateCollectionBehavior", - 1113: "mac:WindowWillUpdateCollectionProperties", - 1114: "mac:WindowWillUpdateShadow", - 1115: "mac:WindowWillUpdateTitle", - 1116: "mac:WindowWillUpdateToolbar", - 1117: "mac:WindowWillUpdateVisibility", - 1118: "mac:WindowWillUseStandardFrame", - 1119: "mac:MenuWillOpen", - 1120: "mac:MenuDidOpen", - 1121: "mac:MenuDidClose", - 1122: "mac:MenuWillSendAction", - 1123: "mac:MenuDidSendAction", - 1124: "mac:MenuWillHighlightItem", - 1125: "mac:MenuDidHighlightItem", - 1126: "mac:MenuWillDisplayItem", - 1127: "mac:MenuDidDisplayItem", - 1128: "mac:MenuWillAddItem", - 1129: "mac:MenuDidAddItem", - 1130: "mac:MenuWillRemoveItem", - 1131: "mac:MenuDidRemoveItem", - 1132: "mac:MenuWillBeginTracking", - 1133: "mac:MenuDidBeginTracking", - 1134: "mac:MenuWillEndTracking", - 1135: "mac:MenuDidEndTracking", - 1136: "mac:MenuWillUpdate", - 1137: "mac:MenuDidUpdate", - 1138: "mac:MenuWillPopUp", - 1139: "mac:MenuDidPopUp", - 1140: "mac:MenuWillSendActionToItem", - 1141: "mac:MenuDidSendActionToItem", - 1142: "mac:WebViewDidStartProvisionalNavigation", - 1143: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation", - 1144: "mac:WebViewDidFinishNavigation", - 1145: "mac:WebViewDidCommitNavigation", - 1146: "mac:WindowFileDraggingEntered", - 1147: "mac:WindowFileDraggingPerformed", - 1148: "mac:WindowFileDraggingExited", - 1149: "windows:SystemThemeChanged", - 1150: "windows:APMPowerStatusChange", - 1151: "windows:APMSuspend", - 1152: "windows:APMResumeAutomatic", - 1153: "windows:APMResumeSuspend", - 1154: "windows:APMPowerSettingChange", - 1155: "windows:ApplicationStarted", - 1156: "windows:WebViewNavigationCompleted", - 1157: "windows:WindowInactive", - 1158: "windows:WindowActive", - 1159: "windows:WindowClickActive", - 1160: "windows:WindowMaximise", - 1161: "windows:WindowUnMaximise", - 1162: "windows:WindowFullscreen", - 1163: "windows:WindowUnFullscreen", - 1164: "windows:WindowRestore", - 1165: "windows:WindowMinimise", - 1166: "windows:WindowUnMinimise", - 1167: "windows:WindowClose", - 1168: "windows:WindowSetFocus", - 1169: "windows:WindowKillFocus", - 1170: "windows:WindowDragDrop", - 1171: "windows:WindowDragEnter", - 1172: "windows:WindowDragLeave", - 1173: "windows:WindowDragOver", - 1174: "common:ApplicationStarted", - 1175: "common:WindowMaximise", - 1176: "common:WindowUnMaximise", - 1177: "common:WindowFullscreen", - 1178: "common:WindowUnFullscreen", - 1179: "common:WindowRestore", - 1180: "common:WindowMinimise", - 1181: "common:WindowUnMinimise", - 1182: "common:WindowClosing", - 1183: "common:WindowZoom", - 1184: "common:WindowZoomIn", - 1185: "common:WindowZoomOut", - 1186: "common:WindowZoomReset", - 1187: "common:WindowFocus", - 1188: "common:WindowLostFocus", - 1189: "common:WindowShow", - 1190: "common:WindowHide", - 1191: "common:WindowDPIChanged", - 1192: "common:WindowFilesDropped", - 1193: "common:WindowRuntimeReady", - 1194: "common:ThemeChanged", + 1025: "linux:WindowLoadChanged", + 1026: "linux:WindowDeleteEvent", + 1027: "linux:ApplicationStartup", + 1028: "mac:ApplicationDidBecomeActive", + 1029: "mac:ApplicationDidChangeBackingProperties", + 1030: "mac:ApplicationDidChangeEffectiveAppearance", + 1031: "mac:ApplicationDidChangeIcon", + 1032: "mac:ApplicationDidChangeOcclusionState", + 1033: "mac:ApplicationDidChangeScreenParameters", + 1034: "mac:ApplicationDidChangeStatusBarFrame", + 1035: "mac:ApplicationDidChangeStatusBarOrientation", + 1036: "mac:ApplicationDidFinishLaunching", + 1037: "mac:ApplicationDidHide", + 1038: "mac:ApplicationDidResignActiveNotification", + 1039: "mac:ApplicationDidUnhide", + 1040: "mac:ApplicationDidUpdate", + 1041: "mac:ApplicationWillBecomeActive", + 1042: "mac:ApplicationWillFinishLaunching", + 1043: "mac:ApplicationWillHide", + 1044: "mac:ApplicationWillResignActive", + 1045: "mac:ApplicationWillTerminate", + 1046: "mac:ApplicationWillUnhide", + 1047: "mac:ApplicationWillUpdate", + 1048: "mac:ApplicationDidChangeTheme!", + 1049: "mac:ApplicationShouldHandleReopen!", + 1050: "mac:WindowDidBecomeKey", + 1051: "mac:WindowDidBecomeMain", + 1052: "mac:WindowDidBeginSheet", + 1053: "mac:WindowDidChangeAlpha", + 1054: "mac:WindowDidChangeBackingLocation", + 1055: "mac:WindowDidChangeBackingProperties", + 1056: "mac:WindowDidChangeCollectionBehavior", + 1057: "mac:WindowDidChangeEffectiveAppearance", + 1058: "mac:WindowDidChangeOcclusionState", + 1059: "mac:WindowDidChangeOrderingMode", + 1060: "mac:WindowDidChangeScreen", + 1061: "mac:WindowDidChangeScreenParameters", + 1062: "mac:WindowDidChangeScreenProfile", + 1063: "mac:WindowDidChangeScreenSpace", + 1064: "mac:WindowDidChangeScreenSpaceProperties", + 1065: "mac:WindowDidChangeSharingType", + 1066: "mac:WindowDidChangeSpace", + 1067: "mac:WindowDidChangeSpaceOrderingMode", + 1068: "mac:WindowDidChangeTitle", + 1069: "mac:WindowDidChangeToolbar", + 1070: "mac:WindowDidChangeVisibility", + 1071: "mac:WindowDidDeminiaturize", + 1072: "mac:WindowDidEndSheet", + 1073: "mac:WindowDidEnterFullScreen", + 1074: "mac:WindowDidEnterVersionBrowser", + 1075: "mac:WindowDidExitFullScreen", + 1076: "mac:WindowDidExitVersionBrowser", + 1077: "mac:WindowDidExpose", + 1078: "mac:WindowDidFocus", + 1079: "mac:WindowDidMiniaturize", + 1080: "mac:WindowDidMove", + 1081: "mac:WindowDidOrderOffScreen", + 1082: "mac:WindowDidOrderOnScreen", + 1083: "mac:WindowDidResignKey", + 1084: "mac:WindowDidResignMain", + 1085: "mac:WindowDidResize", + 1086: "mac:WindowDidUpdate", + 1087: "mac:WindowDidUpdateAlpha", + 1088: "mac:WindowDidUpdateCollectionBehavior", + 1089: "mac:WindowDidUpdateCollectionProperties", + 1090: "mac:WindowDidUpdateShadow", + 1091: "mac:WindowDidUpdateTitle", + 1092: "mac:WindowDidUpdateToolbar", + 1093: "mac:WindowDidUpdateVisibility", + 1094: "mac:WindowShouldClose!", + 1095: "mac:WindowWillBecomeKey", + 1096: "mac:WindowWillBecomeMain", + 1097: "mac:WindowWillBeginSheet", + 1098: "mac:WindowWillChangeOrderingMode", + 1099: "mac:WindowWillClose", + 1100: "mac:WindowWillDeminiaturize", + 1101: "mac:WindowWillEnterFullScreen", + 1102: "mac:WindowWillEnterVersionBrowser", + 1103: "mac:WindowWillExitFullScreen", + 1104: "mac:WindowWillExitVersionBrowser", + 1105: "mac:WindowWillFocus", + 1106: "mac:WindowWillMiniaturize", + 1107: "mac:WindowWillMove", + 1108: "mac:WindowWillOrderOffScreen", + 1109: "mac:WindowWillOrderOnScreen", + 1110: "mac:WindowWillResignMain", + 1111: "mac:WindowWillResize", + 1112: "mac:WindowWillUnfocus", + 1113: "mac:WindowWillUpdate", + 1114: "mac:WindowWillUpdateAlpha", + 1115: "mac:WindowWillUpdateCollectionBehavior", + 1116: "mac:WindowWillUpdateCollectionProperties", + 1117: "mac:WindowWillUpdateShadow", + 1118: "mac:WindowWillUpdateTitle", + 1119: "mac:WindowWillUpdateToolbar", + 1120: "mac:WindowWillUpdateVisibility", + 1121: "mac:WindowWillUseStandardFrame", + 1122: "mac:MenuWillOpen", + 1123: "mac:MenuDidOpen", + 1124: "mac:MenuDidClose", + 1125: "mac:MenuWillSendAction", + 1126: "mac:MenuDidSendAction", + 1127: "mac:MenuWillHighlightItem", + 1128: "mac:MenuDidHighlightItem", + 1129: "mac:MenuWillDisplayItem", + 1130: "mac:MenuDidDisplayItem", + 1131: "mac:MenuWillAddItem", + 1132: "mac:MenuDidAddItem", + 1133: "mac:MenuWillRemoveItem", + 1134: "mac:MenuDidRemoveItem", + 1135: "mac:MenuWillBeginTracking", + 1136: "mac:MenuDidBeginTracking", + 1137: "mac:MenuWillEndTracking", + 1138: "mac:MenuDidEndTracking", + 1139: "mac:MenuWillUpdate", + 1140: "mac:MenuDidUpdate", + 1141: "mac:MenuWillPopUp", + 1142: "mac:MenuDidPopUp", + 1143: "mac:MenuWillSendActionToItem", + 1144: "mac:MenuDidSendActionToItem", + 1145: "mac:WebViewDidStartProvisionalNavigation", + 1146: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation", + 1147: "mac:WebViewDidFinishNavigation", + 1148: "mac:WebViewDidCommitNavigation", + 1149: "mac:WindowFileDraggingEntered", + 1150: "mac:WindowFileDraggingPerformed", + 1151: "mac:WindowFileDraggingExited", + 1152: "windows:SystemThemeChanged", + 1153: "windows:APMPowerStatusChange", + 1154: "windows:APMSuspend", + 1155: "windows:APMResumeAutomatic", + 1156: "windows:APMResumeSuspend", + 1157: "windows:APMPowerSettingChange", + 1158: "windows:ApplicationStarted", + 1159: "windows:WebViewNavigationCompleted", + 1160: "windows:WindowInactive", + 1161: "windows:WindowActive", + 1162: "windows:WindowClickActive", + 1163: "windows:WindowMaximise", + 1164: "windows:WindowUnMaximise", + 1165: "windows:WindowFullscreen", + 1166: "windows:WindowUnFullscreen", + 1167: "windows:WindowRestore", + 1168: "windows:WindowMinimise", + 1169: "windows:WindowUnMinimise", + 1170: "windows:WindowClose", + 1171: "windows:WindowSetFocus", + 1172: "windows:WindowKillFocus", + 1173: "windows:WindowDragDrop", + 1174: "windows:WindowDragEnter", + 1175: "windows:WindowDragLeave", + 1176: "windows:WindowDragOver", + 1177: "common:ApplicationStarted", + 1178: "common:WindowMaximise", + 1179: "common:WindowUnMaximise", + 1180: "common:WindowFullscreen", + 1181: "common:WindowUnFullscreen", + 1182: "common:WindowRestore", + 1183: "common:WindowMinimise", + 1184: "common:WindowUnMinimise", + 1185: "common:WindowClosing", + 1186: "common:WindowZoom", + 1187: "common:WindowZoomIn", + 1188: "common:WindowZoomOut", + 1189: "common:WindowZoomReset", + 1190: "common:WindowFocus", + 1191: "common:WindowLostFocus", + 1192: "common:WindowShow", + 1193: "common:WindowHide", + 1194: "common:WindowDPIChanged", + 1195: "common:WindowFilesDropped", + 1196: "common:WindowRuntimeReady", + 1197: "common:ThemeChanged", } diff --git a/v3/pkg/events/events.txt b/v3/pkg/events/events.txt index 76406a8dc..2703e48af 100644 --- a/v3/pkg/events/events.txt +++ b/v3/pkg/events/events.txt @@ -1,4 +1,7 @@ linux:SystemThemeChanged +linux:WindowLoadChanged +linux:WindowDeleteEvent +linux:ApplicationStartup mac:ApplicationDidBecomeActive mac:ApplicationDidChangeBackingProperties mac:ApplicationDidChangeEffectiveAppearance diff --git a/v3/pkg/events/events_darwin.h b/v3/pkg/events/events_darwin.h index c2c74116d..7c224e052 100644 --- a/v3/pkg/events/events_darwin.h +++ b/v3/pkg/events/events_darwin.h @@ -6,132 +6,132 @@ extern void processApplicationEvent(unsigned int, void* data); extern void processWindowEvent(unsigned int, unsigned int); -#define EventApplicationDidBecomeActive 1025 -#define EventApplicationDidChangeBackingProperties 1026 -#define EventApplicationDidChangeEffectiveAppearance 1027 -#define EventApplicationDidChangeIcon 1028 -#define EventApplicationDidChangeOcclusionState 1029 -#define EventApplicationDidChangeScreenParameters 1030 -#define EventApplicationDidChangeStatusBarFrame 1031 -#define EventApplicationDidChangeStatusBarOrientation 1032 -#define EventApplicationDidFinishLaunching 1033 -#define EventApplicationDidHide 1034 -#define EventApplicationDidResignActiveNotification 1035 -#define EventApplicationDidUnhide 1036 -#define EventApplicationDidUpdate 1037 -#define EventApplicationWillBecomeActive 1038 -#define EventApplicationWillFinishLaunching 1039 -#define EventApplicationWillHide 1040 -#define EventApplicationWillResignActive 1041 -#define EventApplicationWillTerminate 1042 -#define EventApplicationWillUnhide 1043 -#define EventApplicationWillUpdate 1044 -#define EventApplicationDidChangeTheme 1045 -#define EventApplicationShouldHandleReopen 1046 -#define EventWindowDidBecomeKey 1047 -#define EventWindowDidBecomeMain 1048 -#define EventWindowDidBeginSheet 1049 -#define EventWindowDidChangeAlpha 1050 -#define EventWindowDidChangeBackingLocation 1051 -#define EventWindowDidChangeBackingProperties 1052 -#define EventWindowDidChangeCollectionBehavior 1053 -#define EventWindowDidChangeEffectiveAppearance 1054 -#define EventWindowDidChangeOcclusionState 1055 -#define EventWindowDidChangeOrderingMode 1056 -#define EventWindowDidChangeScreen 1057 -#define EventWindowDidChangeScreenParameters 1058 -#define EventWindowDidChangeScreenProfile 1059 -#define EventWindowDidChangeScreenSpace 1060 -#define EventWindowDidChangeScreenSpaceProperties 1061 -#define EventWindowDidChangeSharingType 1062 -#define EventWindowDidChangeSpace 1063 -#define EventWindowDidChangeSpaceOrderingMode 1064 -#define EventWindowDidChangeTitle 1065 -#define EventWindowDidChangeToolbar 1066 -#define EventWindowDidChangeVisibility 1067 -#define EventWindowDidDeminiaturize 1068 -#define EventWindowDidEndSheet 1069 -#define EventWindowDidEnterFullScreen 1070 -#define EventWindowDidEnterVersionBrowser 1071 -#define EventWindowDidExitFullScreen 1072 -#define EventWindowDidExitVersionBrowser 1073 -#define EventWindowDidExpose 1074 -#define EventWindowDidFocus 1075 -#define EventWindowDidMiniaturize 1076 -#define EventWindowDidMove 1077 -#define EventWindowDidOrderOffScreen 1078 -#define EventWindowDidOrderOnScreen 1079 -#define EventWindowDidResignKey 1080 -#define EventWindowDidResignMain 1081 -#define EventWindowDidResize 1082 -#define EventWindowDidUpdate 1083 -#define EventWindowDidUpdateAlpha 1084 -#define EventWindowDidUpdateCollectionBehavior 1085 -#define EventWindowDidUpdateCollectionProperties 1086 -#define EventWindowDidUpdateShadow 1087 -#define EventWindowDidUpdateTitle 1088 -#define EventWindowDidUpdateToolbar 1089 -#define EventWindowDidUpdateVisibility 1090 -#define EventWindowShouldClose 1091 -#define EventWindowWillBecomeKey 1092 -#define EventWindowWillBecomeMain 1093 -#define EventWindowWillBeginSheet 1094 -#define EventWindowWillChangeOrderingMode 1095 -#define EventWindowWillClose 1096 -#define EventWindowWillDeminiaturize 1097 -#define EventWindowWillEnterFullScreen 1098 -#define EventWindowWillEnterVersionBrowser 1099 -#define EventWindowWillExitFullScreen 1100 -#define EventWindowWillExitVersionBrowser 1101 -#define EventWindowWillFocus 1102 -#define EventWindowWillMiniaturize 1103 -#define EventWindowWillMove 1104 -#define EventWindowWillOrderOffScreen 1105 -#define EventWindowWillOrderOnScreen 1106 -#define EventWindowWillResignMain 1107 -#define EventWindowWillResize 1108 -#define EventWindowWillUnfocus 1109 -#define EventWindowWillUpdate 1110 -#define EventWindowWillUpdateAlpha 1111 -#define EventWindowWillUpdateCollectionBehavior 1112 -#define EventWindowWillUpdateCollectionProperties 1113 -#define EventWindowWillUpdateShadow 1114 -#define EventWindowWillUpdateTitle 1115 -#define EventWindowWillUpdateToolbar 1116 -#define EventWindowWillUpdateVisibility 1117 -#define EventWindowWillUseStandardFrame 1118 -#define EventMenuWillOpen 1119 -#define EventMenuDidOpen 1120 -#define EventMenuDidClose 1121 -#define EventMenuWillSendAction 1122 -#define EventMenuDidSendAction 1123 -#define EventMenuWillHighlightItem 1124 -#define EventMenuDidHighlightItem 1125 -#define EventMenuWillDisplayItem 1126 -#define EventMenuDidDisplayItem 1127 -#define EventMenuWillAddItem 1128 -#define EventMenuDidAddItem 1129 -#define EventMenuWillRemoveItem 1130 -#define EventMenuDidRemoveItem 1131 -#define EventMenuWillBeginTracking 1132 -#define EventMenuDidBeginTracking 1133 -#define EventMenuWillEndTracking 1134 -#define EventMenuDidEndTracking 1135 -#define EventMenuWillUpdate 1136 -#define EventMenuDidUpdate 1137 -#define EventMenuWillPopUp 1138 -#define EventMenuDidPopUp 1139 -#define EventMenuWillSendActionToItem 1140 -#define EventMenuDidSendActionToItem 1141 -#define EventWebViewDidStartProvisionalNavigation 1142 -#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1143 -#define EventWebViewDidFinishNavigation 1144 -#define EventWebViewDidCommitNavigation 1145 -#define EventWindowFileDraggingEntered 1146 -#define EventWindowFileDraggingPerformed 1147 -#define EventWindowFileDraggingExited 1148 +#define EventApplicationDidBecomeActive 1028 +#define EventApplicationDidChangeBackingProperties 1029 +#define EventApplicationDidChangeEffectiveAppearance 1030 +#define EventApplicationDidChangeIcon 1031 +#define EventApplicationDidChangeOcclusionState 1032 +#define EventApplicationDidChangeScreenParameters 1033 +#define EventApplicationDidChangeStatusBarFrame 1034 +#define EventApplicationDidChangeStatusBarOrientation 1035 +#define EventApplicationDidFinishLaunching 1036 +#define EventApplicationDidHide 1037 +#define EventApplicationDidResignActiveNotification 1038 +#define EventApplicationDidUnhide 1039 +#define EventApplicationDidUpdate 1040 +#define EventApplicationWillBecomeActive 1041 +#define EventApplicationWillFinishLaunching 1042 +#define EventApplicationWillHide 1043 +#define EventApplicationWillResignActive 1044 +#define EventApplicationWillTerminate 1045 +#define EventApplicationWillUnhide 1046 +#define EventApplicationWillUpdate 1047 +#define EventApplicationDidChangeTheme 1048 +#define EventApplicationShouldHandleReopen 1049 +#define EventWindowDidBecomeKey 1050 +#define EventWindowDidBecomeMain 1051 +#define EventWindowDidBeginSheet 1052 +#define EventWindowDidChangeAlpha 1053 +#define EventWindowDidChangeBackingLocation 1054 +#define EventWindowDidChangeBackingProperties 1055 +#define EventWindowDidChangeCollectionBehavior 1056 +#define EventWindowDidChangeEffectiveAppearance 1057 +#define EventWindowDidChangeOcclusionState 1058 +#define EventWindowDidChangeOrderingMode 1059 +#define EventWindowDidChangeScreen 1060 +#define EventWindowDidChangeScreenParameters 1061 +#define EventWindowDidChangeScreenProfile 1062 +#define EventWindowDidChangeScreenSpace 1063 +#define EventWindowDidChangeScreenSpaceProperties 1064 +#define EventWindowDidChangeSharingType 1065 +#define EventWindowDidChangeSpace 1066 +#define EventWindowDidChangeSpaceOrderingMode 1067 +#define EventWindowDidChangeTitle 1068 +#define EventWindowDidChangeToolbar 1069 +#define EventWindowDidChangeVisibility 1070 +#define EventWindowDidDeminiaturize 1071 +#define EventWindowDidEndSheet 1072 +#define EventWindowDidEnterFullScreen 1073 +#define EventWindowDidEnterVersionBrowser 1074 +#define EventWindowDidExitFullScreen 1075 +#define EventWindowDidExitVersionBrowser 1076 +#define EventWindowDidExpose 1077 +#define EventWindowDidFocus 1078 +#define EventWindowDidMiniaturize 1079 +#define EventWindowDidMove 1080 +#define EventWindowDidOrderOffScreen 1081 +#define EventWindowDidOrderOnScreen 1082 +#define EventWindowDidResignKey 1083 +#define EventWindowDidResignMain 1084 +#define EventWindowDidResize 1085 +#define EventWindowDidUpdate 1086 +#define EventWindowDidUpdateAlpha 1087 +#define EventWindowDidUpdateCollectionBehavior 1088 +#define EventWindowDidUpdateCollectionProperties 1089 +#define EventWindowDidUpdateShadow 1090 +#define EventWindowDidUpdateTitle 1091 +#define EventWindowDidUpdateToolbar 1092 +#define EventWindowDidUpdateVisibility 1093 +#define EventWindowShouldClose 1094 +#define EventWindowWillBecomeKey 1095 +#define EventWindowWillBecomeMain 1096 +#define EventWindowWillBeginSheet 1097 +#define EventWindowWillChangeOrderingMode 1098 +#define EventWindowWillClose 1099 +#define EventWindowWillDeminiaturize 1100 +#define EventWindowWillEnterFullScreen 1101 +#define EventWindowWillEnterVersionBrowser 1102 +#define EventWindowWillExitFullScreen 1103 +#define EventWindowWillExitVersionBrowser 1104 +#define EventWindowWillFocus 1105 +#define EventWindowWillMiniaturize 1106 +#define EventWindowWillMove 1107 +#define EventWindowWillOrderOffScreen 1108 +#define EventWindowWillOrderOnScreen 1109 +#define EventWindowWillResignMain 1110 +#define EventWindowWillResize 1111 +#define EventWindowWillUnfocus 1112 +#define EventWindowWillUpdate 1113 +#define EventWindowWillUpdateAlpha 1114 +#define EventWindowWillUpdateCollectionBehavior 1115 +#define EventWindowWillUpdateCollectionProperties 1116 +#define EventWindowWillUpdateShadow 1117 +#define EventWindowWillUpdateTitle 1118 +#define EventWindowWillUpdateToolbar 1119 +#define EventWindowWillUpdateVisibility 1120 +#define EventWindowWillUseStandardFrame 1121 +#define EventMenuWillOpen 1122 +#define EventMenuDidOpen 1123 +#define EventMenuDidClose 1124 +#define EventMenuWillSendAction 1125 +#define EventMenuDidSendAction 1126 +#define EventMenuWillHighlightItem 1127 +#define EventMenuDidHighlightItem 1128 +#define EventMenuWillDisplayItem 1129 +#define EventMenuDidDisplayItem 1130 +#define EventMenuWillAddItem 1131 +#define EventMenuDidAddItem 1132 +#define EventMenuWillRemoveItem 1133 +#define EventMenuDidRemoveItem 1134 +#define EventMenuWillBeginTracking 1135 +#define EventMenuDidBeginTracking 1136 +#define EventMenuWillEndTracking 1137 +#define EventMenuDidEndTracking 1138 +#define EventMenuWillUpdate 1139 +#define EventMenuDidUpdate 1140 +#define EventMenuWillPopUp 1141 +#define EventMenuDidPopUp 1142 +#define EventMenuWillSendActionToItem 1143 +#define EventMenuDidSendActionToItem 1144 +#define EventWebViewDidStartProvisionalNavigation 1145 +#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1146 +#define EventWebViewDidFinishNavigation 1147 +#define EventWebViewDidCommitNavigation 1148 +#define EventWindowFileDraggingEntered 1149 +#define EventWindowFileDraggingPerformed 1150 +#define EventWindowFileDraggingExited 1151 -#define MAX_EVENTS 1149 +#define MAX_EVENTS 1152 #endif \ No newline at end of file diff --git a/v3/pkg/events/events_linux.go b/v3/pkg/events/events_linux.go new file mode 100644 index 000000000..2782beb8a --- /dev/null +++ b/v3/pkg/events/events_linux.go @@ -0,0 +1,22 @@ +//go:build linux + +package events + +/* +#include "events_linux.h" +#include +#include + +bool hasListener[MAX_EVENTS] = {false}; + +void registerListener(unsigned int event) { + hasListener[event] = true; +} + +bool hasListeners(unsigned int event) { + //return hasListener[event]; + return true; +} + +*/ +import "C" diff --git a/v3/pkg/events/events_linux.h b/v3/pkg/events/events_linux.h new file mode 100644 index 000000000..25409b5f0 --- /dev/null +++ b/v3/pkg/events/events_linux.h @@ -0,0 +1,17 @@ +//go:build linux + +#ifndef _events_h +#define _events_h + +extern void processApplicationEvent(unsigned int, void* data); +extern void processWindowEvent(unsigned int, unsigned int); + +#define EventSystemThemeChanged 1024 +#define EventWindowLoadChanged 1025 +#define EventWindowDeleteEvent 1026 +#define EventApplicationStartup 1027 + +#define MAX_EVENTS 1028 + + +#endif \ No newline at end of file diff --git a/v3/tasks/events/generate.go b/v3/tasks/events/generate.go index 9518036f8..4772a1ef8 100644 --- a/v3/tasks/events/generate.go +++ b/v3/tasks/events/generate.go @@ -61,7 +61,19 @@ $$EVENTTOJS} ` -var eventsH = `//go:build darwin +var darwinEventsH = `//go:build darwin + +#ifndef _events_h +#define _events_h + +extern void processApplicationEvent(unsigned int, void* data); +extern void processWindowEvent(unsigned int, unsigned int); + +$$CHEADEREVENTS + +#endif` + +var linuxEventsH = `//go:build linux #ifndef _events_h #define _events_h @@ -108,10 +120,11 @@ func main() { linuxEventsDecl := bytes.NewBufferString("") linuxEventsValues := bytes.NewBufferString("") + linuxCHeaderEvents := bytes.NewBufferString("") macEventsDecl := bytes.NewBufferString("") macEventsValues := bytes.NewBufferString("") - cHeaderEvents := bytes.NewBufferString("") + macCHeaderEvents := bytes.NewBufferString("") windowDelegateEvents := bytes.NewBufferString("") applicationDelegateEvents := bytes.NewBufferString("") webviewDelegateEvents := bytes.NewBufferString("") @@ -137,6 +150,7 @@ func main() { var id int // var maxLinuxEvents int var maxMacEvents int + var maxLinuxEvents int var line []byte // Loop over each line in the file for id, line = range bytes.Split(eventNames, []byte{'\n'}) { @@ -179,7 +193,8 @@ func main() { linuxJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n") linuxTSEvents.WriteString("\t\t" + event + ": string,\n") eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n") - //maxLinuxEvents = id + maxLinuxEvents = id + linuxCHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n") case "mac": eventType := "ApplicationEventType" if strings.HasPrefix(event, "Window") { @@ -192,7 +207,7 @@ func main() { macEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n") macJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n") macTSEvents.WriteString("\t\t" + event + ": string,\n") - cHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n") + macCHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n") eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n") maxMacEvents = id if ignoreEvent { @@ -258,7 +273,8 @@ func main() { } } - cHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxMacEvents+1) + "\n") + macCHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxMacEvents+1) + "\n") + linuxCHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxLinuxEvents+1) + "\n") // Save the eventsGo template substituting the values and decls templateToWrite := strings.ReplaceAll(eventsGo, "$$LINUXEVENTSDECL", linuxEventsDecl.String()) @@ -296,13 +312,20 @@ func main() { panic(err) } - // Save the eventsH template substituting the values and decls - templateToWrite = strings.ReplaceAll(eventsH, "$$CHEADEREVENTS", cHeaderEvents.String()) + // Save the darwinEventsH template substituting the values and decls + templateToWrite = strings.ReplaceAll(darwinEventsH, "$$CHEADEREVENTS", macCHeaderEvents.String()) err = os.WriteFile("../../pkg/events/events_darwin.h", []byte(templateToWrite), 0644) if err != nil { panic(err) } + // Save the linuxEventsH template substituting the values and decls + templateToWrite = strings.ReplaceAll(linuxEventsH, "$$CHEADEREVENTS", linuxCHeaderEvents.String()) + err = os.WriteFile("../../pkg/events/events_linux.h", []byte(templateToWrite), 0644) + if err != nil { + panic(err) + } + // Load the window_delegate.m file windowDelegate, err := os.ReadFile("../../pkg/application/webview_window_darwin.m") if err != nil {