ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/SDL/video_sdl.cpp
(Generate patch)

Comparing BasiliskII/src/SDL/video_sdl.cpp (file contents):
Revision 1.29 by gbeauche, 2006-05-14T14:11:46Z vs.
Revision 1.30 by asvitkine, 2007-01-21T19:33:13Z

# Line 719 | Line 719 | void driver_base::restore_mouse_accel(vo
719   *  Windowed display driver
720   */
721  
722 + static int SDL_display_opened = FALSE;
723 +
724   // Open display
725   driver_window::driver_window(SDL_monitor_desc &m)
726          : driver_base(m), mouse_grabbed(false)
# Line 730 | Line 732 | driver_window::driver_window(SDL_monitor
732          // Set absolute mouse mode
733          ADBSetRelMouseMode(mouse_grabbed);
734  
735 +        // This is ugly:
736 +        // If we're switching resolutions (ie, not setting it for the first time),
737 +        // there's a bug in SDL where the SDL_Surface created will not be properly
738 +        // setup. The solution is to SDL_Quit() before calling SDL_SetVideoMode for
739 +        // the second time (SDL_SetVideoMode will call SDL_Init() and all will be
740 +        // well). Without this, the video becomes corrupted (at least on Mac OS X),
741 +        // after the resolution switch (for the second and subsequent times).
742 +        if (SDL_display_opened)
743 +                SDL_Quit();
744 +
745          // Create surface
746          int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
747          if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE)) == NULL)
748                  return;
749  
750 +        SDL_display_opened = TRUE;
751 +
752   #ifdef ENABLE_VOSF
753          use_vosf = true;
754          // Allocate memory for frame buffer (SIZE is extended to page-boundary)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines