5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 00:10:47 +08:00

[v3] Fix systray example. PositionWindow now takes an offset. EventApplicationDidResignActive -> EventApplicationDidResignActiveNotification

This commit is contained in:
Lea Anthony 2023-07-04 19:26:00 +10:00
parent 16ce9e562f
commit 3d323ab9d2
14 changed files with 339 additions and 359 deletions

View File

@ -2,7 +2,7 @@ package main
import (
_ "embed"
"fmt"
"github.com/wailsapp/wails/v3/pkg/events"
"github.com/wailsapp/wails/v3/pkg/icons"
"log"
"runtime"
@ -10,13 +10,6 @@ import (
"github.com/wailsapp/wails/v3/pkg/application"
)
var counter int
func clickCount() int {
counter++
return counter
}
func main() {
app := application.New(application.Options{
Name: "Systray Demo",
@ -27,10 +20,23 @@ func main() {
})
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
Width: 500,
Height: 800,
//Frameless: true,
Hidden: true,
Width: 500,
Height: 800,
Frameless: true,
AlwaysOnTop: true,
Hidden: true,
ShouldClose: func(window *application.WebviewWindow) bool {
window.Hide()
return false
},
})
window.On(events.Common.WindowLostFocus, func(ctx *application.WindowEventContext) {
window.Hide()
})
app.On(events.Mac.ApplicationDidResignActiveNotification, func() {
window.Hide()
})
systemTray := app.NewSystemTray()
@ -73,8 +79,11 @@ func main() {
}
showWindow := func() {
window.SetTitle(fmt.Sprintf("Clicked %d times", clickCount()))
err := systemTray.PositionWindow(window)
if window.IsVisible() {
window.Hide()
return
}
err := systemTray.PositionWindow(window, 5)
if err != nil {
application.InfoDialog().SetTitle("Error").SetMessage(err.Error()).Show()
return

View File

@ -20,7 +20,7 @@ export const EventTypes = {
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
ApplicationDidHide: "mac:ApplicationDidHide",
ApplicationDidResignActive: "mac:ApplicationDidResignActive",
ApplicationDidResignActiveNotification: "mac:ApplicationDidResignActiveNotification",
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
@ -66,7 +66,6 @@ export const EventTypes = {
WindowDidResignKey: "mac:WindowDidResignKey",
WindowDidResignMain: "mac:WindowDidResignMain",
WindowDidResize: "mac:WindowDidResize",
WindowDidUnfocus: "mac:WindowDidUnfocus",
WindowDidUpdate: "mac:WindowDidUpdate",
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha",
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior",
@ -145,7 +144,7 @@ export const EventTypes = {
ApplicationDidChangeStatusBarOrientation: "mac:ApplicationDidChangeStatusBarOrientation",
ApplicationDidFinishLaunching: "mac:ApplicationDidFinishLaunching",
ApplicationDidHide: "mac:ApplicationDidHide",
ApplicationDidResignActive: "mac:ApplicationDidResignActive",
ApplicationDidResignActiveNotification: "mac:ApplicationDidResignActiveNotification",
ApplicationDidUnhide: "mac:ApplicationDidUnhide",
ApplicationDidUpdate: "mac:ApplicationDidUpdate",
ApplicationWillBecomeActive: "mac:ApplicationWillBecomeActive",
@ -191,7 +190,6 @@ export const EventTypes = {
WindowDidResignKey: "mac:WindowDidResignKey",
WindowDidResignMain: "mac:WindowDidResignMain",
WindowDidResize: "mac:WindowDidResize",
WindowDidUnfocus: "mac:WindowDidUnfocus",
WindowDidUpdate: "mac:WindowDidUpdate",
WindowDidUpdateAlpha: "mac:WindowDidUpdateAlpha",
WindowDidUpdateCollectionBehavior: "mac:WindowDidUpdateCollectionBehavior",
@ -279,7 +277,7 @@ export const EventTypes = {
WindowZoomOut: "common:WindowZoomOut",
WindowZoomReset: "common:WindowZoomReset",
WindowFocus: "common:WindowFocus",
WindowUnFocus: "common:WindowUnFocus",
WindowLostFocus: "common:WindowLostFocus",
WindowShow: "common:WindowShow",
WindowHide: "common:WindowHide",
WindowDPIChanged: "common:WindowDPIChanged",

View File

@ -73,9 +73,9 @@ extern bool hasListeners(unsigned int);
}
}
- (void)applicationDidResignActive:(NSNotification *)notification {
if( hasListeners(EventApplicationDidResignActive) ) {
processApplicationEvent(EventApplicationDidResignActive);
- (void)applicationDidResignActiveNotification:(NSNotification *)notification {
if( hasListeners(EventApplicationDidResignActiveNotification) ) {
processApplicationEvent(EventApplicationDidResignActiveNotification);
}
}

View File

@ -29,7 +29,11 @@ type systemTrayImpl interface {
setDarkModeIcon(icon []byte)
bounds() (*Rect, error)
getScreen() (*Screen, error)
positionWindow(window *WebviewWindow) error
positionWindow(window *WebviewWindow, offset int) error
}
type PositionOptions struct {
Buffer int
}
type SystemTray struct {
@ -81,12 +85,12 @@ func (s *SystemTray) run() {
invokeSync(s.impl.run)
}
func (s *SystemTray) PositionWindow(window *WebviewWindow) error {
func (s *SystemTray) PositionWindow(window *WebviewWindow, offset int) error {
if s.impl == nil {
return fmt.Errorf("system tray not running")
}
return invokeSyncWithError(func() error {
return s.impl.positionWindow(window)
return s.impl.positionWindow(window, offset)
})
}

View File

@ -57,7 +57,7 @@ func (s *macosSystemTray) setMenu(menu *Menu) {
s.menu = menu
}
func (s *macosSystemTray) positionWindow(window *WebviewWindow) error {
func (s *macosSystemTray) positionWindow(window *WebviewWindow, offset int) error {
// Get the trayBounds of this system tray
trayBounds, err := s.bounds()
@ -70,61 +70,23 @@ func (s *macosSystemTray) positionWindow(window *WebviewWindow) error {
if err != nil {
return err
}
screenBounds := currentScreen.Bounds
// Determine which quadrant of the screen the system tray is in
// ----------
// | 1 | 2 |
// ----------
// | 3 | 4 |
// ----------
quadrant := 4
if trayBounds.X < screenBounds.Width/2 {
quadrant -= 1
}
if trayBounds.Y < screenBounds.Height/2 {
quadrant -= 2
}
// Get the center height of the window
windowWidthCenter := window.Width() / 2
// Get the center height of the system tray
systemTrayWidthCenter := trayBounds.Width / 2
// Position the window based on the quadrant
// It will be centered on the system tray and if it goes off-screen it will be moved back on screen
switch quadrant {
case 1:
// The X will be 0 and the Y will be the system tray Y
// Center the window on the system tray
window.SetRelativePosition(0, trayBounds.Y)
case 2:
// The Y will be 0 and the X will make the center of the window line up with the center of the system tray
windowX := trayBounds.X + systemTrayWidthCenter - windowWidthCenter
// If the end of the window goes off-screen, move it back enough to be on screen
if windowX+window.Width() > screenBounds.Width {
windowX = screenBounds.Width - window.Width()
}
window.SetRelativePosition(windowX, 0)
case 3:
// The X will be 0 and the Y will be the system tray Y - the height of the window
windowY := trayBounds.Y - window.Height()
// If the end of the window goes off-screen, move it back enough to be on screen
if windowY < 0 {
windowY = 0
}
window.SetRelativePosition(0, windowY)
case 4:
// The Y will be 0 and the X will make the center of the window line up with the center of the system tray - the height of the window
windowX := trayBounds.X + systemTrayWidthCenter - windowWidthCenter
windowY := trayBounds.Y - window.Height()
// If the end of the window goes off-screen, move it back enough to be on screen
if windowX+window.Width() > screenBounds.Width {
windowX = screenBounds.Width - window.Width()
}
window.SetRelativePosition(windowX, windowY)
// The Y will be 0 and the X will make the center of the window line up with the center of the system tray
windowX := trayBounds.X + systemTrayWidthCenter - windowWidthCenter
// If the end of the window goes off-screen, move it back enough to be on screen
if windowX+window.Width() > screenBounds.Width {
windowX = screenBounds.Width - window.Width()
}
window.SetRelativePosition(windowX, int(C.statusBarHeight())+offset)
return nil
}

View File

@ -12,4 +12,5 @@ void systemTraySetIcon(void* nsStatusItem, void* nsImage, int position, bool isT
void systemTraySetMenu(void* nsStatusItem, void* nsMenu);
void systemTrayDestroy(void* nsStatusItem);
void showMenu(void* nsStatusItem);
void systemTrayGetBounds(void* nsStatusItem, NSRect *rect);
void systemTrayGetBounds(void* nsStatusItem, NSRect *rect);
int statusBarHeight();

View File

@ -105,4 +105,10 @@ void systemTrayGetBounds(void* nsStatusItem, NSRect *rect) {
NSStatusItem *statusItem = (NSStatusItem *)nsStatusItem;
NSRect buttonFrame = statusItem.button.frame;
*rect = [statusItem.button.window convertRectToScreen:buttonFrame];
}
}
int statusBarHeight() {
NSMenu *mainMenu = [NSApp mainMenu];
CGFloat menuBarHeight = [mainMenu menuBarHeight];
return (int)menuBarHeight;
}

View File

@ -30,7 +30,7 @@ type windowsSystemTray struct {
currentIcon w32.HICON
}
func (s *windowsSystemTray) positionWindow(window *WebviewWindow) error {
func (s *windowsSystemTray) positionWindow(window *WebviewWindow, offset int) error {
// Get the trayBounds of this system tray
trayBounds, err := s.bounds()
@ -51,7 +51,7 @@ func (s *windowsSystemTray) positionWindow(window *WebviewWindow) error {
case w32.ABE_LEFT:
if trayBounds == nil {
// Move it to the bottom left corner of the screen
window.SetRelativePosition(0, screenBounds.Height-window.Height())
window.SetRelativePosition(offset, screenBounds.Height-window.Height())
return nil
}
newHeight := trayBounds.Y - (window.Height() / 2)
@ -59,11 +59,11 @@ func (s *windowsSystemTray) positionWindow(window *WebviewWindow) error {
newHeight = 0
}
// Move it to the top left corner of the screen
window.SetRelativePosition(0, newHeight)
window.SetRelativePosition(offset, newHeight)
case w32.ABE_TOP:
if trayBounds == nil {
// Move it to the top right corner of the screen
window.SetRelativePosition(screenBounds.Width-window.Width(), 0)
window.SetRelativePosition(screenBounds.Width-window.Width(), offset)
return nil
}
newWidth := trayBounds.X - (window.Width() / 2)
@ -71,29 +71,29 @@ func (s *windowsSystemTray) positionWindow(window *WebviewWindow) error {
newWidth = screenBounds.Width - window.Width()
}
// Move it to the top left corner of the screen
window.SetRelativePosition(newWidth, 0)
window.SetRelativePosition(newWidth, offset)
case w32.ABE_RIGHT:
if trayBounds == nil {
// Move it to the bottom right corner of the screen
window.SetRelativePosition(screenBounds.Width-window.Width(), screenBounds.Height-window.Height())
window.SetRelativePosition(screenBounds.Width-window.Width()-offset, screenBounds.Height-window.Height())
return nil
}
newHeight := trayBounds.Y - (window.Height() / 2)
if newHeight > screenBounds.Height-window.Height() {
newHeight = screenBounds.Height - window.Height()
}
window.SetRelativePosition(screenBounds.Width-window.Width(), newHeight)
window.SetRelativePosition(screenBounds.Width-window.Width()-offset, newHeight)
case w32.ABE_BOTTOM:
if trayBounds == nil {
// Move it to the bottom right corner of the screen
window.SetRelativePosition(screenBounds.Width-window.Width(), screenBounds.Height-window.Height())
window.SetRelativePosition(screenBounds.Width-window.Width(), screenBounds.Height-window.Height()-offset)
return nil
}
newWidth := trayBounds.X - (window.Width() / 2)
if newWidth > screenBounds.Width-window.Width() {
newWidth = screenBounds.Width - window.Width()
}
window.SetRelativePosition(newWidth, screenBounds.Height-window.Height())
window.SetRelativePosition(newWidth, screenBounds.Height-window.Height()-offset)
}
return nil
}

View File

@ -689,6 +689,16 @@ void windowSetEnabled(void *window, bool enabled) {
// TODO: Implement
}
void windowFocus(void *window) {
WebviewWindow* nsWindow = (WebviewWindow*)window;
// If the current application is not active, activate it
if (![[NSApplication sharedApplication] isActive]) {
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
[nsWindow makeKeyAndOrderFront:nil];
[nsWindow makeKeyWindow];
}
*/
import "C"
import (
@ -721,7 +731,8 @@ func (w *macosWebviewWindow) startResize(_ string) error {
}
func (w *macosWebviewWindow) focus() {
w.show()
// Make the window key and main
C.windowFocus(w.nsWindow)
}
func (w *macosWebviewWindow) openContextMenu(menu *Menu, data *ContextMenuData) {
@ -1075,9 +1086,12 @@ func (w *macosWebviewWindow) run() {
w.parent.emit(events.Common.WindowClosing)
})
// Translate WindowDidUnfocus to common WindowUnFocus event
w.parent.On(events.Mac.WindowDidUnfocus, func(_ *WindowEventContext) {
w.parent.emit(events.Common.WindowUnFocus)
// Translate WindowDidResignKey to common WindowLostFocus event
w.parent.On(events.Mac.WindowDidResignKey, func(_ *WindowEventContext) {
w.parent.emit(events.Common.WindowLostFocus)
})
w.parent.On(events.Mac.WindowDidResignMain, func(_ *WindowEventContext) {
w.parent.emit(events.Common.WindowLostFocus)
})
if w.parent.options.HTML != "" {

View File

@ -57,18 +57,15 @@ extern bool hasListeners(unsigned int);
self.leftMouseEvent = nil;
[super dealloc];
}
- (void) startDrag:(WebviewWindow*)window {
[window performWindowDragWithEvent:self.leftMouseEvent];
}
// Handle script messages from the external bridge
- (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
NSString *m = message.body;
const char *_m = [m UTF8String];
processMessage(self.windowId, _m);
}
- (void)handleLeftMouseDown:(NSEvent *)event {
self.leftMouseEvent = event;
NSWindow *window = [event window];
@ -314,12 +311,6 @@ extern bool hasListeners(unsigned int);
}
}
- (void)windowDidUnfocus:(NSNotification *)notification {
if( hasListeners(EventWindowDidUnfocus) ) {
processWindowEvent(self.windowId, EventWindowDidUnfocus);
}
}
- (void)windowDidUpdate:(NSNotification *)notification {
if( hasListeners(EventWindowDidUpdate) ) {
processWindowEvent(self.windowId, EventWindowDidUpdate);

View File

@ -751,7 +751,7 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
w.parent.emit(events.Common.WindowClosing)
return 0
case w32.WM_KILLFOCUS:
w.parent.emit(events.Common.WindowUnFocus)
w.parent.emit(events.Common.WindowLostFocus)
case w32.WM_SETFOCUS:
w.parent.emit(events.Common.WindowFocus)
case w32.WM_NCLBUTTONDOWN:

View File

@ -24,7 +24,7 @@ type commonEvents struct {
WindowZoomOut WindowEventType
WindowZoomReset WindowEventType
WindowFocus WindowEventType
WindowUnFocus WindowEventType
WindowLostFocus WindowEventType
WindowShow WindowEventType
WindowHide WindowEventType
WindowDPIChanged WindowEventType
@ -32,24 +32,24 @@ type commonEvents struct {
func newCommonEvents() commonEvents {
return commonEvents{
ApplicationStarted: 1154,
WindowMaximise: 1155,
WindowUnMaximise: 1156,
WindowFullscreen: 1157,
WindowUnFullscreen: 1158,
WindowRestore: 1159,
WindowMinimise: 1160,
WindowUnMinimise: 1161,
WindowClosing: 1162,
WindowZoom: 1163,
WindowZoomIn: 1164,
WindowZoomOut: 1165,
WindowZoomReset: 1166,
WindowFocus: 1167,
WindowUnFocus: 1168,
WindowShow: 1169,
WindowHide: 1170,
WindowDPIChanged: 1171,
ApplicationStarted: 1153,
WindowMaximise: 1154,
WindowUnMaximise: 1155,
WindowFullscreen: 1156,
WindowUnFullscreen: 1157,
WindowRestore: 1158,
WindowMinimise: 1159,
WindowUnMinimise: 1160,
WindowClosing: 1161,
WindowZoom: 1162,
WindowZoomIn: 1163,
WindowZoomOut: 1164,
WindowZoomReset: 1165,
WindowFocus: 1166,
WindowLostFocus: 1167,
WindowShow: 1168,
WindowHide: 1169,
WindowDPIChanged: 1170,
}
}
@ -66,7 +66,7 @@ type macEvents struct {
ApplicationDidChangeStatusBarOrientation ApplicationEventType
ApplicationDidFinishLaunching ApplicationEventType
ApplicationDidHide ApplicationEventType
ApplicationDidResignActive ApplicationEventType
ApplicationDidResignActiveNotification ApplicationEventType
ApplicationDidUnhide ApplicationEventType
ApplicationDidUpdate ApplicationEventType
ApplicationWillBecomeActive ApplicationEventType
@ -112,7 +112,6 @@ type macEvents struct {
WindowDidResignKey WindowEventType
WindowDidResignMain WindowEventType
WindowDidResize WindowEventType
WindowDidUnfocus WindowEventType
WindowDidUpdate WindowEventType
WindowDidUpdateAlpha WindowEventType
WindowDidUpdateCollectionBehavior WindowEventType
@ -193,7 +192,7 @@ func newMacEvents() macEvents {
ApplicationDidChangeStatusBarOrientation: 1031,
ApplicationDidFinishLaunching: 1032,
ApplicationDidHide: 1033,
ApplicationDidResignActive: 1034,
ApplicationDidResignActiveNotification: 1034,
ApplicationDidUnhide: 1035,
ApplicationDidUpdate: 1036,
ApplicationWillBecomeActive: 1037,
@ -239,73 +238,72 @@ func newMacEvents() macEvents {
WindowDidResignKey: 1077,
WindowDidResignMain: 1078,
WindowDidResize: 1079,
WindowDidUnfocus: 1080,
WindowDidUpdate: 1081,
WindowDidUpdateAlpha: 1082,
WindowDidUpdateCollectionBehavior: 1083,
WindowDidUpdateCollectionProperties: 1084,
WindowDidUpdateShadow: 1085,
WindowDidUpdateTitle: 1086,
WindowDidUpdateToolbar: 1087,
WindowDidUpdateVisibility: 1088,
WindowShouldClose: 1089,
WindowWillBecomeKey: 1090,
WindowWillBecomeMain: 1091,
WindowWillBeginSheet: 1092,
WindowWillChangeOrderingMode: 1093,
WindowWillClose: 1094,
WindowWillDeminiaturize: 1095,
WindowWillEnterFullScreen: 1096,
WindowWillEnterVersionBrowser: 1097,
WindowWillExitFullScreen: 1098,
WindowWillExitVersionBrowser: 1099,
WindowWillFocus: 1100,
WindowWillMiniaturize: 1101,
WindowWillMove: 1102,
WindowWillOrderOffScreen: 1103,
WindowWillOrderOnScreen: 1104,
WindowWillResignMain: 1105,
WindowWillResize: 1106,
WindowWillUnfocus: 1107,
WindowWillUpdate: 1108,
WindowWillUpdateAlpha: 1109,
WindowWillUpdateCollectionBehavior: 1110,
WindowWillUpdateCollectionProperties: 1111,
WindowWillUpdateShadow: 1112,
WindowWillUpdateTitle: 1113,
WindowWillUpdateToolbar: 1114,
WindowWillUpdateVisibility: 1115,
WindowWillUseStandardFrame: 1116,
MenuWillOpen: 1117,
MenuDidOpen: 1118,
MenuDidClose: 1119,
MenuWillSendAction: 1120,
MenuDidSendAction: 1121,
MenuWillHighlightItem: 1122,
MenuDidHighlightItem: 1123,
MenuWillDisplayItem: 1124,
MenuDidDisplayItem: 1125,
MenuWillAddItem: 1126,
MenuDidAddItem: 1127,
MenuWillRemoveItem: 1128,
MenuDidRemoveItem: 1129,
MenuWillBeginTracking: 1130,
MenuDidBeginTracking: 1131,
MenuWillEndTracking: 1132,
MenuDidEndTracking: 1133,
MenuWillUpdate: 1134,
MenuDidUpdate: 1135,
MenuWillPopUp: 1136,
MenuDidPopUp: 1137,
MenuWillSendActionToItem: 1138,
MenuDidSendActionToItem: 1139,
WebViewDidStartProvisionalNavigation: 1140,
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1141,
WebViewDidFinishNavigation: 1142,
WebViewDidCommitNavigation: 1143,
WindowFileDraggingEntered: 1144,
WindowFileDraggingPerformed: 1145,
WindowFileDraggingExited: 1146,
WindowDidUpdate: 1080,
WindowDidUpdateAlpha: 1081,
WindowDidUpdateCollectionBehavior: 1082,
WindowDidUpdateCollectionProperties: 1083,
WindowDidUpdateShadow: 1084,
WindowDidUpdateTitle: 1085,
WindowDidUpdateToolbar: 1086,
WindowDidUpdateVisibility: 1087,
WindowShouldClose: 1088,
WindowWillBecomeKey: 1089,
WindowWillBecomeMain: 1090,
WindowWillBeginSheet: 1091,
WindowWillChangeOrderingMode: 1092,
WindowWillClose: 1093,
WindowWillDeminiaturize: 1094,
WindowWillEnterFullScreen: 1095,
WindowWillEnterVersionBrowser: 1096,
WindowWillExitFullScreen: 1097,
WindowWillExitVersionBrowser: 1098,
WindowWillFocus: 1099,
WindowWillMiniaturize: 1100,
WindowWillMove: 1101,
WindowWillOrderOffScreen: 1102,
WindowWillOrderOnScreen: 1103,
WindowWillResignMain: 1104,
WindowWillResize: 1105,
WindowWillUnfocus: 1106,
WindowWillUpdate: 1107,
WindowWillUpdateAlpha: 1108,
WindowWillUpdateCollectionBehavior: 1109,
WindowWillUpdateCollectionProperties: 1110,
WindowWillUpdateShadow: 1111,
WindowWillUpdateTitle: 1112,
WindowWillUpdateToolbar: 1113,
WindowWillUpdateVisibility: 1114,
WindowWillUseStandardFrame: 1115,
MenuWillOpen: 1116,
MenuDidOpen: 1117,
MenuDidClose: 1118,
MenuWillSendAction: 1119,
MenuDidSendAction: 1120,
MenuWillHighlightItem: 1121,
MenuDidHighlightItem: 1122,
MenuWillDisplayItem: 1123,
MenuDidDisplayItem: 1124,
MenuWillAddItem: 1125,
MenuDidAddItem: 1126,
MenuWillRemoveItem: 1127,
MenuDidRemoveItem: 1128,
MenuWillBeginTracking: 1129,
MenuDidBeginTracking: 1130,
MenuWillEndTracking: 1131,
MenuDidEndTracking: 1132,
MenuWillUpdate: 1133,
MenuDidUpdate: 1134,
MenuWillPopUp: 1135,
MenuDidPopUp: 1136,
MenuWillSendActionToItem: 1137,
MenuDidSendActionToItem: 1138,
WebViewDidStartProvisionalNavigation: 1139,
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1140,
WebViewDidFinishNavigation: 1141,
WebViewDidCommitNavigation: 1142,
WindowFileDraggingEntered: 1143,
WindowFileDraggingPerformed: 1144,
WindowFileDraggingExited: 1145,
}
}
@ -323,13 +321,13 @@ type windowsEvents struct {
func newWindowsEvents() windowsEvents {
return windowsEvents{
SystemThemeChanged: 1147,
APMPowerStatusChange: 1148,
APMSuspend: 1149,
APMResumeAutomatic: 1150,
APMResumeSuspend: 1151,
APMPowerSettingChange: 1152,
WebViewNavigationCompleted: 1153,
SystemThemeChanged: 1146,
APMPowerStatusChange: 1147,
APMSuspend: 1148,
APMResumeAutomatic: 1149,
APMResumeSuspend: 1150,
APMPowerSettingChange: 1151,
WebViewNavigationCompleted: 1152,
}
}
@ -348,7 +346,7 @@ var eventToJS = map[uint]string{
1031: "mac:ApplicationDidChangeStatusBarOrientation",
1032: "mac:ApplicationDidFinishLaunching",
1033: "mac:ApplicationDidHide",
1034: "mac:ApplicationDidResignActive",
1034: "mac:ApplicationDidResignActiveNotification",
1035: "mac:ApplicationDidUnhide",
1036: "mac:ApplicationDidUpdate",
1037: "mac:ApplicationWillBecomeActive",
@ -394,96 +392,95 @@ var eventToJS = map[uint]string{
1077: "mac:WindowDidResignKey",
1078: "mac:WindowDidResignMain",
1079: "mac:WindowDidResize",
1080: "mac:WindowDidUnfocus",
1081: "mac:WindowDidUpdate",
1082: "mac:WindowDidUpdateAlpha",
1083: "mac:WindowDidUpdateCollectionBehavior",
1084: "mac:WindowDidUpdateCollectionProperties",
1085: "mac:WindowDidUpdateShadow",
1086: "mac:WindowDidUpdateTitle",
1087: "mac:WindowDidUpdateToolbar",
1088: "mac:WindowDidUpdateVisibility",
1089: "mac:WindowShouldClose!",
1090: "mac:WindowWillBecomeKey",
1091: "mac:WindowWillBecomeMain",
1092: "mac:WindowWillBeginSheet",
1093: "mac:WindowWillChangeOrderingMode",
1094: "mac:WindowWillClose",
1095: "mac:WindowWillDeminiaturize",
1096: "mac:WindowWillEnterFullScreen",
1097: "mac:WindowWillEnterVersionBrowser",
1098: "mac:WindowWillExitFullScreen",
1099: "mac:WindowWillExitVersionBrowser",
1100: "mac:WindowWillFocus",
1101: "mac:WindowWillMiniaturize",
1102: "mac:WindowWillMove",
1103: "mac:WindowWillOrderOffScreen",
1104: "mac:WindowWillOrderOnScreen",
1105: "mac:WindowWillResignMain",
1106: "mac:WindowWillResize",
1107: "mac:WindowWillUnfocus",
1108: "mac:WindowWillUpdate",
1109: "mac:WindowWillUpdateAlpha",
1110: "mac:WindowWillUpdateCollectionBehavior",
1111: "mac:WindowWillUpdateCollectionProperties",
1112: "mac:WindowWillUpdateShadow",
1113: "mac:WindowWillUpdateTitle",
1114: "mac:WindowWillUpdateToolbar",
1115: "mac:WindowWillUpdateVisibility",
1116: "mac:WindowWillUseStandardFrame",
1117: "mac:MenuWillOpen",
1118: "mac:MenuDidOpen",
1119: "mac:MenuDidClose",
1120: "mac:MenuWillSendAction",
1121: "mac:MenuDidSendAction",
1122: "mac:MenuWillHighlightItem",
1123: "mac:MenuDidHighlightItem",
1124: "mac:MenuWillDisplayItem",
1125: "mac:MenuDidDisplayItem",
1126: "mac:MenuWillAddItem",
1127: "mac:MenuDidAddItem",
1128: "mac:MenuWillRemoveItem",
1129: "mac:MenuDidRemoveItem",
1130: "mac:MenuWillBeginTracking",
1131: "mac:MenuDidBeginTracking",
1132: "mac:MenuWillEndTracking",
1133: "mac:MenuDidEndTracking",
1134: "mac:MenuWillUpdate",
1135: "mac:MenuDidUpdate",
1136: "mac:MenuWillPopUp",
1137: "mac:MenuDidPopUp",
1138: "mac:MenuWillSendActionToItem",
1139: "mac:MenuDidSendActionToItem",
1140: "mac:WebViewDidStartProvisionalNavigation",
1141: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
1142: "mac:WebViewDidFinishNavigation",
1143: "mac:WebViewDidCommitNavigation",
1144: "mac:WindowFileDraggingEntered",
1145: "mac:WindowFileDraggingPerformed",
1146: "mac:WindowFileDraggingExited",
1147: "windows:SystemThemeChanged",
1148: "windows:APMPowerStatusChange",
1149: "windows:APMSuspend",
1150: "windows:APMResumeAutomatic",
1151: "windows:APMResumeSuspend",
1152: "windows:APMPowerSettingChange",
1153: "windows:WebViewNavigationCompleted",
1154: "common:ApplicationStarted",
1155: "common:WindowMaximise",
1156: "common:WindowUnMaximise",
1157: "common:WindowFullscreen",
1158: "common:WindowUnFullscreen",
1159: "common:WindowRestore",
1160: "common:WindowMinimise",
1161: "common:WindowUnMinimise",
1162: "common:WindowClosing",
1163: "common:WindowZoom",
1164: "common:WindowZoomIn",
1165: "common:WindowZoomOut",
1166: "common:WindowZoomReset",
1167: "common:WindowFocus",
1168: "common:WindowUnFocus",
1169: "common:WindowShow",
1170: "common:WindowHide",
1171: "common:WindowDPIChanged",
1080: "mac:WindowDidUpdate",
1081: "mac:WindowDidUpdateAlpha",
1082: "mac:WindowDidUpdateCollectionBehavior",
1083: "mac:WindowDidUpdateCollectionProperties",
1084: "mac:WindowDidUpdateShadow",
1085: "mac:WindowDidUpdateTitle",
1086: "mac:WindowDidUpdateToolbar",
1087: "mac:WindowDidUpdateVisibility",
1088: "mac:WindowShouldClose!",
1089: "mac:WindowWillBecomeKey",
1090: "mac:WindowWillBecomeMain",
1091: "mac:WindowWillBeginSheet",
1092: "mac:WindowWillChangeOrderingMode",
1093: "mac:WindowWillClose",
1094: "mac:WindowWillDeminiaturize",
1095: "mac:WindowWillEnterFullScreen",
1096: "mac:WindowWillEnterVersionBrowser",
1097: "mac:WindowWillExitFullScreen",
1098: "mac:WindowWillExitVersionBrowser",
1099: "mac:WindowWillFocus",
1100: "mac:WindowWillMiniaturize",
1101: "mac:WindowWillMove",
1102: "mac:WindowWillOrderOffScreen",
1103: "mac:WindowWillOrderOnScreen",
1104: "mac:WindowWillResignMain",
1105: "mac:WindowWillResize",
1106: "mac:WindowWillUnfocus",
1107: "mac:WindowWillUpdate",
1108: "mac:WindowWillUpdateAlpha",
1109: "mac:WindowWillUpdateCollectionBehavior",
1110: "mac:WindowWillUpdateCollectionProperties",
1111: "mac:WindowWillUpdateShadow",
1112: "mac:WindowWillUpdateTitle",
1113: "mac:WindowWillUpdateToolbar",
1114: "mac:WindowWillUpdateVisibility",
1115: "mac:WindowWillUseStandardFrame",
1116: "mac:MenuWillOpen",
1117: "mac:MenuDidOpen",
1118: "mac:MenuDidClose",
1119: "mac:MenuWillSendAction",
1120: "mac:MenuDidSendAction",
1121: "mac:MenuWillHighlightItem",
1122: "mac:MenuDidHighlightItem",
1123: "mac:MenuWillDisplayItem",
1124: "mac:MenuDidDisplayItem",
1125: "mac:MenuWillAddItem",
1126: "mac:MenuDidAddItem",
1127: "mac:MenuWillRemoveItem",
1128: "mac:MenuDidRemoveItem",
1129: "mac:MenuWillBeginTracking",
1130: "mac:MenuDidBeginTracking",
1131: "mac:MenuWillEndTracking",
1132: "mac:MenuDidEndTracking",
1133: "mac:MenuWillUpdate",
1134: "mac:MenuDidUpdate",
1135: "mac:MenuWillPopUp",
1136: "mac:MenuDidPopUp",
1137: "mac:MenuWillSendActionToItem",
1138: "mac:MenuDidSendActionToItem",
1139: "mac:WebViewDidStartProvisionalNavigation",
1140: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
1141: "mac:WebViewDidFinishNavigation",
1142: "mac:WebViewDidCommitNavigation",
1143: "mac:WindowFileDraggingEntered",
1144: "mac:WindowFileDraggingPerformed",
1145: "mac:WindowFileDraggingExited",
1146: "windows:SystemThemeChanged",
1147: "windows:APMPowerStatusChange",
1148: "windows:APMSuspend",
1149: "windows:APMResumeAutomatic",
1150: "windows:APMResumeSuspend",
1151: "windows:APMPowerSettingChange",
1152: "windows:WebViewNavigationCompleted",
1153: "common:ApplicationStarted",
1154: "common:WindowMaximise",
1155: "common:WindowUnMaximise",
1156: "common:WindowFullscreen",
1157: "common:WindowUnFullscreen",
1158: "common:WindowRestore",
1159: "common:WindowMinimise",
1160: "common:WindowUnMinimise",
1161: "common:WindowClosing",
1162: "common:WindowZoom",
1163: "common:WindowZoomIn",
1164: "common:WindowZoomOut",
1165: "common:WindowZoomReset",
1166: "common:WindowFocus",
1167: "common:WindowLostFocus",
1168: "common:WindowShow",
1169: "common:WindowHide",
1170: "common:WindowDPIChanged",
}

View File

@ -16,7 +16,7 @@ extern void processWindowEvent(unsigned int, unsigned int);
#define EventApplicationDidChangeStatusBarOrientation 1031
#define EventApplicationDidFinishLaunching 1032
#define EventApplicationDidHide 1033
#define EventApplicationDidResignActive 1034
#define EventApplicationDidResignActiveNotification 1034
#define EventApplicationDidUnhide 1035
#define EventApplicationDidUpdate 1036
#define EventApplicationWillBecomeActive 1037
@ -62,75 +62,74 @@ extern void processWindowEvent(unsigned int, unsigned int);
#define EventWindowDidResignKey 1077
#define EventWindowDidResignMain 1078
#define EventWindowDidResize 1079
#define EventWindowDidUnfocus 1080
#define EventWindowDidUpdate 1081
#define EventWindowDidUpdateAlpha 1082
#define EventWindowDidUpdateCollectionBehavior 1083
#define EventWindowDidUpdateCollectionProperties 1084
#define EventWindowDidUpdateShadow 1085
#define EventWindowDidUpdateTitle 1086
#define EventWindowDidUpdateToolbar 1087
#define EventWindowDidUpdateVisibility 1088
#define EventWindowShouldClose 1089
#define EventWindowWillBecomeKey 1090
#define EventWindowWillBecomeMain 1091
#define EventWindowWillBeginSheet 1092
#define EventWindowWillChangeOrderingMode 1093
#define EventWindowWillClose 1094
#define EventWindowWillDeminiaturize 1095
#define EventWindowWillEnterFullScreen 1096
#define EventWindowWillEnterVersionBrowser 1097
#define EventWindowWillExitFullScreen 1098
#define EventWindowWillExitVersionBrowser 1099
#define EventWindowWillFocus 1100
#define EventWindowWillMiniaturize 1101
#define EventWindowWillMove 1102
#define EventWindowWillOrderOffScreen 1103
#define EventWindowWillOrderOnScreen 1104
#define EventWindowWillResignMain 1105
#define EventWindowWillResize 1106
#define EventWindowWillUnfocus 1107
#define EventWindowWillUpdate 1108
#define EventWindowWillUpdateAlpha 1109
#define EventWindowWillUpdateCollectionBehavior 1110
#define EventWindowWillUpdateCollectionProperties 1111
#define EventWindowWillUpdateShadow 1112
#define EventWindowWillUpdateTitle 1113
#define EventWindowWillUpdateToolbar 1114
#define EventWindowWillUpdateVisibility 1115
#define EventWindowWillUseStandardFrame 1116
#define EventMenuWillOpen 1117
#define EventMenuDidOpen 1118
#define EventMenuDidClose 1119
#define EventMenuWillSendAction 1120
#define EventMenuDidSendAction 1121
#define EventMenuWillHighlightItem 1122
#define EventMenuDidHighlightItem 1123
#define EventMenuWillDisplayItem 1124
#define EventMenuDidDisplayItem 1125
#define EventMenuWillAddItem 1126
#define EventMenuDidAddItem 1127
#define EventMenuWillRemoveItem 1128
#define EventMenuDidRemoveItem 1129
#define EventMenuWillBeginTracking 1130
#define EventMenuDidBeginTracking 1131
#define EventMenuWillEndTracking 1132
#define EventMenuDidEndTracking 1133
#define EventMenuWillUpdate 1134
#define EventMenuDidUpdate 1135
#define EventMenuWillPopUp 1136
#define EventMenuDidPopUp 1137
#define EventMenuWillSendActionToItem 1138
#define EventMenuDidSendActionToItem 1139
#define EventWebViewDidStartProvisionalNavigation 1140
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1141
#define EventWebViewDidFinishNavigation 1142
#define EventWebViewDidCommitNavigation 1143
#define EventWindowFileDraggingEntered 1144
#define EventWindowFileDraggingPerformed 1145
#define EventWindowFileDraggingExited 1146
#define EventWindowDidUpdate 1080
#define EventWindowDidUpdateAlpha 1081
#define EventWindowDidUpdateCollectionBehavior 1082
#define EventWindowDidUpdateCollectionProperties 1083
#define EventWindowDidUpdateShadow 1084
#define EventWindowDidUpdateTitle 1085
#define EventWindowDidUpdateToolbar 1086
#define EventWindowDidUpdateVisibility 1087
#define EventWindowShouldClose 1088
#define EventWindowWillBecomeKey 1089
#define EventWindowWillBecomeMain 1090
#define EventWindowWillBeginSheet 1091
#define EventWindowWillChangeOrderingMode 1092
#define EventWindowWillClose 1093
#define EventWindowWillDeminiaturize 1094
#define EventWindowWillEnterFullScreen 1095
#define EventWindowWillEnterVersionBrowser 1096
#define EventWindowWillExitFullScreen 1097
#define EventWindowWillExitVersionBrowser 1098
#define EventWindowWillFocus 1099
#define EventWindowWillMiniaturize 1100
#define EventWindowWillMove 1101
#define EventWindowWillOrderOffScreen 1102
#define EventWindowWillOrderOnScreen 1103
#define EventWindowWillResignMain 1104
#define EventWindowWillResize 1105
#define EventWindowWillUnfocus 1106
#define EventWindowWillUpdate 1107
#define EventWindowWillUpdateAlpha 1108
#define EventWindowWillUpdateCollectionBehavior 1109
#define EventWindowWillUpdateCollectionProperties 1110
#define EventWindowWillUpdateShadow 1111
#define EventWindowWillUpdateTitle 1112
#define EventWindowWillUpdateToolbar 1113
#define EventWindowWillUpdateVisibility 1114
#define EventWindowWillUseStandardFrame 1115
#define EventMenuWillOpen 1116
#define EventMenuDidOpen 1117
#define EventMenuDidClose 1118
#define EventMenuWillSendAction 1119
#define EventMenuDidSendAction 1120
#define EventMenuWillHighlightItem 1121
#define EventMenuDidHighlightItem 1122
#define EventMenuWillDisplayItem 1123
#define EventMenuDidDisplayItem 1124
#define EventMenuWillAddItem 1125
#define EventMenuDidAddItem 1126
#define EventMenuWillRemoveItem 1127
#define EventMenuDidRemoveItem 1128
#define EventMenuWillBeginTracking 1129
#define EventMenuDidBeginTracking 1130
#define EventMenuWillEndTracking 1131
#define EventMenuDidEndTracking 1132
#define EventMenuWillUpdate 1133
#define EventMenuDidUpdate 1134
#define EventMenuWillPopUp 1135
#define EventMenuDidPopUp 1136
#define EventMenuWillSendActionToItem 1137
#define EventMenuDidSendActionToItem 1138
#define EventWebViewDidStartProvisionalNavigation 1139
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1140
#define EventWebViewDidFinishNavigation 1141
#define EventWebViewDidCommitNavigation 1142
#define EventWindowFileDraggingEntered 1143
#define EventWindowFileDraggingPerformed 1144
#define EventWindowFileDraggingExited 1145
#define MAX_EVENTS 1147
#define MAX_EVENTS 1146
#endif

View File

@ -8,7 +8,7 @@ mac:ApplicationDidChangeStatusBarFrame
mac:ApplicationDidChangeStatusBarOrientation
mac:ApplicationDidFinishLaunching
mac:ApplicationDidHide
mac:ApplicationDidResignActive
mac:ApplicationDidResignActiveNotification
mac:ApplicationDidUnhide
mac:ApplicationDidUpdate
mac:ApplicationWillBecomeActive
@ -54,7 +54,6 @@ mac:WindowDidOrderOnScreen
mac:WindowDidResignKey
mac:WindowDidResignMain
mac:WindowDidResize
mac:WindowDidUnfocus
mac:WindowDidUpdate
mac:WindowDidUpdateAlpha
mac:WindowDidUpdateCollectionBehavior
@ -142,7 +141,7 @@ common:WindowZoomIn
common:WindowZoomOut
common:WindowZoomReset
common:WindowFocus
common:WindowUnFocus
common:WindowLostFocus
common:WindowShow
common:WindowHide
common:WindowDPIChanged