diff --git a/src/video/quartz/SDL_QuartzVideo.h b/src/video/quartz/SDL_QuartzVideo.h index f6daf2b91..8d46c8990 100644 --- a/src/video/quartz/SDL_QuartzVideo.h +++ b/src/video/quartz/SDL_QuartzVideo.h @@ -107,6 +107,7 @@ typedef struct SDL_PrivateVideoData { SDL_sem *sem1, *sem2; /* synchronization for async screen updates */ Uint8 *current_buffer; /* the buffer being copied to the screen */ BOOL quit_thread; /* used to quit the async blitting thread */ + SInt32 system_version; /* used to dis-/enable workarounds depending on the system version */ ImageDescriptionHandle yuv_idh; MatrixRecordPtr yuv_matrix; @@ -152,6 +153,7 @@ typedef struct SDL_PrivateVideoData { #define sem2 (this->hidden->sem2) #define current_buffer (this->hidden->current_buffer) #define quit_thread (this->hidden->quit_thread) +#define system_version (this->hidden->system_version) /* grab states - the input is in one of these states */ enum { diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index db6574032..61952eded 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -205,6 +205,9 @@ static int QZ_VideoInit (_THIS, SDL_PixelFormat *video_format) { cursor_visible = YES; current_mods = 0; + if ( Gestalt(gestaltSystemVersion, &system_version) != noErr ) + system_version = 0; + /* register for sleep notifications so wake from sleep generates SDL_VIDEOEXPOSE */ QZ_RegisterForSleepNotifications (this); diff --git a/src/video/quartz/SDL_QuartzWM.m b/src/video/quartz/SDL_QuartzWM.m index 066c5f981..3dccd6f02 100644 --- a/src/video/quartz/SDL_QuartzWM.m +++ b/src/video/quartz/SDL_QuartzWM.m @@ -135,7 +135,7 @@ void QZ_PrivateSDLToCocoa (_THIS, NSPoint *p) { if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */ - p->y = CGDisplayPixelsHigh (display_id) - p->y - 1; + p->y = CGDisplayPixelsHigh (display_id) - p->y; } else { @@ -152,7 +152,7 @@ void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p) { if ( CGDisplayIsCaptured (display_id) ) { /* capture signals fullscreen */ - p->y = CGDisplayPixelsHigh (display_id) - p->y - 1; + p->y = CGDisplayPixelsHigh (display_id) - p->y; } else { @@ -161,6 +161,11 @@ void QZ_PrivateCocoaToSDL (_THIS, NSPoint *p) { newPoint = [ window_view convertPoint:*p fromView:[ qz_window contentView ] ]; *p = newPoint; + + /* If OSX version is 10.3.0 or later, we need a workaround in OpenGL mode */ + if( system_version >= 0x1030 && (SDL_VideoSurface->flags & (SDL_OPENGL | SDL_OPENGLBLIT)) ) { + p->y = [window_view frame].size.height - p->y - 1; + } } }