Add SDL_IsTraySupported

This commit is contained in:
Semphris
2025-05-25 17:49:53 -04:00
committed by Ryan C. Gordon
parent 735f0cc300
commit 47d8bdd1c3
8 changed files with 65 additions and 0 deletions

View File

@@ -1254,6 +1254,7 @@ SDL3_0.0.0 {
SDL_SetAudioIterationCallbacks;
SDL_GetEventDescription;
SDL_PutAudioStreamDataNoCopy;
SDL_IsTraySupported;
# extra symbols go here (don't modify this line)
local: *;
};

View File

@@ -1279,3 +1279,4 @@
#define SDL_SetAudioIterationCallbacks SDL_SetAudioIterationCallbacks_REAL
#define SDL_GetEventDescription SDL_GetEventDescription_REAL
#define SDL_PutAudioStreamDataNoCopy SDL_PutAudioStreamDataNoCopy_REAL
#define SDL_IsTraySupported SDL_IsTraySupported_REAL

View File

@@ -1287,3 +1287,4 @@ SDL_DYNAPI_PROC(bool,SDL_PutAudioStreamPlanarData,(SDL_AudioStream *a,const void
SDL_DYNAPI_PROC(bool,SDL_SetAudioIterationCallbacks,(SDL_AudioDeviceID a,SDL_AudioIterationCallback b,SDL_AudioIterationCallback c,void *d),(a,b,c,d),return)
SDL_DYNAPI_PROC(int,SDL_GetEventDescription,(const SDL_Event *a,char *b,int c),(a,b,c),return)
SDL_DYNAPI_PROC(bool,SDL_PutAudioStreamDataNoCopy,(SDL_AudioStream *a,const void *b,int c,SDL_AudioStreamDataCompleteCallback d,void *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(bool,SDL_IsTraySupported,(void),(),return)

View File

@@ -82,6 +82,16 @@ 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()) {

View File

@@ -29,6 +29,11 @@ void SDL_UpdateTrays(void)
{
}
bool SDL_IsTraySupported(void)
{
return false;
}
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
{
SDL_Unsupported();

View File

@@ -413,6 +413,24 @@ void SDL_UpdateTrays(void)
}
}
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_gtk();
has_been_detected_once = true;
}
return has_trays;
}
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
{
if (!SDL_IsMainThread()) {

View File

@@ -216,6 +216,16 @@ 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()) {