Updated darwin implementation to meet new API

This commit is contained in:
Ox Cart
2019-09-19 13:11:49 -05:00
parent a7d9f30ed6
commit da30611855
4 changed files with 10 additions and 17 deletions
+1 -1
View File
@@ -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);
+1 -8
View File
@@ -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) {
+6 -1
View File
@@ -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;
}
+2 -7
View File
@@ -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) {