wails/v3/pkg/events/events.go
Lea Anthony 53c2275fea
fix(v3): overhaul drag-and-drop for Linux reliability and simplify Windows implementation (#4848)
* fix(v3): overhaul drag-and-drop for Linux reliability and simplify Windows

This commit fixes drag-and-drop reliability on Linux and simplifies the
Windows implementation.

## Linux
- Rewrite GTK drag handlers to properly intercept external file drops
- Fix HTML5 internal drag-and-drop being broken when file drop enabled
- Add hover effects during file drag operations
- Fix multiple app instances interfering with each other

## Windows
- Remove native IDropTarget in favor of JavaScript approach (matches v2)
- File drops now handled via chrome.webview.postMessageWithAdditionalObjects

## All Platforms
- Rename EnableDragAndDrop to EnableFileDrop
- Rename data-wails-drop-target to data-file-drop-target
- Rename wails-drop-target-active to file-drop-target-active
- Add comprehensive drag-and-drop documentation

## Breaking Changes
- EnableDragAndDrop -> EnableFileDrop
- data-wails-dropzone -> data-file-drop-target
- wails-dropzone-hover -> file-drop-target-active
- DropZoneDetails -> DropTargetDetails
- Remove WindowDropZoneFilesDropped event (use WindowFilesDropped)

* feat(macos): optimize drag event performance with debouncing and caching

- Add 50ms debouncing to limit drag events to 20/sec (was 120/sec)
- Implement window implementation caching to avoid repeated lookups
- Maintain existing 5-pixel threshold for immediate response
- Keep zero-allocation path with pre-allocated buffers
- Rename linuxDragActive to nativeDragActive for clarity
- Update IMPLEMENTATION.md with optimization details and Windows guidance

Performance improvements:
- 83% reduction in event frequency
- ~6x reduction in CPU/memory usage during drag operations
- Maintains smooth visual feedback with InvokeSync for timer callbacks

* fix(windows): implement proper file drop support for Windows

- Remove incorrect AllowExternalDrag(false) call that was blocking file drops
- Fix message prefix from 'FilesDropped' to 'file:drop:' to match JS runtime
- Fix coordinate parsing for 'file:drop:x:y' format (indices 2,3 not 1,2)
- Add enableFileDrop flag injection to JS runtime during navigation
- Update JS runtime to check enableFileDrop flag before processing drops
- Always call preventDefault() to stop browser navigation on file drags
- Show 'no drop' cursor when file drops are disabled
- Update example to filter file drags from HTML drop zone handlers
- Add documentation for combining file drop with HTML drag-and-drop

* fix(v3): block file drops on Linux when EnableFileDrop is false

- Add disableDND() to intercept and reject external file drags at GTK level
- Show 'no drop' cursor when files are dragged over window
- Allow internal HTML5 drag-and-drop to work normally
- Initialize _wails.flags object in runtime core to prevent undefined errors
- Inject enableFileDrop flag on Linux and macOS (matching Windows)
- Fix bare _wails reference to use window._wails
- Update docs with info about blocked drops and combining with HTML DnD

* fix(darwin): add missing fmt import in webview_window_darwin.go

* fix(macOS): implement hover effects for file drag-and-drop with optimizations

- Added draggingUpdated: handler to track mouse movement during drag operations
- Implemented macosOnDragEnter/Exit/Over export functions for real-time hover state
- Fixed JS function call from '_wails.handlePlatformFileDrop' to correct 'wails.Window.HandlePlatformFileDrop'
- Added EnableFileDrop flag checks to prevent hover effects when file drops are disabled
- Renamed linuxDragActive to nativeDragActive for cross-platform consistency

Performance optimizations:
- Added 50ms debounce to reduce event frequency from ~120/sec to ~20/sec
- Implemented 5-pixel movement threshold for immediate response
- Added window caching with sync.Map to avoid repeated lookups
- Zero-allocation JavaScript calls with pre-allocated 128-byte buffer
- Reduced memory usage to ~18 bytes per event (6x reduction)

Build improvements:
- Updated runtime Taskfile to include documentation generation
- Added docs:build task to runtime build process
- Fixed build order: events → docs → runtime

Documentation:
- Added IMPLEMENTATION.md with optimization details
- Included guidance for Windows implementation

* chore(v3/examples): remove html-dnd-api example

The drag-n-drop example now demonstrates both external file drops
and internal HTML5 drag-and-drop, making this separate example redundant.

* docs(v3): move drag-and-drop implementation details to runtime-internals

- Add drag-and-drop section to contributing/runtime-internals.mdx
- Remove IMPLEMENTATION.md from example (content now in proper docs)
- Covers platform differences, debugging tips, and key files

* fix(v3): remove html-dnd-api from example build list

* fix(v3): remove duplicate json import in application_darwin.go

* fix(v3): address CodeRabbit review feedback

- Fix docs to use app.Window.NewWithOptions() instead of deprecated API
- Add mutex protection to dragOverJSBuffer to prevent race conditions
- Add mutex protection to dragThrottleState fields for thread safety

* docs: add coderabbit pre-push requirement to AGENTS.md

* fix(v3/test): use correct CSS class name file-drop-target-active

* chore(v3/test): remove dnd-test directory

This was a development test file that shouldn't be in the PR.
The drag-n-drop example serves as the proper test case.

* docs(v3): update Windows file drop comment to reflect implemented fix

Remove stale TODO - enableFileDrop flag is now injected in navigationCompleted

* refactor(v3): make handleDragAndDropMessage unexported

Internal method only called by application event loop, not part of public API.
2026-01-04 11:08:29 +11:00

766 lines
35 KiB
Go

package events
type ApplicationEventType uint
type WindowEventType uint
var Common = newCommonEvents()
type commonEvents struct {
ApplicationOpenedWithFile ApplicationEventType
ApplicationStarted ApplicationEventType
ApplicationLaunchedWithUrl ApplicationEventType
ThemeChanged ApplicationEventType
WindowClosing WindowEventType
WindowDidMove WindowEventType
WindowDidResize WindowEventType
WindowDPIChanged WindowEventType
WindowFilesDropped WindowEventType
WindowFocus WindowEventType
WindowFullscreen WindowEventType
WindowHide WindowEventType
WindowLostFocus WindowEventType
WindowMaximise WindowEventType
WindowMinimise WindowEventType
WindowToggleFrameless WindowEventType
WindowRestore WindowEventType
WindowRuntimeReady WindowEventType
WindowShow WindowEventType
WindowUnFullscreen WindowEventType
WindowUnMaximise WindowEventType
WindowUnMinimise WindowEventType
WindowZoom WindowEventType
WindowZoomIn WindowEventType
WindowZoomOut WindowEventType
WindowZoomReset WindowEventType
}
func newCommonEvents() commonEvents {
return commonEvents{
ApplicationOpenedWithFile: 1024,
ApplicationStarted: 1025,
ApplicationLaunchedWithUrl: 1026,
ThemeChanged: 1027,
WindowClosing: 1028,
WindowDidMove: 1029,
WindowDidResize: 1030,
WindowDPIChanged: 1031,
WindowFilesDropped: 1032,
WindowFocus: 1033,
WindowFullscreen: 1034,
WindowHide: 1035,
WindowLostFocus: 1036,
WindowMaximise: 1037,
WindowMinimise: 1038,
WindowToggleFrameless: 1039,
WindowRestore: 1040,
WindowRuntimeReady: 1041,
WindowShow: 1042,
WindowUnFullscreen: 1043,
WindowUnMaximise: 1044,
WindowUnMinimise: 1045,
WindowZoom: 1046,
WindowZoomIn: 1047,
WindowZoomOut: 1048,
WindowZoomReset: 1049,
}
}
var Linux = newLinuxEvents()
type linuxEvents struct {
ApplicationStartup ApplicationEventType
SystemThemeChanged ApplicationEventType
WindowDeleteEvent WindowEventType
WindowDidMove WindowEventType
WindowDidResize WindowEventType
WindowFocusIn WindowEventType
WindowFocusOut WindowEventType
WindowLoadStarted WindowEventType
WindowLoadRedirected WindowEventType
WindowLoadCommitted WindowEventType
WindowLoadFinished WindowEventType
}
func newLinuxEvents() linuxEvents {
return linuxEvents{
ApplicationStartup: 1050,
SystemThemeChanged: 1051,
WindowDeleteEvent: 1052,
WindowDidMove: 1053,
WindowDidResize: 1054,
WindowFocusIn: 1055,
WindowFocusOut: 1056,
WindowLoadStarted: 1057,
WindowLoadRedirected: 1058,
WindowLoadCommitted: 1059,
WindowLoadFinished: 1060,
}
}
var Mac = newMacEvents()
type macEvents struct {
ApplicationDidBecomeActive ApplicationEventType
ApplicationDidChangeBackingProperties ApplicationEventType
ApplicationDidChangeEffectiveAppearance ApplicationEventType
ApplicationDidChangeIcon ApplicationEventType
ApplicationDidChangeOcclusionState ApplicationEventType
ApplicationDidChangeScreenParameters ApplicationEventType
ApplicationDidChangeStatusBarFrame ApplicationEventType
ApplicationDidChangeStatusBarOrientation ApplicationEventType
ApplicationDidChangeTheme ApplicationEventType
ApplicationDidFinishLaunching ApplicationEventType
ApplicationDidHide ApplicationEventType
ApplicationDidResignActive ApplicationEventType
ApplicationDidUnhide ApplicationEventType
ApplicationDidUpdate ApplicationEventType
ApplicationShouldHandleReopen ApplicationEventType
ApplicationWillBecomeActive ApplicationEventType
ApplicationWillFinishLaunching ApplicationEventType
ApplicationWillHide ApplicationEventType
ApplicationWillResignActive ApplicationEventType
ApplicationWillTerminate ApplicationEventType
ApplicationWillUnhide ApplicationEventType
ApplicationWillUpdate ApplicationEventType
MenuDidAddItem ApplicationEventType
MenuDidBeginTracking ApplicationEventType
MenuDidClose ApplicationEventType
MenuDidDisplayItem ApplicationEventType
MenuDidEndTracking ApplicationEventType
MenuDidHighlightItem ApplicationEventType
MenuDidOpen ApplicationEventType
MenuDidPopUp ApplicationEventType
MenuDidRemoveItem ApplicationEventType
MenuDidSendAction ApplicationEventType
MenuDidSendActionToItem ApplicationEventType
MenuDidUpdate ApplicationEventType
MenuWillAddItem ApplicationEventType
MenuWillBeginTracking ApplicationEventType
MenuWillDisplayItem ApplicationEventType
MenuWillEndTracking ApplicationEventType
MenuWillHighlightItem ApplicationEventType
MenuWillOpen ApplicationEventType
MenuWillPopUp ApplicationEventType
MenuWillRemoveItem ApplicationEventType
MenuWillSendAction ApplicationEventType
MenuWillSendActionToItem ApplicationEventType
MenuWillUpdate ApplicationEventType
WebViewDidCommitNavigation WindowEventType
WebViewDidFinishNavigation WindowEventType
WebViewDidReceiveServerRedirectForProvisionalNavigation WindowEventType
WebViewDidStartProvisionalNavigation WindowEventType
WindowDidBecomeKey WindowEventType
WindowDidBecomeMain WindowEventType
WindowDidBeginSheet WindowEventType
WindowDidChangeAlpha WindowEventType
WindowDidChangeBackingLocation WindowEventType
WindowDidChangeBackingProperties WindowEventType
WindowDidChangeCollectionBehavior WindowEventType
WindowDidChangeEffectiveAppearance WindowEventType
WindowDidChangeOcclusionState WindowEventType
WindowDidChangeOrderingMode WindowEventType
WindowDidChangeScreen WindowEventType
WindowDidChangeScreenParameters WindowEventType
WindowDidChangeScreenProfile WindowEventType
WindowDidChangeScreenSpace WindowEventType
WindowDidChangeScreenSpaceProperties WindowEventType
WindowDidChangeSharingType WindowEventType
WindowDidChangeSpace WindowEventType
WindowDidChangeSpaceOrderingMode WindowEventType
WindowDidChangeTitle WindowEventType
WindowDidChangeToolbar WindowEventType
WindowDidDeminiaturize WindowEventType
WindowDidEndSheet WindowEventType
WindowDidEnterFullScreen WindowEventType
WindowDidEnterVersionBrowser WindowEventType
WindowDidExitFullScreen WindowEventType
WindowDidExitVersionBrowser WindowEventType
WindowDidExpose WindowEventType
WindowDidFocus WindowEventType
WindowDidMiniaturize WindowEventType
WindowDidMove WindowEventType
WindowDidOrderOffScreen WindowEventType
WindowDidOrderOnScreen WindowEventType
WindowDidResignKey WindowEventType
WindowDidResignMain WindowEventType
WindowDidResize WindowEventType
WindowDidUpdate WindowEventType
WindowDidUpdateAlpha WindowEventType
WindowDidUpdateCollectionBehavior WindowEventType
WindowDidUpdateCollectionProperties WindowEventType
WindowDidUpdateShadow WindowEventType
WindowDidUpdateTitle WindowEventType
WindowDidUpdateToolbar WindowEventType
WindowDidZoom WindowEventType
WindowFileDraggingEntered WindowEventType
WindowFileDraggingExited WindowEventType
WindowFileDraggingPerformed WindowEventType
WindowHide WindowEventType
WindowMaximise WindowEventType
WindowUnMaximise WindowEventType
WindowMinimise WindowEventType
WindowUnMinimise WindowEventType
WindowShouldClose WindowEventType
WindowShow WindowEventType
WindowWillBecomeKey WindowEventType
WindowWillBecomeMain WindowEventType
WindowWillBeginSheet WindowEventType
WindowWillChangeOrderingMode WindowEventType
WindowWillClose WindowEventType
WindowWillDeminiaturize WindowEventType
WindowWillEnterFullScreen WindowEventType
WindowWillEnterVersionBrowser WindowEventType
WindowWillExitFullScreen WindowEventType
WindowWillExitVersionBrowser WindowEventType
WindowWillFocus WindowEventType
WindowWillMiniaturize WindowEventType
WindowWillMove WindowEventType
WindowWillOrderOffScreen WindowEventType
WindowWillOrderOnScreen WindowEventType
WindowWillResignMain WindowEventType
WindowWillResize WindowEventType
WindowWillUnfocus WindowEventType
WindowWillUpdate WindowEventType
WindowWillUpdateAlpha WindowEventType
WindowWillUpdateCollectionBehavior WindowEventType
WindowWillUpdateCollectionProperties WindowEventType
WindowWillUpdateShadow WindowEventType
WindowWillUpdateTitle WindowEventType
WindowWillUpdateToolbar WindowEventType
WindowWillUpdateVisibility WindowEventType
WindowWillUseStandardFrame WindowEventType
WindowZoomIn WindowEventType
WindowZoomOut WindowEventType
WindowZoomReset WindowEventType
}
func newMacEvents() macEvents {
return macEvents{
ApplicationDidBecomeActive: 1061,
ApplicationDidChangeBackingProperties: 1062,
ApplicationDidChangeEffectiveAppearance: 1063,
ApplicationDidChangeIcon: 1064,
ApplicationDidChangeOcclusionState: 1065,
ApplicationDidChangeScreenParameters: 1066,
ApplicationDidChangeStatusBarFrame: 1067,
ApplicationDidChangeStatusBarOrientation: 1068,
ApplicationDidChangeTheme: 1069,
ApplicationDidFinishLaunching: 1070,
ApplicationDidHide: 1071,
ApplicationDidResignActive: 1072,
ApplicationDidUnhide: 1073,
ApplicationDidUpdate: 1074,
ApplicationShouldHandleReopen: 1075,
ApplicationWillBecomeActive: 1076,
ApplicationWillFinishLaunching: 1077,
ApplicationWillHide: 1078,
ApplicationWillResignActive: 1079,
ApplicationWillTerminate: 1080,
ApplicationWillUnhide: 1081,
ApplicationWillUpdate: 1082,
MenuDidAddItem: 1083,
MenuDidBeginTracking: 1084,
MenuDidClose: 1085,
MenuDidDisplayItem: 1086,
MenuDidEndTracking: 1087,
MenuDidHighlightItem: 1088,
MenuDidOpen: 1089,
MenuDidPopUp: 1090,
MenuDidRemoveItem: 1091,
MenuDidSendAction: 1092,
MenuDidSendActionToItem: 1093,
MenuDidUpdate: 1094,
MenuWillAddItem: 1095,
MenuWillBeginTracking: 1096,
MenuWillDisplayItem: 1097,
MenuWillEndTracking: 1098,
MenuWillHighlightItem: 1099,
MenuWillOpen: 1100,
MenuWillPopUp: 1101,
MenuWillRemoveItem: 1102,
MenuWillSendAction: 1103,
MenuWillSendActionToItem: 1104,
MenuWillUpdate: 1105,
WebViewDidCommitNavigation: 1106,
WebViewDidFinishNavigation: 1107,
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1108,
WebViewDidStartProvisionalNavigation: 1109,
WindowDidBecomeKey: 1110,
WindowDidBecomeMain: 1111,
WindowDidBeginSheet: 1112,
WindowDidChangeAlpha: 1113,
WindowDidChangeBackingLocation: 1114,
WindowDidChangeBackingProperties: 1115,
WindowDidChangeCollectionBehavior: 1116,
WindowDidChangeEffectiveAppearance: 1117,
WindowDidChangeOcclusionState: 1118,
WindowDidChangeOrderingMode: 1119,
WindowDidChangeScreen: 1120,
WindowDidChangeScreenParameters: 1121,
WindowDidChangeScreenProfile: 1122,
WindowDidChangeScreenSpace: 1123,
WindowDidChangeScreenSpaceProperties: 1124,
WindowDidChangeSharingType: 1125,
WindowDidChangeSpace: 1126,
WindowDidChangeSpaceOrderingMode: 1127,
WindowDidChangeTitle: 1128,
WindowDidChangeToolbar: 1129,
WindowDidDeminiaturize: 1130,
WindowDidEndSheet: 1131,
WindowDidEnterFullScreen: 1132,
WindowDidEnterVersionBrowser: 1133,
WindowDidExitFullScreen: 1134,
WindowDidExitVersionBrowser: 1135,
WindowDidExpose: 1136,
WindowDidFocus: 1137,
WindowDidMiniaturize: 1138,
WindowDidMove: 1139,
WindowDidOrderOffScreen: 1140,
WindowDidOrderOnScreen: 1141,
WindowDidResignKey: 1142,
WindowDidResignMain: 1143,
WindowDidResize: 1144,
WindowDidUpdate: 1145,
WindowDidUpdateAlpha: 1146,
WindowDidUpdateCollectionBehavior: 1147,
WindowDidUpdateCollectionProperties: 1148,
WindowDidUpdateShadow: 1149,
WindowDidUpdateTitle: 1150,
WindowDidUpdateToolbar: 1151,
WindowDidZoom: 1152,
WindowFileDraggingEntered: 1153,
WindowFileDraggingExited: 1154,
WindowFileDraggingPerformed: 1155,
WindowHide: 1156,
WindowMaximise: 1157,
WindowUnMaximise: 1158,
WindowMinimise: 1159,
WindowUnMinimise: 1160,
WindowShouldClose: 1161,
WindowShow: 1162,
WindowWillBecomeKey: 1163,
WindowWillBecomeMain: 1164,
WindowWillBeginSheet: 1165,
WindowWillChangeOrderingMode: 1166,
WindowWillClose: 1167,
WindowWillDeminiaturize: 1168,
WindowWillEnterFullScreen: 1169,
WindowWillEnterVersionBrowser: 1170,
WindowWillExitFullScreen: 1171,
WindowWillExitVersionBrowser: 1172,
WindowWillFocus: 1173,
WindowWillMiniaturize: 1174,
WindowWillMove: 1175,
WindowWillOrderOffScreen: 1176,
WindowWillOrderOnScreen: 1177,
WindowWillResignMain: 1178,
WindowWillResize: 1179,
WindowWillUnfocus: 1180,
WindowWillUpdate: 1181,
WindowWillUpdateAlpha: 1182,
WindowWillUpdateCollectionBehavior: 1183,
WindowWillUpdateCollectionProperties: 1184,
WindowWillUpdateShadow: 1185,
WindowWillUpdateTitle: 1186,
WindowWillUpdateToolbar: 1187,
WindowWillUpdateVisibility: 1188,
WindowWillUseStandardFrame: 1189,
WindowZoomIn: 1190,
WindowZoomOut: 1191,
WindowZoomReset: 1192,
}
}
var Windows = newWindowsEvents()
type windowsEvents struct {
APMPowerSettingChange ApplicationEventType
APMPowerStatusChange ApplicationEventType
APMResumeAutomatic ApplicationEventType
APMResumeSuspend ApplicationEventType
APMSuspend ApplicationEventType
ApplicationStarted ApplicationEventType
SystemThemeChanged ApplicationEventType
WebViewNavigationCompleted WindowEventType
WindowActive WindowEventType
WindowBackgroundErase WindowEventType
WindowClickActive WindowEventType
WindowClosing WindowEventType
WindowDidMove WindowEventType
WindowDidResize WindowEventType
WindowDPIChanged WindowEventType
WindowDragDrop WindowEventType
WindowDragEnter WindowEventType
WindowDragLeave WindowEventType
WindowDragOver WindowEventType
WindowEndMove WindowEventType
WindowEndResize WindowEventType
WindowFullscreen WindowEventType
WindowHide WindowEventType
WindowInactive WindowEventType
WindowKeyDown WindowEventType
WindowKeyUp WindowEventType
WindowKillFocus WindowEventType
WindowNonClientHit WindowEventType
WindowNonClientMouseDown WindowEventType
WindowNonClientMouseLeave WindowEventType
WindowNonClientMouseMove WindowEventType
WindowNonClientMouseUp WindowEventType
WindowPaint WindowEventType
WindowRestore WindowEventType
WindowSetFocus WindowEventType
WindowShow WindowEventType
WindowStartMove WindowEventType
WindowStartResize WindowEventType
WindowUnFullscreen WindowEventType
WindowZOrderChanged WindowEventType
WindowMinimise WindowEventType
WindowUnMinimise WindowEventType
WindowMaximise WindowEventType
WindowUnMaximise WindowEventType
}
func newWindowsEvents() windowsEvents {
return windowsEvents{
APMPowerSettingChange: 1193,
APMPowerStatusChange: 1194,
APMResumeAutomatic: 1195,
APMResumeSuspend: 1196,
APMSuspend: 1197,
ApplicationStarted: 1198,
SystemThemeChanged: 1199,
WebViewNavigationCompleted: 1200,
WindowActive: 1201,
WindowBackgroundErase: 1202,
WindowClickActive: 1203,
WindowClosing: 1204,
WindowDidMove: 1205,
WindowDidResize: 1206,
WindowDPIChanged: 1207,
WindowDragDrop: 1208,
WindowDragEnter: 1209,
WindowDragLeave: 1210,
WindowDragOver: 1211,
WindowEndMove: 1212,
WindowEndResize: 1213,
WindowFullscreen: 1214,
WindowHide: 1215,
WindowInactive: 1216,
WindowKeyDown: 1217,
WindowKeyUp: 1218,
WindowKillFocus: 1219,
WindowNonClientHit: 1220,
WindowNonClientMouseDown: 1221,
WindowNonClientMouseLeave: 1222,
WindowNonClientMouseMove: 1223,
WindowNonClientMouseUp: 1224,
WindowPaint: 1225,
WindowRestore: 1226,
WindowSetFocus: 1227,
WindowShow: 1228,
WindowStartMove: 1229,
WindowStartResize: 1230,
WindowUnFullscreen: 1231,
WindowZOrderChanged: 1232,
WindowMinimise: 1233,
WindowUnMinimise: 1234,
WindowMaximise: 1235,
WindowUnMaximise: 1236,
}
}
var iOS = newIOSEvents()
type iosEvents struct {
ApplicationDidBecomeActive ApplicationEventType
ApplicationDidEnterBackground ApplicationEventType
ApplicationDidFinishLaunching ApplicationEventType
ApplicationDidReceiveMemoryWarning ApplicationEventType
ApplicationWillEnterForeground ApplicationEventType
ApplicationWillResignActive ApplicationEventType
ApplicationWillTerminate ApplicationEventType
WindowDidLoad WindowEventType
WindowWillAppear WindowEventType
WindowDidAppear WindowEventType
WindowWillDisappear WindowEventType
WindowDidDisappear WindowEventType
WindowSafeAreaInsetsChanged WindowEventType
WindowOrientationChanged WindowEventType
WindowTouchBegan WindowEventType
WindowTouchMoved WindowEventType
WindowTouchEnded WindowEventType
WindowTouchCancelled WindowEventType
WebViewDidStartNavigation WindowEventType
WebViewDidFinishNavigation WindowEventType
WebViewDidFailNavigation WindowEventType
WebViewDecidePolicyForNavigationAction WindowEventType
}
func newIOSEvents() iosEvents {
return iosEvents{
ApplicationDidBecomeActive: 1237,
ApplicationDidEnterBackground: 1238,
ApplicationDidFinishLaunching: 1239,
ApplicationDidReceiveMemoryWarning: 1240,
ApplicationWillEnterForeground: 1241,
ApplicationWillResignActive: 1242,
ApplicationWillTerminate: 1243,
WindowDidLoad: 1244,
WindowWillAppear: 1245,
WindowDidAppear: 1246,
WindowWillDisappear: 1247,
WindowDidDisappear: 1248,
WindowSafeAreaInsetsChanged: 1249,
WindowOrientationChanged: 1250,
WindowTouchBegan: 1251,
WindowTouchMoved: 1252,
WindowTouchEnded: 1253,
WindowTouchCancelled: 1254,
WebViewDidStartNavigation: 1255,
WebViewDidFinishNavigation: 1256,
WebViewDidFailNavigation: 1257,
WebViewDecidePolicyForNavigationAction: 1258,
}
}
func JSEvent(event uint) string {
return eventToJS[event]
}
var eventToJS = map[uint]string{
1024: "common:ApplicationOpenedWithFile",
1025: "common:ApplicationStarted",
1026: "common:ApplicationLaunchedWithUrl",
1027: "common:ThemeChanged",
1028: "common:WindowClosing",
1029: "common:WindowDidMove",
1030: "common:WindowDidResize",
1031: "common:WindowDPIChanged",
1032: "common:WindowFilesDropped",
1033: "common:WindowFocus",
1034: "common:WindowFullscreen",
1035: "common:WindowHide",
1036: "common:WindowLostFocus",
1037: "common:WindowMaximise",
1038: "common:WindowMinimise",
1039: "common:WindowToggleFrameless",
1040: "common:WindowRestore",
1041: "common:WindowRuntimeReady",
1042: "common:WindowShow",
1043: "common:WindowUnFullscreen",
1044: "common:WindowUnMaximise",
1045: "common:WindowUnMinimise",
1046: "common:WindowZoom",
1047: "common:WindowZoomIn",
1048: "common:WindowZoomOut",
1049: "common:WindowZoomReset",
1050: "linux:ApplicationStartup",
1051: "linux:SystemThemeChanged",
1052: "linux:WindowDeleteEvent",
1053: "linux:WindowDidMove",
1054: "linux:WindowDidResize",
1055: "linux:WindowFocusIn",
1056: "linux:WindowFocusOut",
1057: "linux:WindowLoadStarted",
1058: "linux:WindowLoadRedirected",
1059: "linux:WindowLoadCommitted",
1060: "linux:WindowLoadFinished",
1061: "mac:ApplicationDidBecomeActive",
1062: "mac:ApplicationDidChangeBackingProperties",
1063: "mac:ApplicationDidChangeEffectiveAppearance",
1064: "mac:ApplicationDidChangeIcon",
1065: "mac:ApplicationDidChangeOcclusionState",
1066: "mac:ApplicationDidChangeScreenParameters",
1067: "mac:ApplicationDidChangeStatusBarFrame",
1068: "mac:ApplicationDidChangeStatusBarOrientation",
1069: "mac:ApplicationDidChangeTheme",
1070: "mac:ApplicationDidFinishLaunching",
1071: "mac:ApplicationDidHide",
1072: "mac:ApplicationDidResignActive",
1073: "mac:ApplicationDidUnhide",
1074: "mac:ApplicationDidUpdate",
1075: "mac:ApplicationShouldHandleReopen",
1076: "mac:ApplicationWillBecomeActive",
1077: "mac:ApplicationWillFinishLaunching",
1078: "mac:ApplicationWillHide",
1079: "mac:ApplicationWillResignActive",
1080: "mac:ApplicationWillTerminate",
1081: "mac:ApplicationWillUnhide",
1082: "mac:ApplicationWillUpdate",
1083: "mac:MenuDidAddItem",
1084: "mac:MenuDidBeginTracking",
1085: "mac:MenuDidClose",
1086: "mac:MenuDidDisplayItem",
1087: "mac:MenuDidEndTracking",
1088: "mac:MenuDidHighlightItem",
1089: "mac:MenuDidOpen",
1090: "mac:MenuDidPopUp",
1091: "mac:MenuDidRemoveItem",
1092: "mac:MenuDidSendAction",
1093: "mac:MenuDidSendActionToItem",
1094: "mac:MenuDidUpdate",
1095: "mac:MenuWillAddItem",
1096: "mac:MenuWillBeginTracking",
1097: "mac:MenuWillDisplayItem",
1098: "mac:MenuWillEndTracking",
1099: "mac:MenuWillHighlightItem",
1100: "mac:MenuWillOpen",
1101: "mac:MenuWillPopUp",
1102: "mac:MenuWillRemoveItem",
1103: "mac:MenuWillSendAction",
1104: "mac:MenuWillSendActionToItem",
1105: "mac:MenuWillUpdate",
1106: "mac:WebViewDidCommitNavigation",
1107: "mac:WebViewDidFinishNavigation",
1108: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
1109: "mac:WebViewDidStartProvisionalNavigation",
1110: "mac:WindowDidBecomeKey",
1111: "mac:WindowDidBecomeMain",
1112: "mac:WindowDidBeginSheet",
1113: "mac:WindowDidChangeAlpha",
1114: "mac:WindowDidChangeBackingLocation",
1115: "mac:WindowDidChangeBackingProperties",
1116: "mac:WindowDidChangeCollectionBehavior",
1117: "mac:WindowDidChangeEffectiveAppearance",
1118: "mac:WindowDidChangeOcclusionState",
1119: "mac:WindowDidChangeOrderingMode",
1120: "mac:WindowDidChangeScreen",
1121: "mac:WindowDidChangeScreenParameters",
1122: "mac:WindowDidChangeScreenProfile",
1123: "mac:WindowDidChangeScreenSpace",
1124: "mac:WindowDidChangeScreenSpaceProperties",
1125: "mac:WindowDidChangeSharingType",
1126: "mac:WindowDidChangeSpace",
1127: "mac:WindowDidChangeSpaceOrderingMode",
1128: "mac:WindowDidChangeTitle",
1129: "mac:WindowDidChangeToolbar",
1130: "mac:WindowDidDeminiaturize",
1131: "mac:WindowDidEndSheet",
1132: "mac:WindowDidEnterFullScreen",
1133: "mac:WindowDidEnterVersionBrowser",
1134: "mac:WindowDidExitFullScreen",
1135: "mac:WindowDidExitVersionBrowser",
1136: "mac:WindowDidExpose",
1137: "mac:WindowDidFocus",
1138: "mac:WindowDidMiniaturize",
1139: "mac:WindowDidMove",
1140: "mac:WindowDidOrderOffScreen",
1141: "mac:WindowDidOrderOnScreen",
1142: "mac:WindowDidResignKey",
1143: "mac:WindowDidResignMain",
1144: "mac:WindowDidResize",
1145: "mac:WindowDidUpdate",
1146: "mac:WindowDidUpdateAlpha",
1147: "mac:WindowDidUpdateCollectionBehavior",
1148: "mac:WindowDidUpdateCollectionProperties",
1149: "mac:WindowDidUpdateShadow",
1150: "mac:WindowDidUpdateTitle",
1151: "mac:WindowDidUpdateToolbar",
1152: "mac:WindowDidZoom",
1153: "mac:WindowFileDraggingEntered",
1154: "mac:WindowFileDraggingExited",
1155: "mac:WindowFileDraggingPerformed",
1156: "mac:WindowHide",
1157: "mac:WindowMaximise",
1158: "mac:WindowUnMaximise",
1159: "mac:WindowMinimise",
1160: "mac:WindowUnMinimise",
1161: "mac:WindowShouldClose",
1162: "mac:WindowShow",
1163: "mac:WindowWillBecomeKey",
1164: "mac:WindowWillBecomeMain",
1165: "mac:WindowWillBeginSheet",
1166: "mac:WindowWillChangeOrderingMode",
1167: "mac:WindowWillClose",
1168: "mac:WindowWillDeminiaturize",
1169: "mac:WindowWillEnterFullScreen",
1170: "mac:WindowWillEnterVersionBrowser",
1171: "mac:WindowWillExitFullScreen",
1172: "mac:WindowWillExitVersionBrowser",
1173: "mac:WindowWillFocus",
1174: "mac:WindowWillMiniaturize",
1175: "mac:WindowWillMove",
1176: "mac:WindowWillOrderOffScreen",
1177: "mac:WindowWillOrderOnScreen",
1178: "mac:WindowWillResignMain",
1179: "mac:WindowWillResize",
1180: "mac:WindowWillUnfocus",
1181: "mac:WindowWillUpdate",
1182: "mac:WindowWillUpdateAlpha",
1183: "mac:WindowWillUpdateCollectionBehavior",
1184: "mac:WindowWillUpdateCollectionProperties",
1185: "mac:WindowWillUpdateShadow",
1186: "mac:WindowWillUpdateTitle",
1187: "mac:WindowWillUpdateToolbar",
1188: "mac:WindowWillUpdateVisibility",
1189: "mac:WindowWillUseStandardFrame",
1190: "mac:WindowZoomIn",
1191: "mac:WindowZoomOut",
1192: "mac:WindowZoomReset",
1193: "windows:APMPowerSettingChange",
1194: "windows:APMPowerStatusChange",
1195: "windows:APMResumeAutomatic",
1196: "windows:APMResumeSuspend",
1197: "windows:APMSuspend",
1198: "windows:ApplicationStarted",
1199: "windows:SystemThemeChanged",
1200: "windows:WebViewNavigationCompleted",
1201: "windows:WindowActive",
1202: "windows:WindowBackgroundErase",
1203: "windows:WindowClickActive",
1204: "windows:WindowClosing",
1205: "windows:WindowDidMove",
1206: "windows:WindowDidResize",
1207: "windows:WindowDPIChanged",
1208: "windows:WindowDragDrop",
1209: "windows:WindowDragEnter",
1210: "windows:WindowDragLeave",
1211: "windows:WindowDragOver",
1212: "windows:WindowEndMove",
1213: "windows:WindowEndResize",
1214: "windows:WindowFullscreen",
1215: "windows:WindowHide",
1216: "windows:WindowInactive",
1217: "windows:WindowKeyDown",
1218: "windows:WindowKeyUp",
1219: "windows:WindowKillFocus",
1220: "windows:WindowNonClientHit",
1221: "windows:WindowNonClientMouseDown",
1222: "windows:WindowNonClientMouseLeave",
1223: "windows:WindowNonClientMouseMove",
1224: "windows:WindowNonClientMouseUp",
1225: "windows:WindowPaint",
1226: "windows:WindowRestore",
1227: "windows:WindowSetFocus",
1228: "windows:WindowShow",
1229: "windows:WindowStartMove",
1230: "windows:WindowStartResize",
1231: "windows:WindowUnFullscreen",
1232: "windows:WindowZOrderChanged",
1233: "windows:WindowMinimise",
1234: "windows:WindowUnMinimise",
1235: "windows:WindowMaximise",
1236: "windows:WindowUnMaximise",
1237: "ios:ApplicationDidBecomeActive",
1238: "ios:ApplicationDidEnterBackground",
1239: "ios:ApplicationDidFinishLaunching",
1240: "ios:ApplicationDidReceiveMemoryWarning",
1241: "ios:ApplicationWillEnterForeground",
1242: "ios:ApplicationWillResignActive",
1243: "ios:ApplicationWillTerminate",
1244: "ios:WindowDidLoad",
1245: "ios:WindowWillAppear",
1246: "ios:WindowDidAppear",
1247: "ios:WindowWillDisappear",
1248: "ios:WindowDidDisappear",
1249: "ios:WindowSafeAreaInsetsChanged",
1250: "ios:WindowOrientationChanged",
1251: "ios:WindowTouchBegan",
1252: "ios:WindowTouchMoved",
1253: "ios:WindowTouchEnded",
1254: "ios:WindowTouchCancelled",
1255: "ios:WebViewDidStartNavigation",
1256: "ios:WebViewDidFinishNavigation",
1257: "ios:WebViewDidFailNavigation",
1258: "ios:WebViewDecidePolicyForNavigationAction",
}