When the last window is closed and the SDL_WINDOWEVENT_CLOSE event is sent, send the SDL_QUIT event.

Common.c now destroys the SDL_Window upon a SDL_WINDOWEVENT_CLOSE event to ensure that all windows get closed properly and the new code to handle the last window closes gets executed.
This commit is contained in:
krogoway 2011-01-27 15:58:30 -06:00
parent be54c8a0d5
commit e253e1d991
2 changed files with 14 additions and 1 deletions

View file

@ -1038,7 +1038,12 @@ CommonEvent(CommonState * state, SDL_Event * event, int *done)
case SDL_WINDOWEVENT:
switch (event->window.event) {
case SDL_WINDOWEVENT_CLOSE:
*done = 1;
{
SDL_Window *pWindow = SDL_GetWindowFromID(event->window.windowID);
if ( pWindow ) {
SDL_DestroyWindow( pWindow );
}
}
break;
}
break;