diff --git a/platform/darwin/tray.m b/platform/darwin/tray.m index c4112df..1c141d5 100644 --- a/platform/darwin/tray.m +++ b/platform/darwin/tray.m @@ -82,6 +82,9 @@ void native_loop() { [NSApp run]; } +void external_main_loop() { +} + void exit_loop() { // Clear all notifications. [[NSUserNotificationCenter defaultUserNotificationCenter] removeAllDeliveredNotifications]; diff --git a/platform/linux/tray.c b/platform/linux/tray.c index eb78849..dba5096 100644 --- a/platform/linux/tray.c +++ b/platform/linux/tray.c @@ -148,7 +148,7 @@ void init(const char* title, struct image imageData) void native_loop() { - gtk_widget_show_all(menu); + external_main_loop(); gtk_main (); } @@ -157,5 +157,9 @@ void exit_loop() gtk_main_quit(); } +void external_main_loop() { + gtk_widget_show_all(menu); +} + #endif // NATIVE_C diff --git a/platform/windows/tray.c b/platform/windows/tray.c index 104728a..fb587ee 100644 --- a/platform/windows/tray.c +++ b/platform/windows/tray.c @@ -43,6 +43,10 @@ void clear_menu_items() } } +void external_main_loop () +{ +} + void native_loop() { MSG msg; diff --git a/trayhost.go b/trayhost.go index 3305f24..8defefb 100644 --- a/trayhost.go +++ b/trayhost.go @@ -66,6 +66,11 @@ func Exit() { C.exit_loop() } +// init widget for running in other gtk_main loop +func InitWidget() { + C.external_main_loop() +} + // SeparatorMenuItem creates a separator MenuItem. func SeparatorMenuItem() MenuItem { return MenuItem{Title: ""} }