Add support for a tooltip (Windows only currently)

This commit is contained in:
Andreas Opferkuch
2018-08-02 16:47:29 +02:00
committed by Dmitry Mikushin
parent 95b83171b7
commit 5cc49f2f32
2 changed files with 11 additions and 6 deletions

4
tray.h
View File

@@ -5,6 +5,7 @@ struct tray_menu;
struct tray {
const char *icon;
char *tooltip;
struct tray_menu *menu;
};
@@ -308,8 +309,9 @@ static int tray_init(struct tray *tray) {
nid.cbSize = sizeof(NOTIFYICONDATA);
nid.hWnd = hwnd;
nid.uID = 0;
nid.uFlags = NIF_ICON | NIF_MESSAGE;
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
nid.uCallbackMessage = WM_TRAY_CALLBACK_MESSAGE;
strncpy(nid.szTip, tray->tooltip, sizeof(nid.szTip));
Shell_NotifyIcon(NIM_ADD, &nid);
tray_update(tray);