Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds support for system tray (or equivalent) on Windows, macOS and Unix using AppIndicator.
Currently supported:
Notes
The Unix implementation uses AppIndicator, which in turn uses GTK. I've done my best to keep SDL and the other libraries at arm length; nothing is required at compilation, and runtime will dynamically check for the libraries with
dlopen
and fail gracefully if they're not found.Due to the lack of headers, I had to copy over some function declarations and macros into SDL (only the bare minimum). I added the macro
APPINDICATOR_HEADER
that should expand to<path/to/appindicator.h>
if it is set. I currently did not implement looking for the header and setting the macro, so the macro is always unset for now.On macOS,
SDL_INIT_VIDEO
is needed.On all platforms, there is an "inner thread" that runs the tray that feels like it should be part of the main thread. It currently does not need to change anything outside
src/tray
, but it would be good to review the best practices there, and update anything that needs updates.TODO & FIXME
APPINDICATOR_HEADER
feature is retained, adapt the code so that the function names don't clash withdlsym
Use a better(Not possible/worth it)mktemp
-like mechanism with AppIndicator (SDL_CreateTempFolder?)tests/testtray.c
Existing Issue(s)
Closes #7822