mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-12 16:30:44 +00:00
Fix for resolution switching corruption under SDL (Mac OS X).
This commit is contained in:
parent
a3c2413f3b
commit
473a3f2e22
@ -719,6 +719,8 @@ void driver_base::restore_mouse_accel(void)
|
||||
* Windowed display driver
|
||||
*/
|
||||
|
||||
static int SDL_display_opened = FALSE;
|
||||
|
||||
// Open display
|
||||
driver_window::driver_window(SDL_monitor_desc &m)
|
||||
: driver_base(m), mouse_grabbed(false)
|
||||
@ -730,11 +732,23 @@ driver_window::driver_window(SDL_monitor_desc &m)
|
||||
// Set absolute mouse mode
|
||||
ADBSetRelMouseMode(mouse_grabbed);
|
||||
|
||||
// This is ugly:
|
||||
// If we're switching resolutions (ie, not setting it for the first time),
|
||||
// there's a bug in SDL where the SDL_Surface created will not be properly
|
||||
// setup. The solution is to SDL_Quit() before calling SDL_SetVideoMode for
|
||||
// the second time (SDL_SetVideoMode will call SDL_Init() and all will be
|
||||
// well). Without this, the video becomes corrupted (at least on Mac OS X),
|
||||
// after the resolution switch (for the second and subsequent times).
|
||||
if (SDL_display_opened)
|
||||
SDL_Quit();
|
||||
|
||||
// Create surface
|
||||
int depth = sdl_depth_of_video_depth(VIDEO_MODE_DEPTH);
|
||||
if ((s = SDL_SetVideoMode(width, height, depth, SDL_HWSURFACE)) == NULL)
|
||||
return;
|
||||
|
||||
SDL_display_opened = TRUE;
|
||||
|
||||
#ifdef ENABLE_VOSF
|
||||
use_vosf = true;
|
||||
// Allocate memory for frame buffer (SIZE is extended to page-boundary)
|
||||
|
Loading…
x
Reference in New Issue
Block a user