more SDL fullscreen state tracking fixes, don't update fullscreen flags on failure to change fullscreen state
authorSam Lantinga <slouken@libsdl.org>
Mon, 09 Nov 2015 08:54:56 -0800
changeset 9905fcf85090f816
parent 9904 e9b49510e51b
child 9906 49c432b1897b
more SDL fullscreen state tracking fixes, don't update fullscreen flags on failure to change fullscreen state
src/video/SDL_video.c
src/video/cocoa/SDL_cocoawindow.m
     1.1 --- a/src/video/SDL_video.c	Mon Nov 09 08:54:49 2015 -0800
     1.2 +++ b/src/video/SDL_video.c	Mon Nov 09 08:54:56 2015 -0800
     1.3 @@ -1980,6 +1980,7 @@
     1.4  int
     1.5  SDL_SetWindowFullscreen(SDL_Window * window, Uint32 flags)
     1.6  {
     1.7 +    Uint32 oldflags;
     1.8      CHECK_WINDOW_MAGIC(window, -1);
     1.9  
    1.10      flags &= FULLSCREEN_MASK;
    1.11 @@ -1989,10 +1990,17 @@
    1.12      }
    1.13  
    1.14      /* clear the previous flags and OR in the new ones */
    1.15 +    oldflags = window->flags & FULLSCREEN_MASK;
    1.16      window->flags &= ~FULLSCREEN_MASK;
    1.17      window->flags |= flags;
    1.18  
    1.19 -    return SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window));
    1.20 +    if (SDL_UpdateFullscreenMode(window, FULLSCREEN_VISIBLE(window)) == 0) {
    1.21 +        return 0;
    1.22 +    }
    1.23 +    
    1.24 +    window->flags &= ~FULLSCREEN_MASK;
    1.25 +    window->flags |= oldflags;
    1.26 +    return -1;
    1.27  }
    1.28  
    1.29  static SDL_Surface *
     2.1 --- a/src/video/cocoa/SDL_cocoawindow.m	Mon Nov 09 08:54:49 2015 -0800
     2.2 +++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Nov 09 08:54:56 2015 -0800
     2.3 @@ -646,6 +646,8 @@
     2.4  
     2.5      isFullscreenSpace = NO;
     2.6      inFullscreenTransition = NO;
     2.7 +    
     2.8 +    [self windowDidExitFullScreen:nil];
     2.9  }
    2.10  
    2.11  - (void)windowDidEnterFullScreen:(NSNotification *)aNotification
    2.12 @@ -690,6 +692,8 @@
    2.13      
    2.14      isFullscreenSpace = YES;
    2.15      inFullscreenTransition = NO;
    2.16 +    
    2.17 +    [self windowDidEnterFullScreen:nil];
    2.18  }
    2.19  
    2.20  - (void)windowDidExitFullScreen:(NSNotification *)aNotification