From b80876326e43ca62dcc6422fa77a28978cab3710 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 16 Sep 2002 18:38:09 +0000 Subject: [PATCH] Fixed window update problems on MacOS X 10.2 (thanks Darrell!) --- src/video/quartz/SDL_QuartzVideo.h | 2 ++ src/video/quartz/SDL_QuartzVideo.m | 21 ++++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/video/quartz/SDL_QuartzVideo.h b/src/video/quartz/SDL_QuartzVideo.h index d89548be0..0d3b949e3 100644 --- a/src/video/quartz/SDL_QuartzVideo.h +++ b/src/video/quartz/SDL_QuartzVideo.h @@ -227,6 +227,8 @@ static int QZ_ToggleFullScreen (_THIS, int on); static int QZ_SetColors (_THIS, int first_color, int num_colors, SDL_Color *colors); static void QZ_DirectUpdate (_THIS, int num_rects, SDL_Rect *rects); +static int QZ_LockWindow (_THIS, SDL_Surface *surface); +static void QZ_UnlockWindow (_THIS, SDL_Surface *surface); static void QZ_UpdateRects (_THIS, int num_rects, SDL_Rect *rects); static void QZ_VideoQuit (_THIS); diff --git a/src/video/quartz/SDL_QuartzVideo.m b/src/video/quartz/SDL_QuartzVideo.m index 47e975f9c..eddb10aa3 100644 --- a/src/video/quartz/SDL_QuartzVideo.m +++ b/src/video/quartz/SDL_QuartzVideo.m @@ -576,10 +576,12 @@ static void QZ_UnsetVideoMode (_THIS) { LockPortBits ( [ window_view qdPort ] ); current->pixels = GetPixBaseAddr ( GetPortPixMap ( [ window_view qdPort ] ) ); current->pitch = GetPixRowBytes ( GetPortPixMap ( [ window_view qdPort ] ) ); - + UnlockPortBits ( [ window_view qdPort ] ); + current->flags |= SDL_SWSURFACE; current->flags |= SDL_PREALLOC; - + current->flags |= SDL_ASYNCBLIT; + if ( flags & SDL_NOFRAME ) current->flags |= SDL_NOFRAME; if ( flags & SDL_RESIZABLE ) @@ -590,7 +592,9 @@ static void QZ_UnsetVideoMode (_THIS) { current->pixels += 22 * current->pitch; } - this->UpdateRects = QZ_UpdateRects; + this->UpdateRects = QZ_UpdateRects; + this->LockHWSurface = QZ_LockWindow; + this->UnlockHWSurface = QZ_UnlockWindow; } /* Save flags to ensure correct teardown */ @@ -913,6 +917,17 @@ they are too big (but will work) for background windows */ #endif } +/* Locking functions for the software window buffer */ +static int QZ_LockWindow (_THIS, SDL_Surface *surface) { + + return LockPortBits ( [ window_view qdPort ] ); +} + +static void QZ_UnlockWindow (_THIS, SDL_Surface *surface) { + + UnlockPortBits ( [ window_view qdPort ] ); +} + static void QZ_UpdateRects (_THIS, int numRects, SDL_Rect *rects) { if (SDL_VideoSurface->flags & SDL_OPENGLBLIT) {