src/video/SDL_video.c
changeset 5305 75f5ff92ad08
parent 5297 1800dc39b74c
child 5306 cf3cd833dcd3
     1.1 --- a/src/video/SDL_video.c	Tue Feb 15 22:51:29 2011 -0800
     1.2 +++ b/src/video/SDL_video.c	Tue Feb 15 23:07:14 2011 -0800
     1.3 @@ -1001,32 +1001,11 @@
     1.4  }
     1.5  
     1.6  static void
     1.7 -SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool attempt)
     1.8 +SDL_UpdateFullscreenMode(SDL_Window * window)
     1.9  {
    1.10      SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
    1.11      SDL_Window *other;
    1.12  
    1.13 -    /* See if anything changed */
    1.14 -    if ((display->fullscreen_window == window) == attempt) {
    1.15 -        return;
    1.16 -    }
    1.17 -
    1.18 -    /* See if we even want to do anything here */
    1.19 -    if ((window->flags & SDL_WINDOW_FULLSCREEN) &&
    1.20 -        (window->flags & SDL_WINDOW_SHOWN)) {
    1.21 -        if (attempt) {
    1.22 -            /* We just gained some state, try to gain all states */
    1.23 -            if (window->flags & SDL_WINDOW_MINIMIZED) {
    1.24 -                SDL_RestoreWindow(window);
    1.25 -            } else {
    1.26 -                SDL_RaiseWindow(window);
    1.27 -            }
    1.28 -        } else {
    1.29 -            /* We just lost some state, try to release all states */
    1.30 -            SDL_MinimizeWindow(window);
    1.31 -        }
    1.32 -    }
    1.33 -
    1.34      if (FULLSCREEN_VISIBLE(window)) {
    1.35          /* Hide any other fullscreen windows */
    1.36          if (display->fullscreen_window &&
    1.37 @@ -1035,6 +1014,11 @@
    1.38          }
    1.39      }
    1.40  
    1.41 +    /* See if anything needs to be done now */
    1.42 +    if ((display->fullscreen_window == window) == FULLSCREEN_VISIBLE(window)) {
    1.43 +        return;
    1.44 +    }
    1.45 +
    1.46      /* See if there are any fullscreen windows */
    1.47      for (other = _this->windows; other; other = other->next) {
    1.48          if (FULLSCREEN_VISIBLE(other) &&
    1.49 @@ -1048,7 +1032,7 @@
    1.50                  SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
    1.51  
    1.52                  if (_this->SetWindowFullscreen) {
    1.53 -                    _this->SetWindowFullscreen(_this, other);
    1.54 +                    _this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
    1.55                  }
    1.56                  display->fullscreen_window = other;
    1.57  
    1.58 @@ -1068,7 +1052,7 @@
    1.59      SDL_SetDisplayModeForDisplay(display, NULL);
    1.60  
    1.61      if (_this->SetWindowFullscreen) {
    1.62 -        _this->SetWindowFullscreen(_this, window);
    1.63 +        _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
    1.64      }
    1.65      display->fullscreen_window = NULL;
    1.66  }
    1.67 @@ -1188,7 +1172,7 @@
    1.68      }
    1.69  
    1.70      /* Restore video mode, etc. */
    1.71 -    SDL_UpdateFullscreenMode(window, SDL_FALSE);
    1.72 +    SDL_HideWindow(window);
    1.73  
    1.74      /* Tear down the old native window */
    1.75      if (window->surface) {
    1.76 @@ -1373,10 +1357,10 @@
    1.77  {
    1.78      CHECK_WINDOW_MAGIC(window, );
    1.79  
    1.80 -    if (x != SDL_WINDOWPOS_UNDEFINED) {
    1.81 +    if (!SDL_WINDOWPOS_ISUNDEFINED(x)) {
    1.82          window->x = x;
    1.83      }
    1.84 -    if (y != SDL_WINDOWPOS_UNDEFINED) {
    1.85 +    if (!SDL_WINDOWPOS_ISUNDEFINED(y)) {
    1.86          window->y = y;
    1.87      }
    1.88      if (!(window->flags & SDL_WINDOW_FULLSCREEN)) {
    1.89 @@ -1569,13 +1553,11 @@
    1.90      }
    1.91      if (fullscreen) {
    1.92          window->flags |= SDL_WINDOW_FULLSCREEN;
    1.93 -
    1.94 -        SDL_UpdateFullscreenMode(window, SDL_TRUE);
    1.95      } else {
    1.96          window->flags &= ~SDL_WINDOW_FULLSCREEN;
    1.97 +    }
    1.98 +    SDL_UpdateFullscreenMode(window);
    1.99  
   1.100 -        SDL_UpdateFullscreenMode(window, SDL_FALSE);
   1.101 -    }
   1.102      return 0;
   1.103  }
   1.104  
   1.105 @@ -1686,13 +1668,13 @@
   1.106  SDL_OnWindowShown(SDL_Window * window)
   1.107  {
   1.108      SDL_RaiseWindow(window);
   1.109 -    SDL_UpdateFullscreenMode(window, SDL_TRUE);
   1.110 +    SDL_UpdateFullscreenMode(window);
   1.111  }
   1.112  
   1.113  void
   1.114  SDL_OnWindowHidden(SDL_Window * window)
   1.115  {
   1.116 -    SDL_UpdateFullscreenMode(window, SDL_FALSE);
   1.117 +    SDL_UpdateFullscreenMode(window);
   1.118  }
   1.119  
   1.120  void
   1.121 @@ -1705,14 +1687,14 @@
   1.122  void
   1.123  SDL_OnWindowMinimized(SDL_Window * window)
   1.124  {
   1.125 -    SDL_UpdateFullscreenMode(window, SDL_FALSE);
   1.126 +    SDL_UpdateFullscreenMode(window);
   1.127  }
   1.128  
   1.129  void
   1.130  SDL_OnWindowRestored(SDL_Window * window)
   1.131  {
   1.132      SDL_RaiseWindow(window);
   1.133 -    SDL_UpdateFullscreenMode(window, SDL_TRUE);
   1.134 +    SDL_UpdateFullscreenMode(window);
   1.135  }
   1.136  
   1.137  void
   1.138 @@ -1763,7 +1745,7 @@
   1.139      CHECK_WINDOW_MAGIC(window, );
   1.140  
   1.141      /* Restore video mode, etc. */
   1.142 -    SDL_UpdateFullscreenMode(window, SDL_FALSE);
   1.143 +    SDL_HideWindow(window);
   1.144  
   1.145      if (window->surface) {
   1.146          window->surface->flags &= ~SDL_DONTFREE;