Simple Directmedia Layer
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 64 lines 2.0 kB view raw
1/* 2 Simple DirectMedia Layer 3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org> 4 5 This software is provided 'as-is', without any express or implied 6 warranty. In no event will the authors be held liable for any damages 7 arising from the use of this software. 8 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it 11 freely, subject to the following restrictions: 12 13 1. The origin of this software must not be misrepresented; you must not 14 claim that you wrote the original software. If you use this software 15 in a product, an acknowledgment in the product documentation would be 16 appreciated but is not required. 17 2. Altered source versions must be plainly marked as such, and must not be 18 misrepresented as being the original software. 19 3. This notice may not be removed or altered from any source distribution. 20*/ 21#include "SDL_internal.h" 22 23#include "../video/SDL_sysvideo.h" 24#include "../events/SDL_events_c.h" 25#include "SDL_tray_utils.h" 26 27 28static int active_trays = 0; 29 30extern void SDL_IncrementTrayCount(void) 31{ 32 if (++active_trays < 1) { 33 SDL_Log("Active tray count corrupted (%d < 1), this is a bug. The app may close or fail to close unexpectedly.", active_trays); 34 } 35} 36 37extern void SDL_DecrementTrayCount(void) 38{ 39 int toplevel_count = 0; 40 SDL_Window *n; 41 42 if (--active_trays < 0) { 43 SDL_Log("Active tray count corrupted (%d < 0), this is a bug. The app may close or fail to close unexpectedly.", active_trays); 44 } 45 46 if (!SDL_GetHintBoolean(SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE, true)) { 47 return; 48 } 49 50 for (n = SDL_GetVideoDevice()->windows; n; n = n->next) { 51 if (!n->parent && !(n->flags & SDL_WINDOW_HIDDEN)) { 52 ++toplevel_count; 53 } 54 } 55 56 if (toplevel_count < 1) { 57 SDL_SendQuit(); 58 } 59} 60 61extern bool SDL_HasNoActiveTrays(void) 62{ 63 return active_trays < 1; 64}