5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 15:30:37 +08:00

Add dnd window event + demo

This commit is contained in:
Lea Anthony 2023-02-12 08:54:08 +11:00
parent 23bfeac02a
commit 2c4c0b4b6b
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
7 changed files with 359 additions and 249 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>body{ text-align: center; color: white; background-color: rgba(0,0,0,0); user-select: none; -ms-user-select: none; -webkit-user-select: none; }</style>
</head>
<body>
<h1>Drag-n-drop Demo</h1>
<br/>
Drop Files onto this window...
<div id="results"></div>
</body>
<script>
wails.Events.On("files", function(event) {
let resultsHTML = "";
event.data.forEach(function(file) {
resultsHTML += "<br/>" + file;
});
document.getElementById("results").innerHTML = resultsHTML;
})
</script>
</html>

View File

@ -0,0 +1,51 @@
package main
import (
"embed"
_ "embed"
"log"
"github.com/wailsapp/wails/v3/pkg/application"
"github.com/wailsapp/wails/v3/pkg/events"
)
//go:embed assets
var assets embed.FS
func main() {
app := application.New(application.Options{
Name: "Drag-n-drop Demo",
Description: "A demo of the Drag-n-drop API",
Mac: application.MacOptions{
ApplicationShouldTerminateAfterLastWindowClosed: true,
},
})
window := app.NewWebviewWindowWithOptions(&application.WebviewWindowOptions{
Title: "Drag-n-drop Demo",
Assets: application.AssetOptions{
FS: assets,
},
Mac: application.MacWindow{
Backdrop: application.MacBackdropTranslucent,
TitleBar: application.MacTitleBarHiddenInsetUnified,
InvisibleTitleBarHeight: 50,
},
})
window.On(events.FilesDropped, func(ctx *application.WindowEventContext) {
files := ctx.DroppedFiles()
app.Events.Emit(&application.CustomEvent{
Name: "files",
Data: files,
})
log.Printf("[Go] FilesDropped received: %+v\n", files)
})
err := app.Run()
if err != nil {
log.Fatal(err.Error())
}
}

View File

@ -2,13 +2,34 @@ package application
var blankWindowEventContext = &WindowEventContext{} var blankWindowEventContext = &WindowEventContext{}
const (
// FilesDropped is the event name for when files are dropped on the window
droppedFiles = "droppedFiles"
)
type WindowEventContext struct { type WindowEventContext struct {
// contains filtered or unexported fields // contains filtered or unexported fields
data map[string]any data map[string]any
} }
func newWindowEventContext() *Context { func (c WindowEventContext) DroppedFiles() []string {
return &Context{ files, ok := c.data[droppedFiles]
if !ok {
return nil
}
result, ok := files.([]string)
if !ok {
return nil
}
return result
}
func (c WindowEventContext) setDroppedFiles(files []string) {
c.data[droppedFiles] = files
}
func newWindowEventContext() *WindowEventContext {
return &WindowEventContext{
data: make(map[string]any), data: make(map[string]any),
} }
} }

View File

