[darwin] add support for quitting app

This commit is contained in:
Lea Anthony 2024-01-08 21:22:33 +11:00
commit 68e779d64e
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
8 changed files with 552 additions and 488 deletions

View file

@ -42,3 +42,8 @@ tasks:
- install-deps
cmds:
- task: build:all
generate:events:
dir: ../../tasks/events
cmds:
- go run generate.go

View file

@ -122,6 +122,11 @@ func New(appOptions Options) *App {
result.keyBindings = processKeyBindingOptions(result.options.KeyBindings)
}
// Handle the terminate event
result.On(events.Common.ApplicationTerminate, func(e *Event) {
result.Quit()
})
return result
}

View file

@ -1,6 +1,7 @@
//go:build darwin
#import "application_darwin_delegate.h"
#import "../events/events_darwin.h"
#import "message.h"
extern bool hasListeners(unsigned int);
@implementation AppDelegate
- (void)dealloc
@ -17,7 +18,10 @@ extern bool hasListeners(unsigned int);
processApplicationEvent(EventApplicationDidChangeTheme, NULL);
}
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender {
processApplicationEvent(EventApplicationTerminate, NULL);
return NSTerminateCancel;
}
- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app
{
return YES;
@ -152,5 +156,11 @@ extern bool hasListeners(unsigned int);
}
}
- (void)applicationTerminate:(NSNotification *)notification {
if( hasListeners(EventApplicationTerminate) ) {
processApplicationEvent(EventApplicationTerminate, NULL);
}
}
// GENERATED EVENTS END
@end

View file

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

View file

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

View file

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

View file

@ -19,6 +19,7 @@ mac:ApplicationWillResignActive
mac:ApplicationWillTerminate
mac:ApplicationWillUnhide
mac:ApplicationWillUpdate
mac:ApplicationTerminate
mac:ApplicationDidChangeTheme!
mac:ApplicationShouldHandleReopen!
mac:WindowDidBecomeKey
@ -168,4 +169,4 @@ common:WindowHide
common:WindowDPIChanged
common:WindowFilesDropped
common:ThemeChanged
common:ApplicationTerminate

View file

@ -79,11 +79,26 @@ export const EventTypes = {
$$WINDOWSJSEVENTS },
Mac: {
$$MACJSEVENTS },
Linux: {
$$LINUXJSEVENTS },
Common: {
$$COMMONJSEVENTS },
};
`
var eventsTS = `
export declare const EventTypes: {
Windows: {
$$WINDOWSTSEVENTS },
Mac: {
$$MACTSEVENTS },
Linux: {
$$LINUXTSEVENTS },
Common: {
$$COMMONTSEVENTS },
};
`
func main() {
eventNames, err := os.ReadFile("../../pkg/events/events.txt")
@ -112,6 +127,11 @@ func main() {
windowsJSEvents := bytes.NewBufferString("")
commonJSEvents := bytes.NewBufferString("")
linuxTSEvents := bytes.NewBufferString("")
macTSEvents := bytes.NewBufferString("")
windowsTSEvents := bytes.NewBufferString("")
commonTSEvents := bytes.NewBufferString("")
eventToJS := bytes.NewBufferString("")
var id int
@ -157,6 +177,7 @@ func main() {
linuxEventsDecl.WriteString("\t" + eventTitle + " " + eventType + "\n")
linuxEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n")
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
case "mac":
@ -170,6 +191,7 @@ func main() {
macEventsDecl.WriteString("\t" + eventTitle + " " + eventType + "\n")
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")
eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
maxMacEvents = id
@ -218,6 +240,7 @@ func main() {
commonEventsDecl.WriteString("\t" + eventTitle + " " + eventType + "\n")
commonEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n")
commonJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
commonTSEvents.WriteString("\t\t" + event + ": string,\n")
eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
case "windows":
eventType := "ApplicationEventType"
@ -230,6 +253,7 @@ func main() {
windowsEventsDecl.WriteString("\t" + eventTitle + " " + eventType + "\n")
windowsEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n")
windowsJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
windowsTSEvents.WriteString("\t\t" + event + ": string,\n")
eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
}
}
@ -255,8 +279,19 @@ func main() {
// Save the eventsJS template substituting the values and decls
templateToWrite = strings.ReplaceAll(eventsJS, "$$MACJSEVENTS", macJSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$WINDOWSJSEVENTS", windowsJSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$LINUXJSEVENTS", linuxJSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$COMMONJSEVENTS", commonJSEvents.String())
err = os.WriteFile("../../internal/runtime/desktop/api/event_types.js", []byte(templateToWrite), 0644)
err = os.WriteFile("../../internal/runtime/desktop/@wailsio/runtime/src/event_types.js", []byte(templateToWrite), 0644)
if err != nil {
panic(err)
}
// Save the eventsTS template substituting the values and decls
templateToWrite = strings.ReplaceAll(eventsTS, "$$MACTSEVENTS", macTSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$WINDOWSTSEVENTS", windowsTSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$LINUXTSEVENTS", linuxTSEvents.String())
templateToWrite = strings.ReplaceAll(templateToWrite, "$$COMMONTSEVENTS", commonTSEvents.String())
err = os.WriteFile("../../internal/runtime/desktop/@wailsio/runtime/types/event_types.d.ts", []byte(templateToWrite), 0644)
if err != nil {
panic(err)
}