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) |
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) |