Mercurial > sdl-ios-xcode
changeset 3525:455a6c47d2c6
Fixed compilation on Mac OS X 10.4
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 05 Dec 2009 19:57:49 +0000 |
parents | 5668e43c256b |
children | e6f2f312780f |
files | src/video/cocoa/SDL_cocoakeyboard.m src/video/cocoa/SDL_cocoamodes.h src/video/cocoa/SDL_cocoamodes.m src/video/cocoa/SDL_cocoamouse.m src/video/cocoa/SDL_cocoawindow.m |
diffstat | 5 files changed, 25 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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);
--- 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) {
--- 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;
--- 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;