Browse Source

tray: renamed SDL_HasNoActiveTrays() to SDL_HasActiveTrays()

Sam Lantinga 3 months ago
parent
commit
d4cda51057

+ 1 - 1
src/events/SDL_windowevents.c

@@ -247,7 +247,7 @@ bool SDL_SendWindowEvent(SDL_Window *window, SDL_EventType windowevent, int data
         break;
     }
 
-    if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED && !window->parent && SDL_HasNoActiveTrays()) {
+    if (windowevent == SDL_EVENT_WINDOW_CLOSE_REQUESTED && !window->parent && !SDL_HasActiveTrays()) {
         int toplevel_count = 0;
         SDL_Window *n;
         for (n = SDL_GetVideoDevice()->windows; n; n = n->next) {

+ 2 - 2
src/tray/SDL_tray_utils.c

@@ -85,7 +85,7 @@ void SDL_CleanupTrays(void)
     SDL_free(trays);
 }
 
-bool SDL_HasNoActiveTrays(void)
+bool SDL_HasActiveTrays(void)
 {
-    return active_trays == 0;
+    return (active_trays > 0);
 }

+ 1 - 1
src/tray/SDL_tray_utils.h

@@ -23,4 +23,4 @@
 extern void SDL_RegisterTray(SDL_Tray *tray);
 extern void SDL_UnregisterTray(SDL_Tray *tray);
 extern void SDL_CleanupTrays(void);
-extern bool SDL_HasNoActiveTrays(void);
+extern bool SDL_HasActiveTrays(void);

+ 1 - 1
src/tray/unix/SDL_tray.c

@@ -790,7 +790,7 @@ void SDL_DestroyTray(SDL_Tray *tray)
 
     SDL_free(tray);
 
-    if (SDL_HasNoActiveTrays()) {
+    if (!SDL_HasActiveTrays()) {
         gtk_main_quit();
         gtk_thread_active = false;
     }