@ -659,8 +659,10 @@ func (w *WebviewWindow) error(message string, args ...any) {
func (w *WebviewWindow) handleDragAndDropMessage(event *dragAndDropMessage) { func (w *WebviewWindow) handleDragAndDropMessage(event *dragAndDropMessage) {
println("Drag and drop message received for " + w.Name()) println("Drag and drop message received for " + w.Name())
// Print filenames // Print filenames
for _, file := range event.filenames { ctx := newWindowEventContext()
println(file) ctx.setDroppedFiles(event.filenames)
for _, listener := range w.eventListeners[uint(events.FilesDropped)] {
listener(ctx)
} }
} }

View File

@ -3,6 +3,10 @@ package events
type ApplicationEventType uint type ApplicationEventType uint
type WindowEventType uint type WindowEventType uint
const (
FilesDropped WindowEventType = iota
)
var Mac = newMacEvents() var Mac = newMacEvents()
type macEvents struct { type macEvents struct {
@ -132,127 +136,127 @@ type macEvents struct {
func newMacEvents() macEvents { func newMacEvents() macEvents {
return macEvents{ return macEvents{
ApplicationDidBecomeActive: 0, ApplicationDidBecomeActive: 1024,
ApplicationDidChangeBackingProperties: 1, ApplicationDidChangeBackingProperties: 1025,
ApplicationDidChangeEffectiveAppearance: 2, ApplicationDidChangeEffectiveAppearance: 1026,
ApplicationDidChangeIcon: 3, ApplicationDidChangeIcon: 1027,
ApplicationDidChangeOcclusionState: 4, ApplicationDidChangeOcclusionState: 1028,
ApplicationDidChangeScreenParameters: 5, ApplicationDidChangeScreenParameters: 1029,
ApplicationDidChangeStatusBarFrame: 6, ApplicationDidChangeStatusBarFrame: 1030,
ApplicationDidChangeStatusBarOrientation: 7, ApplicationDidChangeStatusBarOrientation: 1031,
ApplicationDidFinishLaunching: 8, ApplicationDidFinishLaunching: 1032,
ApplicationDidHide: 9, ApplicationDidHide: 1033,
ApplicationDidResignActive: 10, ApplicationDidResignActive: 1034,
ApplicationDidUnhide: 11, ApplicationDidUnhide: 1035,
ApplicationDidUpdate: 12, ApplicationDidUpdate: 1036,
ApplicationWillBecomeActive: 13, ApplicationWillBecomeActive: 1037,
ApplicationWillFinishLaunching: 14, ApplicationWillFinishLaunching: 1038,
ApplicationWillHide: 15, ApplicationWillHide: 1039,
ApplicationWillResignActive: 16, ApplicationWillResignActive: 1040,
ApplicationWillTerminate: 17, ApplicationWillTerminate: 1041,
ApplicationWillUnhide: 18, ApplicationWillUnhide: 1042,
ApplicationWillUpdate: 19, ApplicationWillUpdate: 1043,
WindowDidBecomeKey: 20, WindowDidBecomeKey: 1044,
WindowDidBecomeMain: 21, WindowDidBecomeMain: 1045,
WindowDidBeginSheet: 22, WindowDidBeginSheet: 1046,
WindowDidChangeAlpha: 23, WindowDidChangeAlpha: 1047,
WindowDidChangeBackingLocation: 24, WindowDidChangeBackingLocation: 1048,
WindowDidChangeBackingProperties: 25, WindowDidChangeBackingProperties: 1049,
WindowDidChangeCollectionBehavior: 26, WindowDidChangeCollectionBehavior: 1050,
WindowDidChangeEffectiveAppearance: 27, WindowDidChangeEffectiveAppearance: 1051,
WindowDidChangeOcclusionState: 28, WindowDidChangeOcclusionState: 1052,
WindowDidChangeOrderingMode: 29, WindowDidChangeOrderingMode: 1053,
WindowDidChangeScreen: 30, WindowDidChangeScreen: 1054,
WindowDidChangeScreenParameters: 31, WindowDidChangeScreenParameters: 1055,
WindowDidChangeScreenProfile: 32, WindowDidChangeScreenProfile: 1056,
WindowDidChangeScreenSpace: 33, WindowDidChangeScreenSpace: 1057,
WindowDidChangeScreenSpaceProperties: 34, WindowDidChangeScreenSpaceProperties: 1058,
WindowDidChangeSharingType: 35, WindowDidChangeSharingType: 1059,
WindowDidChangeSpace: 36, WindowDidChangeSpace: 1060,
WindowDidChangeSpaceOrderingMode: 37, WindowDidChangeSpaceOrderingMode: 1061,
WindowDidChangeTitle: 38, WindowDidChangeTitle: 1062,
WindowDidChangeToolbar: 39, WindowDidChangeToolbar: 1063,
WindowDidChangeVisibility: 40, WindowDidChangeVisibility: 1064,
WindowDidClose: 41, WindowDidClose: 1065,
WindowDidDeminiaturize: 42, WindowDidDeminiaturize: 1066,
WindowDidEndSheet: 43, WindowDidEndSheet: 1067,
WindowDidEnterFullScreen: 44, WindowDidEnterFullScreen: 1068,
WindowDidEnterVersionBrowser: 45, WindowDidEnterVersionBrowser: 1069,
WindowDidExitFullScreen: 46, WindowDidExitFullScreen: 1070,
WindowDidExitVersionBrowser: 47, WindowDidExitVersionBrowser: 1071,
WindowDidExpose: 48, WindowDidExpose: 1072,
WindowDidFocus: 49, WindowDidFocus: 1073,
WindowDidMiniaturize: 50, WindowDidMiniaturize: 1074,
WindowDidMove: 51, WindowDidMove: 1075,
WindowDidOrderOffScreen: 52, WindowDidOrderOffScreen: 1076,
WindowDidOrderOnScreen: 53, WindowDidOrderOnScreen: 1077,
WindowDidResignKey: 54, WindowDidResignKey: 1078,
WindowDidResignMain: 55, WindowDidResignMain: 1079,
WindowDidResize: 56, WindowDidResize: 1080,
WindowDidUnfocus: 57, WindowDidUnfocus: 1081,
WindowDidUpdate: 58, WindowDidUpdate: 1082,
WindowDidUpdateAlpha: 59, WindowDidUpdateAlpha: 1083,
WindowDidUpdateCollectionBehavior: 60, WindowDidUpdateCollectionBehavior: 1084,
WindowDidUpdateCollectionProperties: 61, WindowDidUpdateCollectionProperties: 1085,
WindowDidUpdateShadow: 62, WindowDidUpdateShadow: 1086,
WindowDidUpdateTitle: 63, WindowDidUpdateTitle: 1087,
WindowDidUpdateToolbar: 64, WindowDidUpdateToolbar: 1088,
WindowDidUpdateVisibility: 65, WindowDidUpdateVisibility: 1089,
WindowWillBecomeKey: 66, WindowWillBecomeKey: 1090,
WindowWillBecomeMain: 67, WindowWillBecomeMain: 1091,
WindowWillBeginSheet: 68, WindowWillBeginSheet: 1092,
WindowWillChangeOrderingMode: 69, WindowWillChangeOrderingMode: 1093,
WindowWillClose: 70, WindowWillClose: 1094,
WindowWillDeminiaturize: 71, WindowWillDeminiaturize: 1095,
WindowWillEnterFullScreen: 72, WindowWillEnterFullScreen: 1096,
WindowWillEnterVersionBrowser: 73, WindowWillEnterVersionBrowser: 1097,
WindowWillExitFullScreen: 74, WindowWillExitFullScreen: 1098,
WindowWillExitVersionBrowser: 75, WindowWillExitVersionBrowser: 1099,
WindowWillFocus: 76, WindowWillFocus: 1100,
WindowWillMiniaturize: 77, WindowWillMiniaturize: 1101,
WindowWillMove: 78, WindowWillMove: 1102,
WindowWillOrderOffScreen: 79, WindowWillOrderOffScreen: 1103,
WindowWillOrderOnScreen: 80, WindowWillOrderOnScreen: 1104,
WindowWillResignMain: 81, WindowWillResignMain: 1105,
WindowWillResize: 82, WindowWillResize: 1106,
WindowWillUnfocus: 83, WindowWillUnfocus: 1107,
WindowWillUpdate: 84, WindowWillUpdate: 1108,
WindowWillUpdateAlpha: 85, WindowWillUpdateAlpha: 1109,
WindowWillUpdateCollectionBehavior: 86, WindowWillUpdateCollectionBehavior: 1110,
WindowWillUpdateCollectionProperties: 87, WindowWillUpdateCollectionProperties: 1111,
WindowWillUpdateShadow: 88, WindowWillUpdateShadow: 1112,
WindowWillUpdateTitle: 89, WindowWillUpdateTitle: 1113,
WindowWillUpdateToolbar: 90, WindowWillUpdateToolbar: 1114,
WindowWillUpdateVisibility: 91, WindowWillUpdateVisibility: 1115,
WindowWillUseStandardFrame: 92, WindowWillUseStandardFrame: 1116,
MenuWillOpen: 93, MenuWillOpen: 1117,
MenuDidOpen: 94, MenuDidOpen: 1118,
MenuDidClose: 95, MenuDidClose: 1119,
MenuWillSendAction: 96, MenuWillSendAction: 1120,
MenuDidSendAction: 97, MenuDidSendAction: 1121,
MenuWillHighlightItem: 98, MenuWillHighlightItem: 1122,
MenuDidHighlightItem: 99, MenuDidHighlightItem: 1123,
MenuWillDisplayItem: 100, MenuWillDisplayItem: 1124,
MenuDidDisplayItem: 101, MenuDidDisplayItem: 1125,
MenuWillAddItem: 102, MenuWillAddItem: 1126,
MenuDidAddItem: 103, MenuDidAddItem: 1127,
MenuWillRemoveItem: 104, MenuWillRemoveItem: 1128,
MenuDidRemoveItem: 105, MenuDidRemoveItem: 1129,
MenuWillBeginTracking: 106, MenuWillBeginTracking: 1130,
MenuDidBeginTracking: 107, MenuDidBeginTracking: 1131,
MenuWillEndTracking: 108, MenuWillEndTracking: 1132,
MenuDidEndTracking: 109, MenuDidEndTracking: 1133,
MenuWillUpdate: 110, MenuWillUpdate: 1134,
MenuDidUpdate: 111, MenuDidUpdate: 1135,
MenuWillPopUp: 112, MenuWillPopUp: 1136,
MenuDidPopUp: 113, MenuDidPopUp: 1137,
MenuWillSendActionToItem: 114, MenuWillSendActionToItem: 1138,
MenuDidSendActionToItem: 115, MenuDidSendActionToItem: 1139,
WebViewDidStartProvisionalNavigation: 116, WebViewDidStartProvisionalNavigation: 1140,
WebViewDidReceiveServerRedirectForProvisionalNavigation: 117, WebViewDidReceiveServerRedirectForProvisionalNavigation: 1141,
WebViewDidFinishNavigation: 118, WebViewDidFinishNavigation: 1142,
WebViewDidCommitNavigation: 119, WebViewDidCommitNavigation: 1143,
WebViewDraggingEntered: 120, WebViewDraggingEntered: 1144,
WebViewDraggingPerformed: 121, WebViewDraggingPerformed: 1145,
} }
} }

View File

@ -6,130 +6,130 @@
extern void processApplicationEvent(unsigned int); extern void processApplicationEvent(unsigned int);
extern void processWindowEvent(unsigned int, unsigned int); extern void processWindowEvent(unsigned int, unsigned int);
#define EventApplicationDidBecomeActive 0 #define EventApplicationDidBecomeActive 1024
#define EventApplicationDidChangeBackingProperties 1 #define EventApplicationDidChangeBackingProperties 1025
#define EventApplicationDidChangeEffectiveAppearance 2 #define EventApplicationDidChangeEffectiveAppearance 1026
#define EventApplicationDidChangeIcon 3 #define EventApplicationDidChangeIcon 1027
#define EventApplicationDidChangeOcclusionState 4 #define EventApplicationDidChangeOcclusionState 1028
#define EventApplicationDidChangeScreenParameters 5 #define EventApplicationDidChangeScreenParameters 1029
#define EventApplicationDidChangeStatusBarFrame 6 #define EventApplicationDidChangeStatusBarFrame 1030
#define EventApplicationDidChangeStatusBarOrientation 7 #define EventApplicationDidChangeStatusBarOrientation 1031
#define EventApplicationDidFinishLaunching 8 #define EventApplicationDidFinishLaunching 1032
#define EventApplicationDidHide 9 #define EventApplicationDidHide 1033
#define EventApplicationDidResignActive 10 #define EventApplicationDidResignActive 1034
#define EventApplicationDidUnhide 11 #define EventApplicationDidUnhide 1035
#define EventApplicationDidUpdate 12 #define EventApplicationDidUpdate 1036
#define EventApplicationWillBecomeActive 13 #define EventApplicationWillBecomeActive 1037
#define EventApplicationWillFinishLaunching 14 #define EventApplicationWillFinishLaunching 1038
#define EventApplicationWillHide 15 #define EventApplicationWillHide 1039
#define EventApplicationWillResignActive 16 #define EventApplicationWillResignActive 1040
#define EventApplicationWillTerminate 17 #define EventApplicationWillTerminate 1041
#define EventApplicationWillUnhide 18 #define EventApplicationWillUnhide 1042
#define EventApplicationWillUpdate 19 #define EventApplicationWillUpdate 1043
#define EventWindowDidBecomeKey 20 #define EventWindowDidBecomeKey 1044
#define EventWindowDidBecomeMain 21 #define EventWindowDidBecomeMain 1045
#define EventWindowDidBeginSheet 22 #define EventWindowDidBeginSheet 1046
#define EventWindowDidChangeAlpha 23 #define EventWindowDidChangeAlpha 1047
#define EventWindowDidChangeBackingLocation 24 #define EventWindowDidChangeBackingLocation 1048
#define EventWindowDidChangeBackingProperties 25 #define EventWindowDidChangeBackingProperties 1049
#define EventWindowDidChangeCollectionBehavior 26 #define EventWindowDidChangeCollectionBehavior 1050
#define EventWindowDidChangeEffectiveAppearance 27 #define EventWindowDidChangeEffectiveAppearance 1051
#define EventWindowDidChangeOcclusionState 28 #define EventWindowDidChangeOcclusionState 1052
#define EventWindowDidChangeOrderingMode 29 #define EventWindowDidChangeOrderingMode 1053
#define EventWindowDidChangeScreen 30 #define EventWindowDidChangeScreen 1054
#define EventWindowDidChangeScreenParameters 31 #define EventWindowDidChangeScreenParameters 1055
#define EventWindowDidChangeScreenProfile 32 #define EventWindowDidChangeScreenProfile 1056
#define EventWindowDidChangeScreenSpace 33 #define EventWindowDidChangeScreenSpace 1057
#define EventWindowDidChangeScreenSpaceProperties 34 #define EventWindowDidChangeScreenSpaceProperties 1058
#define EventWindowDidChangeSharingType 35 #define EventWindowDidChangeSharingType 1059
#define EventWindowDidChangeSpace 36 #define EventWindowDidChangeSpace 1060
#define EventWindowDidChangeSpaceOrderingMode 37 #define EventWindowDidChangeSpaceOrderingMode 1061
#define EventWindowDidChangeTitle 38 #define EventWindowDidChangeTitle 1062
#define EventWindowDidChangeToolbar 39 #define EventWindowDidChangeToolbar 1063
#define EventWindowDidChangeVisibility 40 #define EventWindowDidChangeVisibility 1064
#define EventWindowDidClose 41 #define EventWindowDidClose 1065
#define EventWindowDidDeminiaturize 42 #define EventWindowDidDeminiaturize 1066
#define EventWindowDidEndSheet 43 #define EventWindowDidEndSheet 1067
#define EventWindowDidEnterFullScreen 44 #define EventWindowDidEnterFullScreen 1068
#define EventWindowDidEnterVersionBrowser 45 #define EventWindowDidEnterVersionBrowser 1069
#define EventWindowDidExitFullScreen 46 #define EventWindowDidExitFullScreen 1070
#define EventWindowDidExitVersionBrowser 47 #define EventWindowDidExitVersionBrowser 1071
#define EventWindowDidExpose 48 #define EventWindowDidExpose 1072
#define EventWindowDidFocus 49 #define EventWindowDidFocus 1073
#define EventWindowDidMiniaturize 50 #define EventWindowDidMiniaturize 1074
#define EventWindowDidMove 51 #define EventWindowDidMove 1075
#define EventWindowDidOrderOffScreen 52 #define EventWindowDidOrderOffScreen 1076
#define EventWindowDidOrderOnScreen 53 #define EventWindowDidOrderOnScreen 1077
#define EventWindowDidResignKey 54 #define EventWindowDidResignKey 1078
#define EventWindowDidResignMain 55 #define EventWindowDidResignMain 1079
#define EventWindowDidResize 56 #define EventWindowDidResize 1080
#define EventWindowDidUnfocus 57 #define EventWindowDidUnfocus 1081
#define EventWindowDidUpdate 58 #define EventWindowDidUpdate 1082
#define EventWindowDidUpdateAlpha 59 #define EventWindowDidUpdateAlpha 1083
#define EventWindowDidUpdateCollectionBehavior 60 #define EventWindowDidUpdateCollectionBehavior 1084
#define EventWindowDidUpdateCollectionProperties 61 #define EventWindowDidUpdateCollectionProperties 1085
#define EventWindowDidUpdateShadow 62 #define EventWindowDidUpdateShadow 1086
#define EventWindowDidUpdateTitle 63 #define EventWindowDidUpdateTitle 1087
#define EventWindowDidUpdateToolbar 64 #define EventWindowDidUpdateToolbar 1088
#define EventWindowDidUpdateVisibility 65 #define EventWindowDidUpdateVisibility 1089
#define EventWindowWillBecomeKey 66 #define EventWindowWillBecomeKey 1090
#define EventWindowWillBecomeMain 67 #define EventWindowWillBecomeMain 1091
#define EventWindowWillBeginSheet 68 #define EventWindowWillBeginSheet 1092
#define EventWindowWillChangeOrderingMode 69 #define EventWindowWillChangeOrderingMode 1093
#define EventWindowWillClose 70 #define EventWindowWillClose 1094
#define EventWindowWillDeminiaturize 71 #define EventWindowWillDeminiaturize 1095
#define EventWindowWillEnterFullScreen 72 #define EventWindowWillEnterFullScreen 1096
#define EventWindowWillEnterVersionBrowser 73 #define EventWindowWillEnterVersionBrowser 1097
#define EventWindowWillExitFullScreen 74 #define EventWindowWillExitFullScreen 1098
#define EventWindowWillExitVersionBrowser 75 #define EventWindowWillExitVersionBrowser 1099
#define EventWindowWillFocus 76 #define EventWindowWillFocus 1100
#define EventWindowWillMiniaturize 77 #define EventWindowWillMiniaturize 1101
#define EventWindowWillMove 78 #define EventWindowWillMove 1102
#define EventWindowWillOrderOffScreen 79 #define EventWindowWillOrderOffScreen 1103
#define EventWindowWillOrderOnScreen 80 #define EventWindowWillOrderOnScreen 1104
#define EventWindowWillResignMain 81 #define EventWindowWillResignMain 1105
#define EventWindowWillResize 82 #define EventWindowWillResize 1106
#define EventWindowWillUnfocus 83 #define EventWindowWillUnfocus 1107
#define EventWindowWillUpdate 84 #define EventWindowWillUpdate 1108
#define EventWindowWillUpdateAlpha 85 #define EventWindowWillUpdateAlpha 1109
#define EventWindowWillUpdateCollectionBehavior 86 #define EventWindowWillUpdateCollectionBehavior 1110
#define EventWindowWillUpdateCollectionProperties 87 #define EventWindowWillUpdateCollectionProperties 1111
#define EventWindowWillUpdateShadow 88 #define EventWindowWillUpdateShadow 1112
#define EventWindowWillUpdateTitle 89 #define EventWindowWillUpdateTitle 1113
#define EventWindowWillUpdateToolbar 90 #define EventWindowWillUpdateToolbar 1114
#define EventWindowWillUpdateVisibility 91 #define EventWindowWillUpdateVisibility 1115
#define EventWindowWillUseStandardFrame 92 #define EventWindowWillUseStandardFrame 1116
#define EventMenuWillOpen 93 #define EventMenuWillOpen 1117
#define EventMenuDidOpen 94 #define EventMenuDidOpen 1118
#define EventMenuDidClose 95 #define EventMenuDidClose 1119
#define EventMenuWillSendAction 96 #define EventMenuWillSendAction 1120
#define EventMenuDidSendAction 97 #define EventMenuDidSendAction 1121
#define EventMenuWillHighlightItem 98 #define EventMenuWillHighlightItem 1122
#define EventMenuDidHighlightItem 99 #define EventMenuDidHighlightItem 1123
#define EventMenuWillDisplayItem 100 #define EventMenuWillDisplayItem 1124
#define EventMenuDidDisplayItem 101 #define EventMenuDidDisplayItem 1125
#define EventMenuWillAddItem 102 #define EventMenuWillAddItem 1126
#define EventMenuDidAddItem 103 #define EventMenuDidAddItem 1127
#define EventMenuWillRemoveItem 104 #define EventMenuWillRemoveItem 1128
#define EventMenuDidRemoveItem 105 #define EventMenuDidRemoveItem 1129
#define EventMenuWillBeginTracking 106 #define EventMenuWillBeginTracking 1130
#define EventMenuDidBeginTracking 107 #define EventMenuDidBeginTracking 1131
#define EventMenuWillEndTracking 108 #define EventMenuWillEndTracking 1132
#define EventMenuDidEndTracking 109 #define EventMenuDidEndTracking 1133
#define EventMenuWillUpdate 110 #define EventMenuWillUpdate 1134
#define EventMenuDidUpdate 111 #define EventMenuDidUpdate 1135
#define EventMenuWillPopUp 112 #define EventMenuWillPopUp 1136
#define EventMenuDidPopUp 113 #define EventMenuDidPopUp 1137
#define EventMenuWillSendActionToItem 114 #define EventMenuWillSendActionToItem 1138
#define EventMenuDidSendActionToItem 115 #define EventMenuDidSendActionToItem 1139
#define EventWebViewDidStartProvisionalNavigation 116 #define EventWebViewDidStartProvisionalNavigation 1140
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 117 #define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1141
#define EventWebViewDidFinishNavigation 118 #define EventWebViewDidFinishNavigation 1142
#define EventWebViewDidCommitNavigation 119 #define EventWebViewDidCommitNavigation 1143
#define EventWebViewDraggingEntered 120 #define EventWebViewDraggingEntered 1144
#define EventWebViewDraggingPerformed 121 #define EventWebViewDraggingPerformed 1145
#define MAX_EVENTS 123 #define MAX_EVENTS 1146
#endif #endif

View File

@ -12,6 +12,10 @@ var eventsGo = `package events
type ApplicationEventType uint type ApplicationEventType uint
type WindowEventType uint type WindowEventType uint
const (
FilesDropped WindowEventType = iota
)
var Mac = newMacEvents() var Mac = newMacEvents()
type macEvents struct { type macEvents struct {
@ -54,6 +58,9 @@ func main() {
// Loop over each line in the file // Loop over each line in the file
for id, line = range bytes.Split(eventNames, []byte{'\n'}) { for id, line = range bytes.Split(eventNames, []byte{'\n'}) {
// First 1024 is reserved
id = id + 1024
// Skip empty lines // Skip empty lines
if len(line) == 0 { if len(line) == 0 {
continue continue