gabdube / native-windows-gui

A light windows GUI toolkit for rust
https://gabdube.github.io/native-windows-gui/
MIT License
1.93k stars 125 forks source link

support multiple tray icons per parent #262

Open RavuAlHemio opened 1 year ago

RavuAlHemio commented 1 year ago

Just like a parent (HWND) can have multiple timers, it can have multiple notification area icons (TrayNotifications) differentiated by an ID. Use similar functionality as with timers to extend support to multiple icons per parent.

The Shell_NotifyIconW(NIM_SETVERSION, &mut data); call is necessary to ensure that the icon ID is passed in the expected format to process_events(...), as the version field is ignored otherwise (well, interpreted as the timeout value). This has been previously pointed out by @iquanxin in issue #246.