Skip to content

Commit 9a71e3f

Browse files
committed
Revert "Add SDL_IsTraySupported"
This reverts commit 47d8bdd. 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 #13632
1 parent bba6555 commit 9a71e3f

File tree

8 files changed

+0
-65
lines changed

8 files changed

+0
-65
lines changed

include/SDL3/SDL_tray.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,25 +96,6 @@ typedef Uint32 SDL_TrayEntryFlags;
9696
*/
9797
typedef void (SDLCALL *SDL_TrayCallback)(void *userdata, SDL_TrayEntry *entry);
9898

99-
/**
100-
* Check whether or not tray icons can be created.
101-
*
102-
* Note that this function does not guarantee that SDL_CreateTray() will or
103-
* will not work; you should still check SDL_CreateTray() for errors.
104-
*
105-
* Using tray icons require the video subsystem.
106-
*
107-
* \returns true if trays are available, false otherwise.
108-
*
109-
* \threadsafety This function should only be called on the main thread. It
110-
* will return false if not called on the main thread.
111-
*
112-
* \since This function is available since SDL 3.4.0.
113-
*
114-
* \sa SDL_CreateTray
115-
*/
116-
extern SDL_DECLSPEC bool SDLCALL SDL_IsTraySupported(void);
117-
11899
/**
119100
* Create an icon to be placed in the operating system's tray, or equivalent.
120101
*

src/dynapi/SDL_dynapi.sym

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,6 @@ SDL3_0.0.0 {
12531253
SDL_PutAudioStreamPlanarData;
12541254
SDL_GetEventDescription;
12551255
SDL_PutAudioStreamDataNoCopy;
1256-
SDL_IsTraySupported;
12571256
# extra symbols go here (don't modify this line)
12581257
local: *;
12591258
};

src/dynapi/SDL_dynapi_overrides.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,4 +1278,3 @@
12781278
#define SDL_PutAudioStreamPlanarData SDL_PutAudioStreamPlanarData_REAL
12791279
#define SDL_GetEventDescription SDL_GetEventDescription_REAL
12801280
#define SDL_PutAudioStreamDataNoCopy SDL_PutAudioStreamDataNoCopy_REAL
1281-
#define SDL_IsTraySupported SDL_IsTraySupported_REAL

src/dynapi/SDL_dynapi_procs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,4 +1286,3 @@ SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateGPURenderer,(SDL_Window *a,SDL_GPUShader
12861286
SDL_DYNAPI_PROC(bool,SDL_PutAudioStreamPlanarData,(SDL_AudioStream *a,const void * const*b,int c,int d),(a,b,c,d),return)
12871287
SDL_DYNAPI_PROC(int,SDL_GetEventDescription,(const SDL_Event *a,char *b,int c),(a,b,c),return)
12881288
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)
1289-
SDL_DYNAPI_PROC(bool,SDL_IsTraySupported,(void),(),return)

src/tray/cocoa/SDL_tray.m

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ void SDL_UpdateTrays(void)
8282
{
8383
}
8484

85-
bool SDL_IsTraySupported(void)
86-
{
87-
if (!SDL_IsMainThread()) {
88-
SDL_SetError("This function should be called on the main thread");
89-
return false;
90-
}
91-
92-
return true;
93-
}
94-
9585
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
9686
{
9787
if (!SDL_IsMainThread()) {

src/tray/dummy/SDL_tray.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ void SDL_UpdateTrays(void)
2929
{
3030
}
3131

32-
bool SDL_IsTraySupported(void)
33-
{
34-
return false;
35-
}
36-
3732
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
3833
{
3934
SDL_Unsupported();

src/tray/unix/SDL_tray.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,6 @@ void SDL_UpdateTrays(void)
240240
SDL_UpdateGtk();
241241
}
242242

243-
bool SDL_IsTraySupported(void)
244-
{
245-
if (!SDL_IsMainThread()) {
246-
SDL_SetError("This function should be called on the main thread");
247-
return false;
248-
}
249-
250-
static bool has_trays = false;
251-
static bool has_been_detected_once = false;
252-
253-
if (!has_been_detected_once) {
254-
has_trays = init_appindicator() && SDL_Gtk_Init();
255-
has_been_detected_once = true;
256-
}
257-
258-
return has_trays;
259-
}
260-
261243
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
262244
{
263245
if (!SDL_IsMainThread()) {

src/tray/windows/SDL_tray.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,16 +216,6 @@ void SDL_UpdateTrays(void)
216216
{
217217
}
218218

219-
bool SDL_IsTraySupported(void)
220-
{
221-
if (!SDL_IsMainThread()) {
222-
SDL_SetError("This function should be called on the main thread");
223-
return false;
224-
}
225-
226-
return true;
227-
}
228-
229219
SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
230220
{
231221
if (!SDL_IsMainThread()) {

0 commit comments

Comments
 (0)