Revert "Add SDL_IsTraySupported"
This reverts commit 47d8bdd1c3.
There are runtime reasons why creating a tray can fail, so the correct approach is not to assume that just because a platform supports a tray that trays are available. Instead, you should create a tray at application startup, for the lifetime of the application, and handle failures at that point.
Closes https://github.com/libsdl-org/SDL/pull/13632
This commit is contained in:
@@ -82,16 +82,6 @@ void SDL_UpdateTrays(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool SDL_IsTraySupported(void)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
|
||||
@@ -29,11 +29,6 @@ void SDL_UpdateTrays(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool SDL_IsTraySupported(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
SDL_Unsupported();
|
||||
|
||||
@@ -240,24 +240,6 @@ void SDL_UpdateTrays(void)
|
||||
SDL_UpdateGtk();
|
||||
}
|
||||
|
||||
bool SDL_IsTraySupported(void)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool has_trays = false;
|
||||
static bool has_been_detected_once = false;
|
||||
|
||||
if (!has_been_detected_once) {
|
||||
has_trays = init_appindicator() && SDL_Gtk_Init();
|
||||
has_been_detected_once = true;
|
||||
}
|
||||
|
||||
return has_trays;
|
||||
}
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
|
||||
@@ -216,16 +216,6 @@ void SDL_UpdateTrays(void)
|
||||
{
|
||||
}
|
||||
|
||||
bool SDL_IsTraySupported(void)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
SDL_SetError("This function should be called on the main thread");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
||||
{
|
||||
if (!SDL_IsMainThread()) {
|
||||
|
||||
Reference in New Issue
Block a user