Mercurial > sdl-ios-xcode
diff src/video/quartz/SDL_QuartzVideo.m @ 435:140798e1e7a6
Darrell's fix for Quartz mouse motion
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 12 Aug 2002 22:43:58 +0000 |
parents | 19e73568a75c |
children | 8a43e0cbf02f |
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzVideo.m Mon Aug 12 14:54:38 2002 +0000 +++ b/src/video/quartz/SDL_QuartzVideo.m Mon Aug 12 22:43:58 2002 +0000 @@ -345,7 +345,8 @@ SDL_QuartzGammaTable gamma_table; int gamma_error; - + NSRect screen_rect; + gamma_error = QZ_FadeGammaOut (this, &gamma_table); /* Release the OpenGL context */ @@ -361,6 +362,13 @@ CGDisplayRelease (display_id); ShowMenuBar (); + /* + reset the main screen's rectangle, see comment + in QZ_SetVideoFullscreen + */ + screen_rect = NSMakeRect(0,0,device_width,device_height); + [ [ NSScreen mainScreen ] setFrame:screen_rect ]; + if (! gamma_error) QZ_FadeGammaIn (this, &gamma_table); } @@ -401,7 +409,8 @@ int exact_match; int gamma_error; SDL_QuartzGammaTable gamma_table; - + NSRect screen_rect; + /* See if requested mode exists */ mode = CGDisplayBestModeForParameters (display_id, bpp, width, height, &exact_match); @@ -484,6 +493,16 @@ if (! gamma_error ) QZ_FadeGammaIn (this, &gamma_table); + /* + There is a bug in Cocoa where NSScreen doesn't synchronize + with CGDirectDisplay, so the main screen's frame is wrong. + As a result, coordinate translation produces wrong results. + We can hack around this bug by setting the screen rect + ourselves. This hack should be removed if/when the bug is fixed. + */ + screen_rect = NSMakeRect(0,0,width,height); + [ [ NSScreen mainScreen ] setFrame:screen_rect ]; + /* Save the flags to ensure correct tear-down */ mode_flags = current->flags;