diff --git a/tray.h b/tray.h index 064780d..26d1426 100644 --- a/tray.h +++ b/tray.h @@ -1,6 +1,11 @@ #ifndef TRAY_H #define TRAY_H +#ifdef __cplusplus +extern "C" +{ +#endif + struct tray_menu; struct tray { @@ -21,6 +26,16 @@ struct tray_menu { struct tray_menu *submenu; }; +int tray_init(struct tray *tray); + +int tray_loop(int blocking); + void tray_update(struct tray *tray); +void tray_exit(void); + +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* TRAY_H */ diff --git a/tray_darwin.m b/tray_darwin.m index 97d6d7e..21e9a6d 100644 --- a/tray_darwin.m +++ b/tray_darwin.m @@ -73,7 +73,7 @@ void tray_update(struct tray *tray) { [statusItem setMenu:_tray_menu(tray->menu)]; } -void tray_exit() { +void tray_exit(void) { [app terminate:app]; } diff --git a/tray_linux.c b/tray_linux.c index 0f3b59a..4f6b029 100644 --- a/tray_linux.c +++ b/tray_linux.c @@ -64,5 +64,5 @@ void tray_update(struct tray *tray) { app_indicator_set_menu(indicator, GTK_MENU(_tray_menu(tray->menu))); } -void tray_exit() { loop_result = -1; } +void tray_exit(void) { loop_result = -1; } diff --git a/tray_windows.c b/tray_windows.c index 0e17053..febf17f 100644 --- a/tray_windows.c +++ b/tray_windows.c @@ -109,7 +109,7 @@ static int tray_init(struct tray *tray) { return 0; } -static int tray_loop(int blocking) { +int tray_loop(int blocking) { MSG msg; if (blocking) { GetMessage(&msg, hwnd, 0, 0); @@ -124,7 +124,7 @@ static int tray_loop(int blocking) { return 0; } -static void tray_update(struct tray *tray) { +void tray_update(struct tray *tray) { HMENU prevmenu = hmenu; UINT id = ID_TRAY_FIRST; hmenu = _tray_menu(tray->menu, &id); @@ -146,7 +146,7 @@ static void tray_update(struct tray *tray) { } } -static void tray_exit() { +void tray_exit(void) { Shell_NotifyIcon(NIM_DELETE, &nid); if (nid.hIcon != 0) { DestroyIcon(nid.hIcon);