diff --git a/systray.h b/systray.h index cecdc40..128315f 100644 --- a/systray.h +++ b/systray.h @@ -1,7 +1,7 @@ extern void systray_ready(); extern void systray_on_exit(); extern void systray_menu_item_selected(int menu_id); -int nativeLoop(void); +int nativeLoop(char* title, int width, int height); void setIcon(const char* iconBytes, int length); void setMenuItemIcon(const char* iconBytes, int length, int menuId); diff --git a/systray_browser_darwin.m b/systray_browser_darwin.m index c20c7f6..42f04cd 100644 --- a/systray_browser_darwin.m +++ b/systray_browser_darwin.m @@ -5,7 +5,7 @@ NSWindowController *windowController = nil; WKWebView *webView = nil; -void doConfigureAppWindow(char* title, int width, int height) +void configureAppWindow(char* title, int width, int height) { if (windowController != nil) { // already configured, ignore @@ -49,13 +49,6 @@ void doConfigureAppWindow(char* title, int width, int height) free(title); } -void configureAppWindow(char* title, int width, int height) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - doConfigureAppWindow(title, width, height); - }); -} - void doShowAppWindow(char* url) { if (windowController == nil) { diff --git a/systray_darwin.m b/systray_darwin.m index 7189ef5..fff2465 100644 --- a/systray_darwin.m +++ b/systray_darwin.m @@ -187,9 +187,14 @@ @end -int nativeLoop(void) { +void configureAppWindow(char* title, int width, int height); + +int nativeLoop(char* title, int width, int height) { AppDelegate *delegate = [[AppDelegate alloc] init]; [[NSApplication sharedApplication] setDelegate:delegate]; + if (strcmp(title, "") != 0) { + configureAppWindow(title, width, height); + } [NSApp run]; return EXIT_SUCCESS; } diff --git a/systray_nonwindows.go b/systray_nonwindows.go index fdacfa2..598df9e 100644 --- a/systray_nonwindows.go +++ b/systray_nonwindows.go @@ -16,19 +16,14 @@ import ( "unsafe" ) -func nativeLoop() { - C.nativeLoop() +func nativeLoop(title string, width int, height int) { + C.nativeLoop(C.CString(title), C.int(width), C.int(height)) } func quit() { C.quit() } -// EnableAppWindow enables a single application window for this app. -func EnableAppWindow(title string, width int, height int) { - C.configureAppWindow(C.CString(title), C.int(width), C.int(height)) -} - // ShowAppWindow shows the given URL in the application window. Only works if // configureAppWindow has been called first. func ShowAppWindow(url string) {