Fix mac/js events

This commit is contained in:
Lea Anthony 2025-02-02 10:22:11 +11:00
commit b4c4cd8ae8
No known key found for this signature in database
GPG key ID: 33DAF7BB90A58405
9 changed files with 561 additions and 543 deletions

View file

@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed use-before-define errors in binding generator output by [@fbbdev](https://github.com/fbbdev) in [#4001](https://github.com/wailsapp/wails/pull/4001)
- Pass build flags to binding generator by [@fbbdev](https://github.com/fbbdev) in [#4023](https://github.com/wailsapp/wails/pull/4023)
- Change paths in windows Taskfile to forward slashes to ensure it works on non-Windows platforms by [@leaanthony](https://github.com/leaanthony)
- Mac + Mac JS events now fixed by [@leaanthony](https://github.com/leaanthony)
### Changed

View file

@ -1,7 +1,7 @@
{
"name": "@wailsio/runtime",
"type": "module",
"version": "3.0.0-alpha.49",
"version": "3.0.0-alpha.54",
"description": "Wails Runtime",
"types": "types/index.d.ts",
"exports": {

View file

@ -28,8 +28,6 @@ export const EventTypes = {
WindowKeyDown: "windows:WindowKeyDown",
WindowKeyUp: "windows:WindowKeyUp",
WindowKillFocus: "windows:WindowKillFocus",
WindowMaximise: "windows:WindowMaximise",
WindowMinimise: "windows:WindowMinimise",
WindowNonClientHit: "windows:WindowNonClientHit",
WindowNonClientMouseDown: "windows:WindowNonClientMouseDown",
WindowNonClientMouseLeave: "windows:WindowNonClientMouseLeave",
@ -42,9 +40,11 @@ export const EventTypes = {
WindowStartMove: "windows:WindowStartMove",
WindowStartResize: "windows:WindowStartResize",
WindowUnFullscreen: "windows:WindowUnFullscreen",
WindowUnMaximise: "windows:WindowUnMaximise",
WindowUnMinimise: "windows:WindowUnMinimise",
WindowZOrderChanged: "windows:WindowZOrderChanged",
WindowMinimise: "windows:WindowMinimise",
WindowUnMinimise: "windows:WindowUnMinimise",
WindowMaximise: "windows:WindowMaximise",
WindowUnMaximise: "windows:WindowUnMaximise",
},
Mac: {
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive",
@ -55,13 +55,13 @@ export const EventTypes = {
ApplicationDidChangeScreenParameters: "mac:ApplicationDidChangeScreenParameters",
ApplicationDidChangeStatusBarFrame: "mac:ApplicationDidChangeStatusBarFrame",
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme!",
ApplicationDidChangeTheme: "mac:ApplicationDidChangeTheme",
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
ApplicationDidHide: "mac:ApplicationDidHide",
ApplicationDidResignActiveNotification: "mac:ApplicationDidResignActiveNotification",
ApplicationDidResignActive: "mac:ApplicationDidResignActive",
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen!",
ApplicationShouldHandleReopen: "mac:ApplicationShouldHandleReopen",
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
ApplicationWillFinishLaunching: "mac:ApplicationWillFinishLaunching",
ApplicationWillHide: "mac:ApplicationWillHide",
@ -138,15 +138,17 @@ export const EventTypes = {
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow",
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle",
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar",
WindowDidZoom: "mac:WindowDidZoom!",
WindowDidZoom: "mac:WindowDidZoom",
WindowFileDraggingEntered: "mac:WindowFileDraggingEntered",
WindowFileDraggingExited: "mac:WindowFileDraggingExited",
WindowFileDraggingPerformed: "mac:WindowFileDraggingPerformed",
WindowHide: "mac:WindowHide",
WindowMaximize: "mac:WindowMaximize",
WindowShouldClose: "mac:WindowShouldClose!",
WindowShow: "mac:WindowShow",
WindowMaximise: "mac:WindowMaximise",
WindowUnMaximise: "mac:WindowUnMaximise",
WindowMinimise: "mac:WindowMinimise",
WindowUnMinimise: "mac:WindowUnMinimise",
WindowShouldClose: "mac:WindowShouldClose",
WindowShow: "mac:WindowShow",
WindowWillBecomeKey: "mac:WindowWillBecomeKey",
WindowWillBecomeMain: "mac:WindowWillBecomeMain",
WindowWillBeginSheet: "mac:WindowWillBeginSheet",
@ -174,9 +176,9 @@ export const EventTypes = {
WindowWillUpdateToolbar: "mac:WindowWillUpdateToolbar",
WindowWillUpdateVisibility: "mac:WindowWillUpdateVisibility",
WindowWillUseStandardFrame: "mac:WindowWillUseStandardFrame",
WindowZoomIn: "mac:WindowZoomIn!",
WindowZoomOut: "mac:WindowZoomOut!",
WindowZoomReset: "mac:WindowZoomReset!",
WindowZoomIn: "mac:WindowZoomIn",
WindowZoomOut: "mac:WindowZoomOut",
WindowZoomReset: "mac:WindowZoomReset",
},
Linux: {
ApplicationStartup: "linux:ApplicationStartup",

View file

@ -28,8 +28,6 @@ export declare const EventTypes: {
WindowKeyDown: string,
WindowKeyUp: string,
WindowKillFocus: string,
WindowMaximise: string,
WindowMinimise: string,
WindowNonClientHit: string,
WindowNonClientMouseDown: string,
WindowNonClientMouseLeave: string,
@ -42,9 +40,11 @@ export declare const EventTypes: {
WindowStartMove: string,
WindowStartResize: string,
WindowUnFullscreen: string,
WindowUnMaximise: string,
WindowUnMinimise: string,
WindowZOrderChanged: string,
WindowMinimise: string,
WindowUnMinimise: string,
WindowMaximise: string,
WindowUnMaximise: string,
},
Mac: {
ApplicationDidBecomeActive: string,
@ -58,7 +58,7 @@ export declare const EventTypes: {
ApplicationDidChangeTheme: string,
ApplicationDidFinishLaunching: string,
ApplicationDidHide: string,
ApplicationDidResignActiveNotification: string,
ApplicationDidResignActive: string,
ApplicationDidUnhide: string,
ApplicationDidUpdate: string,
ApplicationShouldHandleReopen: string,
@ -143,10 +143,12 @@ export declare const EventTypes: {
WindowFileDraggingExited: string,
WindowFileDraggingPerformed: string,
WindowHide: string,
WindowMaximize: string,
WindowMaximise: string,
WindowUnMaximise: string,
WindowMinimise: string,
WindowUnMinimise: string,
WindowShouldClose: string,
WindowShow: string,
WindowUnMaximise: string,
WindowWillBecomeKey: string,
WindowWillBecomeMain: string,
WindowWillBeginSheet: string,

View file

@ -117,9 +117,9 @@ extern void handleSecondInstanceData(char * message);
}
}
- (void)applicationDidResignActiveNotification:(NSNotification *)notification {
if( hasListeners(EventApplicationDidResignActiveNotification) ) {
processApplicationEvent(EventApplicationDidResignActiveNotification, NULL);
- (void)applicationDidResignActive:(NSNotification *)notification {
if( hasListeners(EventApplicationDidResignActive) ) {
processApplicationEvent(EventApplicationDidResignActive, NULL);
}
}

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@ mac:ApplicationDidChangeStatusBarOrientation
mac:ApplicationDidChangeTheme!
mac:ApplicationDidFinishLaunching
mac:ApplicationDidHide
mac:ApplicationDidResignActiveNotification
mac:ApplicationDidResignActive
mac:ApplicationDidUnhide
mac:ApplicationDidUpdate
mac:ApplicationShouldHandleReopen!
@ -126,10 +126,12 @@ mac:WindowFileDraggingEntered
mac:WindowFileDraggingExited
mac:WindowFileDraggingPerformed
mac:WindowHide
mac:WindowMaximize
mac:WindowMaximise!
mac:WindowUnMaximise!
mac:WindowMinimise!
mac:WindowUnMinimise!
mac:WindowShouldClose!
mac:WindowShow
mac:WindowUnMaximise
mac:WindowWillBecomeKey
mac:WindowWillBecomeMain
mac:WindowWillBeginSheet
@ -187,8 +189,6 @@ windows:WindowInactive
windows:WindowKeyDown
windows:WindowKeyUp
windows:WindowKillFocus
windows:WindowMaximise
windows:WindowMinimise
windows:WindowNonClientHit
windows:WindowNonClientMouseDown
windows:WindowNonClientMouseLeave
@ -201,6 +201,8 @@ windows:WindowShow
windows:WindowStartMove
windows:WindowStartResize
windows:WindowUnFullscreen
windows:WindowUnMaximise
windows:WindowUnMinimise
windows:WindowZOrderChanged
windows:WindowMinimise
windows:WindowUnMinimise
windows:WindowMaximise
windows:WindowUnMaximise

View file

@ -17,7 +17,7 @@ extern void processWindowEvent(unsigned int, unsigned int);
#define EventApplicationDidChangeTheme 1064
#define EventApplicationDidFinishLaunching 1065
#define EventApplicationDidHide 1066
#define EventApplicationDidResignActiveNotification 1067
#define EventApplicationDidResignActive 1067
#define EventApplicationDidUnhide 1068
#define EventApplicationDidUpdate 1069
#define EventApplicationShouldHandleReopen 1070
@ -102,42 +102,44 @@ extern void processWindowEvent(unsigned int, unsigned int);
#define EventWindowFileDraggingExited 1149
#define EventWindowFileDraggingPerformed 1150
#define EventWindowHide 1151
#define EventWindowMaximize 1152
#define EventWindowShouldClose 1153
#define EventWindowShow 1154
#define EventWindowUnMaximise 1155
#define EventWindowWillBecomeKey 1156
#define EventWindowWillBecomeMain 1157
#define EventWindowWillBeginSheet 1158
#define EventWindowWillChangeOrderingMode 1159
#define EventWindowWillClose 1160
#define EventWindowWillDeminiaturize 1161
#define EventWindowWillEnterFullScreen 1162
#define EventWindowWillEnterVersionBrowser 1163
#define EventWindowWillExitFullScreen 1164
#define EventWindowWillExitVersionBrowser 1165
#define EventWindowWillFocus 1166
#define EventWindowWillMiniaturize 1167
#define EventWindowWillMove 1168
#define EventWindowWillOrderOffScreen 1169
#define EventWindowWillOrderOnScreen 1170
#define EventWindowWillResignMain 1171
#define EventWindowWillResize 1172
#define EventWindowWillUnfocus 1173
#define EventWindowWillUpdate 1174
#define EventWindowWillUpdateAlpha 1175
#define EventWindowWillUpdateCollectionBehavior 1176
#define EventWindowWillUpdateCollectionProperties 1177
#define EventWindowWillUpdateShadow 1178
#define EventWindowWillUpdateTitle 1179
#define EventWindowWillUpdateToolbar 1180
#define EventWindowWillUpdateVisibility 1181
#define EventWindowWillUseStandardFrame 1182
#define EventWindowZoomIn 1183
#define EventWindowZoomOut 1184
#define EventWindowZoomReset 1185
#define EventWindowMaximise 1152
#define EventWindowUnMaximise 1153
#define EventWindowMinimise 1154
#define EventWindowUnMinimise 1155
#define EventWindowShouldClose 1156
#define EventWindowShow 1157
#define EventWindowWillBecomeKey 1158
#define EventWindowWillBecomeMain 1159
#define EventWindowWillBeginSheet 1160
#define EventWindowWillChangeOrderingMode 1161
#define EventWindowWillClose 1162
#define EventWindowWillDeminiaturize 1163
#define EventWindowWillEnterFullScreen 1164
#define EventWindowWillEnterVersionBrowser 1165
#define EventWindowWillExitFullScreen 1166
#define EventWindowWillExitVersionBrowser 1167
#define EventWindowWillFocus 1168
#define EventWindowWillMiniaturize 1169
#define EventWindowWillMove 1170
#define EventWindowWillOrderOffScreen 1171
#define EventWindowWillOrderOnScreen 1172
#define EventWindowWillResignMain 1173
#define EventWindowWillResize 1174
#define EventWindowWillUnfocus 1175
#define EventWindowWillUpdate 1176
#define EventWindowWillUpdateAlpha 1177
#define EventWindowWillUpdateCollectionBehavior 1178
#define EventWindowWillUpdateCollectionProperties 1179
#define EventWindowWillUpdateShadow 1180
#define EventWindowWillUpdateTitle 1181
#define EventWindowWillUpdateToolbar 1182
#define EventWindowWillUpdateVisibility 1183
#define EventWindowWillUseStandardFrame 1184
#define EventWindowZoomIn 1185
#define EventWindowZoomOut 1186
#define EventWindowZoomReset 1187
#define MAX_EVENTS 1186
#define MAX_EVENTS 1188
#endif

View file

@ -172,9 +172,13 @@ func main() {
event := strings.TrimSpace(string(split[1]))
var ignoreEvent bool
if strings.HasSuffix(event, "!") {
event = event[:len(event)-1]
event = strings.TrimSuffix(event, "!")
ignoreEvent = true
}
// Strip last byte of line if it's a "!" character
if line[len(line)-1] == '!' {
line = line[:len(line)-1]
}
// Title case the event name
eventTitle := string(bytes.ToUpper([]byte{event[0]})) + event[1:]