1
0
forked from Yadciel/c_tray

Correcting warnings in the public API, correcting errors on Windows

This commit is contained in:
Dmitry Mikushin
2022-02-19 17:53:45 +01:00
parent 7aaa634c93
commit 801d928305
4 changed files with 20 additions and 5 deletions

15
tray.h
View File

@@ -1,6 +1,11 @@
#ifndef TRAY_H #ifndef TRAY_H
#define TRAY_H #define TRAY_H
#ifdef __cplusplus
extern "C"
{
#endif
struct tray_menu; struct tray_menu;
struct tray { struct tray {
@@ -21,6 +26,16 @@ struct tray_menu {
struct tray_menu *submenu; struct tray_menu *submenu;
}; };
int tray_init(struct tray *tray);
int tray_loop(int blocking);
void tray_update(struct tray *tray); void tray_update(struct tray *tray);
void tray_exit(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* TRAY_H */ #endif /* TRAY_H */

View File

@@ -73,7 +73,7 @@ void tray_update(struct tray *tray) {
[statusItem setMenu:_tray_menu(tray->menu)]; [statusItem setMenu:_tray_menu(tray->menu)];
} }
void tray_exit() { void tray_exit(void) {
[app terminate:app]; [app terminate:app];
} }

View File

@@ -64,5 +64,5 @@ void tray_update(struct tray *tray) {
app_indicator_set_menu(indicator, GTK_MENU(_tray_menu(tray->menu))); app_indicator_set_menu(indicator, GTK_MENU(_tray_menu(tray->menu)));
} }
void tray_exit() { loop_result = -1; } void tray_exit(void) { loop_result = -1; }

View File

@@ -109,7 +109,7 @@ static int tray_init(struct tray *tray) {
return 0; return 0;
} }
static int tray_loop(int blocking) { int tray_loop(int blocking) {
MSG msg; MSG msg;
if (blocking) { if (blocking) {
GetMessage(&msg, hwnd, 0, 0); GetMessage(&msg, hwnd, 0, 0);
@@ -124,7 +124,7 @@ static int tray_loop(int blocking) {
return 0; return 0;
} }
static void tray_update(struct tray *tray) { void tray_update(struct tray *tray) {
HMENU prevmenu = hmenu; HMENU prevmenu = hmenu;
UINT id = ID_TRAY_FIRST; UINT id = ID_TRAY_FIRST;
hmenu = _tray_menu(tray->menu, &id); 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); Shell_NotifyIcon(NIM_DELETE, &nid);
if (nid.hIcon != 0) { if (nid.hIcon != 0) {
DestroyIcon(nid.hIcon); DestroyIcon(nid.hIcon);