Fixed resetting the Direc3D renderer on mode change
authorSam Lantinga <slouken@libsdl.org>
Wed, 16 Feb 2011 00:11:48 -0800
changeset 5306cf3cd833dcd3
parent 5305 75f5ff92ad08
child 5307 89a8263374ac
Fixed resetting the Direc3D renderer on mode change
src/video/SDL_sysvideo.h
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_sysvideo.h	Tue Feb 15 23:07:14 2011 -0800
     1.2 +++ b/src/video/SDL_sysvideo.h	Wed Feb 16 00:11:48 2011 -0800
     1.3 @@ -180,7 +180,6 @@
     1.4      void (*MaximizeWindow) (_THIS, SDL_Window * window);
     1.5      void (*MinimizeWindow) (_THIS, SDL_Window * window);
     1.6      void (*RestoreWindow) (_THIS, SDL_Window * window);
     1.7 -    void (*PrepWindowFullscreen) (_THIS, SDL_Window * window);
     1.8      void (*SetWindowFullscreen) (_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen);
     1.9      void (*SetWindowGrab) (_THIS, SDL_Window * window);
    1.10      void (*DestroyWindow) (_THIS, SDL_Window * window);
     2.1 --- a/src/video/SDL_video.c	Tue Feb 15 23:07:14 2011 -0800
     2.2 +++ b/src/video/SDL_video.c	Wed Feb 16 00:11:48 2011 -0800
     2.3 @@ -1025,36 +1025,40 @@
     2.4              SDL_GetDisplayForWindow(other) == display) {
     2.5              SDL_DisplayMode fullscreen_mode;
     2.6              if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) {
     2.7 -                if (_this->PrepWindowFullscreen) {
     2.8 -                    _this->PrepWindowFullscreen(_this, other);
     2.9 +                SDL_bool resized = SDL_TRUE;
    2.10 +
    2.11 +                if (other->w == fullscreen_mode.w && other->h == fullscreen_mode.h) {
    2.12 +                    resized = SDL_FALSE;
    2.13                  }
    2.14  
    2.15                  SDL_SetDisplayModeForDisplay(display, &fullscreen_mode);
    2.16 -
    2.17                  if (_this->SetWindowFullscreen) {
    2.18                      _this->SetWindowFullscreen(_this, other, display, SDL_TRUE);
    2.19                  }
    2.20                  display->fullscreen_window = other;
    2.21  
    2.22 -                /* Generate a mode change events here */
    2.23 -                SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED,
    2.24 -                                    fullscreen_mode.w, fullscreen_mode.h);
    2.25 +                /* Generate a mode change event here */
    2.26 +                if (resized) {
    2.27 +                    SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED,
    2.28 +                                        fullscreen_mode.w, fullscreen_mode.h);
    2.29 +                } else {
    2.30 +                    SDL_OnWindowResized(other);
    2.31 +                }
    2.32                  return;
    2.33              }
    2.34          }
    2.35      }
    2.36  
    2.37      /* Nope, restore the desktop mode */
    2.38 -    if (_this->PrepWindowFullscreen) {
    2.39 -        _this->PrepWindowFullscreen(_this, window);
    2.40 -    }
    2.41 -
    2.42      SDL_SetDisplayModeForDisplay(display, NULL);
    2.43  
    2.44      if (_this->SetWindowFullscreen) {
    2.45          _this->SetWindowFullscreen(_this, window, display, SDL_FALSE);
    2.46      }
    2.47      display->fullscreen_window = NULL;
    2.48 +
    2.49 +    /* Generate a mode change event here */
    2.50 +    SDL_OnWindowResized(window);
    2.51  }
    2.52  
    2.53  SDL_Window *