[SDL3] does not issue SDL_EVENT_QUIT when last window is destroyed via pushing SDL_EVENT_WINDOW_CLOSE_REQUESTED
If the last window is closed and destroyed via the application programmatically pushing an event with SDL_EVENT_WINDOW_CLOSE_REQUESTED type (not by clicking the lcose button or hitting Alt+f4 on windows for example) then SDL does not issue a SDL_EVENT_QUIT.
This behavior is not consistent and make the SDL user write code to track all open windows and manually issue the SDL_EVENT_QUIT to keep the logic common to when the window is manually closed.
Suggestion is to issue SDL_EVENT_QUIT when the last window is closed/destroyed by any means not just when it is interactively closed.
Counterpoint: If the application closes all of its windows by itself, nobody (neither system nor user) actually requested the application to quit. It's valid for an application to run without open windows, although I agree that the current behavior of sending quit on the user closing the last window makes this behavior seem unintuitive.
Whatever the resolution, I would request that the application still be able to distinguish between an external quit and the event of "you closed your last window by choice". This could maybe be a flag / enum within the event detailing the source, or be split into separate event types.
Example scenario: The application is started via the terminal, opens some windows and closes them again.
Issuing a Ctrl+C interrupt in the terminal correctly generates a quit event today.
Without the ability to distinguish the event source, the application would lose the SDL-provided ability to keep running after closing all current windows, while also listening for the interrupt.
Your scenario is interesting but SDL does not force the terminal part of the app to quit. Is simply issues a SDL_EVENT_QUIT signaling that gui part is fine and no more windows are managed by SDL. The application can now handle the rest of its life independently from SDL.
Notice that if the user plays whack-a-mole with the open windows and closes them by clicking X we get the quit event even with the CLI app wanting to continue run.
My point was consistency inside SDL for a uniform and simple logic. App can still deal with the situation even if SDL does not send the quit event. But why do you send it if X is clicked??? We can still find out window close requested , and track windows ? Why do we only have to track windows if there is a ‘Submit’ button in the window ( as an example)...
SDL 2.0 is now in maintenance mode, and all inactive issues are being closed. If this issue is impacting you, please feel free to reopen it with additional information.