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

Update windowSetupSignalHandlers & linux events

This commit is contained in:
Lea Anthony 2024-02-04 12:42:00 +11:00 committed by Travis McLane
parent 4467a1ffa2
commit bfa53dfd6c
12 changed files with 626 additions and 506 deletions

View File

@ -155,6 +155,9 @@ export const EventTypes = {
}, },
Linux: { Linux: {
SystemThemeChanged: "linux:SystemThemeChanged", SystemThemeChanged: "linux:SystemThemeChanged",
WindowLoadChanged: "linux:WindowLoadChanged",
WindowDeleteEvent: "linux:WindowDeleteEvent",
ApplicationStartup: "linux:ApplicationStartup",
}, },
Common: { Common: {
ApplicationStarted: "common:ApplicationStarted", ApplicationStarted: "common:ApplicationStarted",

View File

@ -155,6 +155,9 @@ export declare const EventTypes: {
}, },
Linux: { Linux: {
SystemThemeChanged: string, SystemThemeChanged: string,
WindowLoadChanged: string,
WindowDeleteEvent: string,
ApplicationStartup: string,
}, },
Common: { Common: {
ApplicationStarted: string, ApplicationStarted: string,

View File

@ -4,7 +4,6 @@
extern bool hasListeners(unsigned int); extern bool hasListeners(unsigned int);
extern bool shouldQuitApplication(); extern bool shouldQuitApplication();
extern void cleanup(); extern void cleanup();
@implementation AppDelegate @implementation AppDelegate
- (void)dealloc - (void)dealloc
{ {

View File

@ -2,6 +2,7 @@
package application package application
import "C"
import ( import (
"fmt" "fmt"
"log" "log"
@ -213,3 +214,11 @@ func (a *App) logPlatformInfo() {
a.info("Platform Info:", platformInfo...) a.info("Platform Info:", platformInfo...)
} }
//export processWindowEvent
func processWindowEvent(windowID C.uint, eventID C.uint) {
windowEvents <- &windowEvent{
WindowID: uint(windowID),
EventID: uint(eventID),
}
}

View File

@ -58,8 +58,10 @@ typedef struct WindowEvent {
// exported below // exported below
void activateLinux(gpointer data); void activateLinux(gpointer data);
extern void emit(WindowEvent* data); extern void emit(WindowEvent* data);
extern gboolean handleDeleteEvent(GtkWidget*, GdkEvent*, uintptr_t);
extern void handleLoadChanged(WebKitWebView*, WebKitLoadEvent, uintptr_t);
void handleClick(void*); void handleClick(void*);
extern gboolean onButtonEvent(GtkWidget *widget, GdkEventButton *event, gpointer user_data); extern gboolean onButtonEvent(GtkWidget *widget, GdkEventButton *event, uintptr_t user_data);
extern void onDragNDrop( extern void onDragNDrop(
void *target, void *target,
GdkDragContext* context, GdkDragContext* context,
@ -69,7 +71,7 @@ extern void onDragNDrop(
guint info, guint info,
guint time, guint time,
gpointer data); gpointer data);
extern gboolean onKeyPressEvent (GtkWidget *widget, GdkEventKey *event, gpointer user_data); extern gboolean onKeyPressEvent (GtkWidget *widget, GdkEventKey *event, uintptr_t user_data);
extern void onProcessRequest(void *request, gpointer user_data); extern void onProcessRequest(void *request, gpointer user_data);
extern void sendMessageToBackend(WebKitUserContentManager *contentManager, WebKitJavascriptResult *result, void *data); extern void sendMessageToBackend(WebKitUserContentManager *contentManager, WebKitJavascriptResult *result, void *data);
// exported below (end) // exported below (end)
@ -145,6 +147,31 @@ static int GetNumScreens(){
*/ */
import "C" import "C"
// Calloc handles alloc/dealloc of C data
type Calloc struct {
pool []unsafe.Pointer
}
// NewCalloc creates a new allocator
func NewCalloc() Calloc {
return Calloc{}
}
// String creates a new C string and retains a reference to it
func (c Calloc) String(in string) *C.char {
result := C.CString(in)
c.pool = append(c.pool, unsafe.Pointer(result))
return result
}
// Free frees all allocated C memory
func (c Calloc) Free() {
for _, str := range c.pool {
C.free(str)
}
c.pool = []unsafe.Pointer{}
}
type windowPointer *C.GtkWindow type windowPointer *C.GtkWindow
type identifier C.uint type identifier C.uint
type pointer unsafe.Pointer type pointer unsafe.Pointer
@ -910,36 +937,36 @@ func emit(we *C.WindowEvent) {
} }
} }
func windowSetupSignalHandlers(windowId uint, window, webview pointer, emit func(e events.WindowEventType)) { //export handleDeleteEvent
event := C.CString("delete-event") func handleDeleteEvent(widget *C.GtkWidget, event *C.GdkEvent, data C.uintptr_t) C.gboolean {
defer C.free(unsafe.Pointer(event)) processWindowEvent(C.uint(data), C.uint(events.Linux.WindowDeleteEvent))
wEvent := C.WindowEvent{ return C.gboolean(0)
id: C.uint(windowId), }
event: C.uint(events.Common.WindowClosing),
//export handleLoadChanged
func handleLoadChanged(webview *C.WebKitWebView, event C.WebKitLoadEvent, data C.uintptr_t) {
switch event {
case C.WEBKIT_LOAD_FINISHED:
processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadChanged))
} }
C.signal_connect(unsafe.Pointer(window), event, C.emit, unsafe.Pointer(&wEvent)) }
func windowSetupSignalHandlers(windowId uint, window, webview pointer, emit func(e events.WindowEventType)) {
c := NewCalloc()
defer c.Free()
winID := unsafe.Pointer(uintptr(C.uint(windowId)))
// Set up the window close event
C.signal_connect(unsafe.Pointer(window), c.String("delete-event"), C.handleDeleteEvent, winID)
C.signal_connect(unsafe.Pointer(webview), c.String("load-changed"), C.handleLoadChanged, winID)
contentManager := C.webkit_web_view_get_user_content_manager((*C.WebKitWebView)(webview)) contentManager := C.webkit_web_view_get_user_content_manager((*C.WebKitWebView)(webview))
event = C.CString("script-message-received::external") C.signal_connect(unsafe.Pointer(contentManager), c.String("script-message-received::external"), C.sendMessageToBackend, nil)
defer C.free(unsafe.Pointer(event)) C.signal_connect(unsafe.Pointer(webview), c.String("button-press-event"), C.onButtonEvent, winID)
C.signal_connect(unsafe.Pointer(contentManager), event, C.sendMessageToBackend, nil) C.signal_connect(unsafe.Pointer(webview), c.String("button-release-event"), C.onButtonEvent, winID)
C.signal_connect(unsafe.Pointer(webview), c.String("key-press-event"), C.onKeyPressEvent, winID)
/*
event = C.CString("load-changed")
defer C.free(unsafe.Pointer(event))
C.signal_connect(webview, event, C.webviewLoadChanged, unsafe.Pointer(&w.parent.id))
*/
id := C.uint(windowId)
event = C.CString("button-press-event")
C.signal_connect(unsafe.Pointer(webview), event, C.onButtonEvent, unsafe.Pointer(&id))
C.free(unsafe.Pointer(event))
event = C.CString("button-release-event")
defer C.free(unsafe.Pointer(event))
C.signal_connect(unsafe.Pointer(webview), event, C.onButtonEvent, unsafe.Pointer(&id))
event = C.CString("key-press-event")
defer C.free(unsafe.Pointer(event))
C.signal_connect(unsafe.Pointer(webview), event, C.onKeyPressEvent, unsafe.Pointer(&id))
} }
func windowShowDevTools(webview pointer) { func windowShowDevTools(webview pointer) {
@ -1004,13 +1031,13 @@ func windowMove(window pointer, x, y int) {
// FIXME Change this to reflect mouse button! // FIXME Change this to reflect mouse button!
// //
//export onButtonEvent //export onButtonEvent
func onButtonEvent(_ *C.GtkWidget, event *C.GdkEventButton, data unsafe.Pointer) C.gboolean { func onButtonEvent(_ *C.GtkWidget, event *C.GdkEventButton, data C.uintptr_t) C.gboolean {
// Constants (defined here to be easier to use with purego) // Constants (defined here to be easier to use with purego)
GdkButtonPress := C.GDK_BUTTON_PRESS // 4 GdkButtonPress := C.GDK_BUTTON_PRESS // 4
Gdk2ButtonPress := C.GDK_2BUTTON_PRESS // 5 for double-click Gdk2ButtonPress := C.GDK_2BUTTON_PRESS // 5 for double-click
GdkButtonRelease := C.GDK_BUTTON_RELEASE // 7 GdkButtonRelease := C.GDK_BUTTON_RELEASE // 7
windowId := uint(*((*C.uint)(data))) windowId := uint(C.uint(data))
window := globalApplication.getWindowForID(windowId) window := globalApplication.getWindowForID(windowId)
if window == nil { if window == nil {
return C.gboolean(0) return C.gboolean(0)
@ -1068,8 +1095,8 @@ func onDragNDrop(target unsafe.Pointer, context *C.GdkDragContext, x C.gint, y C
} }
//export onKeyPressEvent //export onKeyPressEvent
func onKeyPressEvent(widget *C.GtkWidget, event *C.GdkEventKey, userData unsafe.Pointer) C.gboolean { func onKeyPressEvent(widget *C.GtkWidget, event *C.GdkEventKey, userData C.uintptr_t) C.gboolean {
windowID := uint(*((*C.uint)(userData))) windowID := uint(C.uint(userData))
accelerator, ok := getKeyboardState(event) accelerator, ok := getKeyboardState(event)
if !ok { if !ok {
return C.gboolean(1) return C.gboolean(1)

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"github.com/wailsapp/wails/v3/internal/assetserver" "github.com/wailsapp/wails/v3/internal/assetserver"
"github.com/wailsapp/wails/v3/internal/capabilities" "github.com/wailsapp/wails/v3/internal/capabilities"
"github.com/wailsapp/wails/v3/internal/runtime"
"github.com/wailsapp/wails/v3/pkg/events" "github.com/wailsapp/wails/v3/pkg/events"
) )
@ -395,6 +396,7 @@ func (w *linuxWebviewWindow) run() {
w.minimise() w.minimise()
case WindowStateFullscreen: case WindowStateFullscreen:
w.fullscreen() w.fullscreen()
case WindowStateNormal:
} }
startURL, err := assetserver.GetStartURL(w.parent.options.URL) startURL, err := assetserver.GetStartURL(w.parent.options.URL)
@ -414,6 +416,9 @@ func (w *linuxWebviewWindow) run() {
w.execJS(js) w.execJS(js)
} }
}) })
w.parent.RegisterHook(events.Linux.WindowLoadChanged, func(e *WindowEvent) {
w.execJS(runtime.Core())
})
if w.parent.options.HTML != "" { if w.parent.options.HTML != "" {
w.setHTML(w.parent.options.HTML) w.setHTML(w.parent.options.HTML)
} }

View File

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

View File

@ -1,4 +1,7 @@
linux:SystemThemeChanged linux:SystemThemeChanged
linux:WindowLoadChanged
linux:WindowDeleteEvent
linux:ApplicationStartup
mac:ApplicationDidBecomeActive mac:ApplicationDidBecomeActive
mac:ApplicationDidChangeBackingProperties mac:ApplicationDidChangeBackingProperties
mac:ApplicationDidChangeEffectiveAppearance mac:ApplicationDidChangeEffectiveAppearance

View File

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

View File

@ -0,0 +1,22 @@
//go:build linux
package events
/*
#include "events_linux.h"
#include <stdlib.h>
#include <stdbool.h>
bool hasListener[MAX_EVENTS] = {false};
void registerListener(unsigned int event) {
hasListener[event] = true;
}
bool hasListeners(unsigned int event) {
//return hasListener[event];
return true;
}
*/
import "C"

View File

@ -0,0 +1,17 @@
//go:build linux
#ifndef _events_h
#define _events_h
extern void processApplicationEvent(unsigned int, void* data);
extern void processWindowEvent(unsigned int, unsigned int);
#define EventSystemThemeChanged 1024
#define EventWindowLoadChanged 1025
#define EventWindowDeleteEvent 1026
#define EventApplicationStartup 1027
#define MAX_EVENTS 1028
#endif

View File

@ -61,7 +61,19 @@ $$EVENTTOJS}
` `
var eventsH = `//go:build darwin var darwinEventsH = `//go:build darwin
#ifndef _events_h
#define _events_h
extern void processApplicationEvent(unsigned int, void* data);
extern void processWindowEvent(unsigned int, unsigned int);
$$CHEADEREVENTS
#endif`
var linuxEventsH = `//go:build linux
#ifndef _events_h #ifndef _events_h
#define _events_h #define _events_h
@ -108,10 +120,11 @@ func main() {
linuxEventsDecl := bytes.NewBufferString("") linuxEventsDecl := bytes.NewBufferString("")
linuxEventsValues := bytes.NewBufferString("") linuxEventsValues := bytes.NewBufferString("")
linuxCHeaderEvents := bytes.NewBufferString("")
macEventsDecl := bytes.NewBufferString("") macEventsDecl := bytes.NewBufferString("")
macEventsValues := bytes.NewBufferString("") macEventsValues := bytes.NewBufferString("")
cHeaderEvents := bytes.NewBufferString("") macCHeaderEvents := bytes.NewBufferString("")
windowDelegateEvents := bytes.NewBufferString("") windowDelegateEvents := bytes.NewBufferString("")
applicationDelegateEvents := bytes.NewBufferString("") applicationDelegateEvents := bytes.NewBufferString("")
webviewDelegateEvents := bytes.NewBufferString("") webviewDelegateEvents := bytes.NewBufferString("")
@ -137,6 +150,7 @@ func main() {
var id int var id int
// var maxLinuxEvents int // var maxLinuxEvents int
var maxMacEvents int var maxMacEvents int
var maxLinuxEvents int
var line []byte var line []byte
// 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'}) {
@ -179,7 +193,8 @@ func main() {
linuxJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n") linuxJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
linuxTSEvents.WriteString("\t\t" + event + ": string,\n") linuxTSEvents.WriteString("\t\t" + event + ": string,\n")
eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n") eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
//maxLinuxEvents = id maxLinuxEvents = id
linuxCHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n")
case "mac": case "mac":
eventType := "ApplicationEventType" eventType := "ApplicationEventType"
if strings.HasPrefix(event, "Window") { if strings.HasPrefix(event, "Window") {
@ -192,7 +207,7 @@ func main() {
macEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n") macEventsValues.WriteString("\t\t" + event + ": " + strconv.Itoa(id) + ",\n")
macJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n") macJSEvents.WriteString("\t\t" + event + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
macTSEvents.WriteString("\t\t" + event + ": string,\n") macTSEvents.WriteString("\t\t" + event + ": string,\n")
cHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n") macCHeaderEvents.WriteString("#define Event" + eventTitle + " " + strconv.Itoa(id) + "\n")
eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n") eventToJS.WriteString("\t" + strconv.Itoa(id) + ": \"" + strings.TrimSpace(string(line)) + "\",\n")
maxMacEvents = id maxMacEvents = id
if ignoreEvent { if ignoreEvent {
@ -258,7 +273,8 @@ func main() {
} }
} }
cHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxMacEvents+1) + "\n") macCHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxMacEvents+1) + "\n")
linuxCHeaderEvents.WriteString("\n#define MAX_EVENTS " + strconv.Itoa(maxLinuxEvents+1) + "\n")
// Save the eventsGo template substituting the values and decls // Save the eventsGo template substituting the values and decls
templateToWrite := strings.ReplaceAll(eventsGo, "$$LINUXEVENTSDECL", linuxEventsDecl.String()) templateToWrite := strings.ReplaceAll(eventsGo, "$$LINUXEVENTSDECL", linuxEventsDecl.String())
@ -296,13 +312,20 @@ func main() {
panic(err) panic(err)
} }
// Save the eventsH template substituting the values and decls // Save the darwinEventsH template substituting the values and decls
templateToWrite = strings.ReplaceAll(eventsH, "$$CHEADEREVENTS", cHeaderEvents.String()) templateToWrite = strings.ReplaceAll(darwinEventsH, "$$CHEADEREVENTS", macCHeaderEvents.String())
err = os.WriteFile("../../pkg/events/events_darwin.h", []byte(templateToWrite), 0644) err = os.WriteFile("../../pkg/events/events_darwin.h", []byte(templateToWrite), 0644)
if err != nil { if err != nil {
panic(err) panic(err)
} }
// Save the linuxEventsH template substituting the values and decls
templateToWrite = strings.ReplaceAll(linuxEventsH, "$$CHEADEREVENTS", linuxCHeaderEvents.String())
err = os.WriteFile("../../pkg/events/events_linux.h", []byte(templateToWrite), 0644)
if err != nil {
panic(err)
}
// Load the window_delegate.m file // Load the window_delegate.m file
windowDelegate, err := os.ReadFile("../../pkg/application/webview_window_darwin.m") windowDelegate, err := os.ReadFile("../../pkg/application/webview_window_darwin.m")
if err != nil { if err != nil {