# HG changeset patch # User Sam Lantinga # Date 1260043069 0 # Node ID 455a6c47d2c652e395ffb147f4a19db2789c7977 # Parent 5668e43c256bf842ea97a14c18aeec25a45c9cb6 Fixed compilation on Mac OS X 10.4 diff -r 5668e43c256b -r 455a6c47d2c6 src/video/cocoa/SDL_cocoakeyboard.m --- a/src/video/cocoa/SDL_cocoakeyboard.m Sat Dec 05 19:46:24 2009 +0000 +++ b/src/video/cocoa/SDL_cocoakeyboard.m Sat Dec 05 19:57:49 2009 +0000 @@ -180,9 +180,10 @@ return nil; } -- (NSInteger) conversationIdentifier +/* Needs long instead of NSInteger for compilation on Mac OS X 10.4 */ +- (long) conversationIdentifier { - return (NSInteger) self; + return (long) self; } // This method returns the index for character that is diff -r 5668e43c256b -r 455a6c47d2c6 src/video/cocoa/SDL_cocoamodes.h --- a/src/video/cocoa/SDL_cocoamodes.h Sat Dec 05 19:46:24 2009 +0000 +++ b/src/video/cocoa/SDL_cocoamodes.h Sat Dec 05 19:57:49 2009 +0000 @@ -35,6 +35,7 @@ } SDL_DisplayModeData; extern void Cocoa_InitModes(_THIS); +extern NSRect Cocoa_DisplayBounds(CGDirectDisplayID display); extern void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void Cocoa_QuitModes(_THIS); diff -r 5668e43c256b -r 455a6c47d2c6 src/video/cocoa/SDL_cocoamodes.m --- a/src/video/cocoa/SDL_cocoamodes.m Sat Dec 05 19:46:24 2009 +0000 +++ b/src/video/cocoa/SDL_cocoamodes.m Sat Dec 05 19:57:49 2009 +0000 @@ -200,6 +200,21 @@ SDL_stack_free(displays); } +/* This is needed on 10.4, where NSRect and CGRect are different */ +NSRect +Cocoa_DisplayBounds(CGDirectDisplayID display) +{ + NSRect nsrect; + CGRect cgrect; + + cgrect = CGDisplayBounds(display); + nsrect.origin.x = cgrect.origin.x; + nsrect.origin.y = cgrect.origin.y; + nsrect.size.width = cgrect.size.width; + nsrect.size.height = cgrect.size.height; + return nsrect; +} + static void AddDisplayMode(const void *moderef, void *context) { diff -r 5668e43c256b -r 455a6c47d2c6 src/video/cocoa/SDL_cocoamouse.m --- a/src/video/cocoa/SDL_cocoamouse.m Sat Dec 05 19:46:24 2009 +0000 +++ b/src/video/cocoa/SDL_cocoamouse.m Sat Dec 05 19:57:49 2009 +0000 @@ -68,7 +68,7 @@ if (candidate) { SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; - NSRect rect = CGDisplayBounds(displaydata->display); + NSRect rect = Cocoa_DisplayBounds(displaydata->display); point = [NSEvent mouseLocation]; point.x = point.x - rect.origin.x; diff -r 5668e43c256b -r 455a6c47d2c6 src/video/cocoa/SDL_cocoawindow.m --- a/src/video/cocoa/SDL_cocoawindow.m Sat Dec 05 19:46:24 2009 +0000 +++ b/src/video/cocoa/SDL_cocoawindow.m Sat Dec 05 19:57:49 2009 +0000 @@ -384,7 +384,7 @@ NSString *title; int status; - rect = CGDisplayBounds(displaydata->display); + rect = Cocoa_DisplayBounds(displaydata->display); if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { rect.origin.x += (rect.size.width - window->w) / 2; @@ -414,7 +414,9 @@ NSArray *screens = [NSScreen screens]; NSScreen *screen = nil; NSScreen *candidate; - for (candidate in screens) { + int i, count = [screens count]; + for (i = 0; i < count; ++i) { + screen = [screens objectAtIndex:i]; NSRect screenRect = [candidate frame]; if (rect.origin.x >= screenRect.origin.x && rect.origin.x < screenRect.origin.x + screenRect.size.width && @@ -483,7 +485,7 @@ SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayFromWindow(window)->driverdata; NSRect rect; - rect = CGDisplayBounds(displaydata->display); + rect = Cocoa_DisplayBounds(displaydata->display); if ((window->flags & SDL_WINDOW_FULLSCREEN) || window->x == SDL_WINDOWPOS_CENTERED) { rect.origin.x += (rect.size.width - window->w) / 2;