Sets a callback to be invoked when the menu is opened or closed.
Defined in <SDL3/SDL_tray.h>
bool SDL_SetTrayMenuOpenCallback(SDL_TrayMenu *menu, SDL_TrayMenuOpenCallback callback, void *userdata);| SDL_TrayMenu * | menu | the menu to be updated. |
| SDL_TrayMenuOpenCallback | callback | a callback to be invoked when the menu is opened or closed. |
| void * | userdata | an optional pointer to pass extra data to the callback when it will be invoked. |
(bool) Returns true on success or false on failure; call SDL_GetError() for more information.
The callback is invoked before the menu is displayed, so it can be used to update the menu contents, and again after the menu has closed. This works for both tray menus and submenus.
This is not supported on Linux, where the desktop environment doesn't reliably report when a menu is opened and closed.
This function should be called on the thread that created the tray.
This function is available since SDL 3.6.0.