diff -ru SDL2-2.0.3-orig/include/SDL_platform.h SDL2-2.0.3/include/SDL_platform.h
--- SDL2-2.0.3-orig/include/SDL_platform.h	2014-03-16 03:31:42.000000000 +0100
+++ SDL2-2.0.3/include/SDL_platform.h	2015-10-28 21:07:23.000000000 +0100
@@ -70,7 +70,7 @@
 /* lets us know what version of Mac OS X we're compiling on */
 #include "AvailabilityMacros.h"
 #include "TargetConditionals.h"
-#if TARGET_OS_IPHONE
+#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
 /* if compiling for iPhone */
 #undef __IPHONEOS__
 #define __IPHONEOS__ 1
@@ -80,7 +80,9 @@
 #undef __MACOSX__
 #define __MACOSX__  1
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
+#if 0
 # error SDL for Mac OS X only supports deploying on 10.5 and above.
+#endif
 #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
 #endif /* TARGET_OS_IPHONE */
 #endif /* defined(__APPLE__) */
diff -ru SDL2-2.0.3-orig/include/SDL_syswm.h SDL2-2.0.3/include/SDL_syswm.h
--- SDL2-2.0.3-orig/include/SDL_syswm.h	2014-03-16 03:31:42.000000000 +0100
+++ SDL2-2.0.3/include/SDL_syswm.h	2015-10-28 23:32:33.000000000 +0100
@@ -83,6 +83,12 @@
 
 #if defined(SDL_VIDEO_DRIVER_COCOA)
 #ifdef __OBJC__
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
+#include <CoreServices/CoreServices.h>
+#undef vector
+#endif
 #include <Cocoa/Cocoa.h>
 #else
 typedef struct _NSWindow NSWindow;
Only in SDL2-2.0.3: libtool
Only in SDL2-2.0.3: sdl2-config
Only in SDL2-2.0.3: sdl2.pc
diff -ru SDL2-2.0.3-orig/src/audio/coreaudio/SDL_coreaudio.h SDL2-2.0.3/src/audio/coreaudio/SDL_coreaudio.h
--- SDL2-2.0.3-orig/src/audio/coreaudio/SDL_coreaudio.h	2014-03-16 03:31:44.000000000 +0100
+++ SDL2-2.0.3/src/audio/coreaudio/SDL_coreaudio.h	2015-10-29 00:00:26.000000000 +0100
@@ -31,7 +31,14 @@
 
 #if MACOSX_COREAUDIO
 #include <CoreAudio/CoreAudio.h>
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
 #include <CoreServices/CoreServices.h>
+#undef vector
+#else
+#include <CoreServices/CoreServices.h>
+#endif
 #else
 #include <AudioToolbox/AudioToolbox.h>
 #endif
diff -ru SDL2-2.0.3-orig/src/file/cocoa/SDL_rwopsbundlesupport.m SDL2-2.0.3/src/file/cocoa/SDL_rwopsbundlesupport.m
--- SDL2-2.0.3-orig/src/file/cocoa/SDL_rwopsbundlesupport.m	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/file/cocoa/SDL_rwopsbundlesupport.m	2015-10-29 19:40:14.000000000 +0100
@@ -21,6 +21,12 @@
 #include "../../SDL_internal.h"
 
 #ifdef __APPLE__
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
+#include <CoreServices/CoreServices.h>
+#undef vector
+#endif
 #import <Foundation/Foundation.h>
 
 #include "SDL_rwopsbundlesupport.h"
diff -ru SDL2-2.0.3-orig/src/filesystem/cocoa/SDL_sysfilesystem.m SDL2-2.0.3/src/filesystem/cocoa/SDL_sysfilesystem.m
--- SDL2-2.0.3-orig/src/filesystem/cocoa/SDL_sysfilesystem.m	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/filesystem/cocoa/SDL_sysfilesystem.m	2015-10-29 19:39:11.000000000 +0100
@@ -25,6 +25,12 @@
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 /* System dependent filesystem routines                                */
 
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
+#include <CoreServices/CoreServices.h>
+#undef vector
+#endif
 #include <Foundation/Foundation.h>
 #include <sys/stat.h>
 #include <sys/types.h>
diff -ru SDL2-2.0.3-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.3/src/joystick/darwin/SDL_sysjoystick.c
--- SDL2-2.0.3-orig/src/joystick/darwin/SDL_sysjoystick.c	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/joystick/darwin/SDL_sysjoystick.c	2015-10-28 21:07:23.000000000 +0100
@@ -384,6 +384,7 @@
     device->instance_id = ++s_joystick_instance_id;
 
     /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IOHIDDeviceGetService != NULL) {  /* weak reference: available in 10.6 and later. */
         const io_service_t ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
         if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
@@ -393,6 +394,7 @@
 #endif
         }
     }
+#endif
 
     device->send_open_event = 1;
     s_bDeviceAdded = SDL_TRUE;
diff -ru SDL2-2.0.3-orig/src/power/macosx/SDL_syspower.c SDL2-2.0.3/src/power/macosx/SDL_syspower.c
--- SDL2-2.0.3-orig/src/power/macosx/SDL_syspower.c	2014-03-16 03:31:42.000000000 +0100
+++ SDL2-2.0.3/src/power/macosx/SDL_syspower.c	2015-10-29 19:38:19.000000000 +0100
@@ -23,6 +23,12 @@
 #ifndef SDL_POWER_DISABLED
 #if SDL_POWER_MACOSX
 
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
+#include <CoreServices/CoreServices.h>
+#undef vector
+#endif
 #include <Carbon/Carbon.h>
 #include <IOKit/ps/IOPowerSources.h>
 #include <IOKit/ps/IOPSKeys.h>
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.3/src/video/cocoa/SDL_cocoaclipboard.m
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaclipboard.m	2014-03-16 03:31:45.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoaclipboard.m	2015-10-28 21:07:23.000000000 +0100
@@ -30,11 +30,15 @@
 {
     SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (data->osversion >= 0x1060) {
         return NSPasteboardTypeString;
     } else {
+#endif
         return NSStringPboardType;
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     }
+#endif
 }
 
 int
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoakeyboard.m SDL2-2.0.3/src/video/cocoa/SDL_cocoakeyboard.m
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoakeyboard.m	2014-03-16 03:31:45.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoakeyboard.m	2015-10-28 23:26:02.000000000 +0100
@@ -426,6 +426,7 @@
 static void
 UpdateKeymap(SDL_VideoData *data)
 {
+#if defined(MAC_OS_X_VERSION_10_5)
     TISInputSourceRef key_layout;
     const void *chr_data;
     int i;
@@ -483,6 +484,7 @@
 
 cleanup:
     CFRelease(key_layout);
+#endif
 }
 
 void
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.3/src/video/cocoa/SDL_cocoamodes.m
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoamodes.m	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoamodes.m	2015-10-28 21:07:23.000000000 +0100
@@ -127,6 +127,7 @@
     }
     data->moderef = moderef;
 
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
         CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
         CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
@@ -146,6 +147,7 @@
 
         CFRelease(fmt);
     }
+    #endif
 
     #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
@@ -184,17 +186,21 @@
 static void
 Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
 {
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
         CGDisplayModeRelease((CGDisplayModeRef) moderef);  /* NULL is ok */
     }
+    #endif
 }
 
 static void
 Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
 {
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
         CFRelease(modelist);  /* NULL is ok */
     }
+    #endif
 }
 
 static const char *
@@ -257,9 +263,11 @@
                 continue;
             }
 
+            #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
             if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
                 moderef = CGDisplayCopyDisplayMode(displays[i]);
             }
+            #endif
 
             #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
             if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
@@ -319,9 +327,11 @@
     SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
     CFArrayRef modes = NULL;
 
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
         modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
     }
+    #endif
 
     #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
@@ -337,9 +347,11 @@
             const void *moderef = CFArrayGetValueAtIndex(modes, i);
             SDL_DisplayMode mode;
             if (GetDisplayMode(_this, moderef, &mode)) {
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
                 if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
                     CGDisplayModeRetain((CGDisplayModeRef) moderef);
                 }
+    #endif
                 SDL_AddDisplayMode(display, &mode);
             }
         }
@@ -351,9 +363,11 @@
 static CGError
 Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
 {
+    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
         return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
     }
+    #endif
  
     #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoamouse.h SDL2-2.0.3/src/video/cocoa/SDL_cocoamouse.h
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoamouse.h	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoamouse.h	2015-10-28 22:33:28.000000000 +0100
@@ -25,6 +25,10 @@
 
 #include "SDL_cocoavideo.h"
 
+#if !defined(MAC_OS_X_VERSION_10_5)
+typedef float CGFloat;
+#endif
+
 extern void Cocoa_InitMouse(_THIS);
 extern void Cocoa_HandleMouseEvent(_THIS, NSEvent * event);
 extern void Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent * event);
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.3/src/video/cocoa/SDL_cocoaopengl.m
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaopengl.m	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoaopengl.m	2015-10-28 21:07:23.000000000 +0100
@@ -347,9 +347,11 @@
 
     /* This gives us the correct viewport for a Retina-enabled view, only
      * supported on 10.7+. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
         viewport = [contentView convertRectToBacking:viewport];
     }
+#endif
 
     if (w) {
         *w = viewport.size.width;
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoavideo.h SDL2-2.0.3/src/video/cocoa/SDL_cocoavideo.h
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoavideo.h	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoavideo.h	2015-10-28 23:16:56.000000000 +0100
@@ -25,6 +25,12 @@
 
 #include "SDL_opengl.h"
 
+#if defined(__ALTIVEC__) && !defined(MAC_OS_X_VERSION_10_5)
+/* to cricumvent a bug in Mac OS X 10.4 SDK */
+#define vector __vector
+#include <CoreServices/CoreServices.h>
+#undef vector
+#endif
 #include <ApplicationServices/ApplicationServices.h>
 #include <Cocoa/Cocoa.h>
 
@@ -39,6 +45,11 @@
 #include "SDL_cocoaopengl.h"
 #include "SDL_cocoawindow.h"
 
+#if !defined(MAC_OS_X_VERSION_10_5)
+typedef long int NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+
 /* Private display data */
 
 @class SDLTranslatorResponder;
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.h
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.h	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.h	2015-10-28 21:07:23.000000000 +0100
@@ -35,7 +35,11 @@
     PENDING_OPERATION_MINIMIZE
 } PendingWindowOperation;
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 @interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
+#else
+@interface Cocoa_WindowListener : NSResponder {
+#endif
     SDL_WindowData *_data;
     BOOL observingVisible;
     BOOL wasCtrlLeft;
@@ -73,7 +77,9 @@
 -(void) windowDidEnterFullScreen:(NSNotification *) aNotification;
 -(void) windowWillExitFullScreen:(NSNotification *) aNotification;
 -(void) windowDidExitFullScreen:(NSNotification *) aNotification;
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
+#endif
 
 /* Window event handling */
 -(void) mouseDown:(NSEvent *) theEvent;
diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.m
--- SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.m	2014-03-16 03:31:41.000000000 +0100
+++ SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.m	2015-10-28 23:58:30.000000000 +0100
@@ -23,7 +23,9 @@
 #if SDL_VIDEO_DRIVER_COCOA
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
+#if 0
 # error SDL for Mac OS X must be built with a 10.7 SDK or above.
+#endif
 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
 
 #include "SDL_syswm.h"
@@ -100,7 +102,14 @@
     NSOpenGLContext *currentContext = [NSOpenGLContext currentContext];
     NSMutableArray *contexts = data->nscontexts;
     @synchronized (contexts) {
+#if defined(MAC_OS_X_VERSION_10_5)
         for (SDLOpenGLContext *context in contexts) {
+#else
+        /* old way to iterate */
+        int i;
+        for (i = 0; i < [contexts count]; i++) {
+            SDLOpenGLContext *context = [contexts objectAtIndex:i];
+#endif
             if (context == currentContext) {
                 [context update];
             } else {
@@ -190,10 +199,12 @@
         [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
         [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window];
         [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
         [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window];
         [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
         [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
         [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
+#endif
     } else {
         [window setDelegate:self];
     }
@@ -212,9 +223,11 @@
 
     [view setNextResponder:self];
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
     if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
         [view setAcceptsTouchEvents:YES];
     }
+#endif
 }
 
 - (void)observeValueForKeyPath:(NSString *)keyPath
@@ -282,7 +295,9 @@
     inFullscreenTransition = YES;
 
     /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
     [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+#endif
     [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO];
     return YES;
 }
@@ -319,10 +334,12 @@
         [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
         [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window];
         [center removeObserver:self name:NSWindowDidResignKeyNotification object:window];
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
         [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window];
         [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
         [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
         [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
+#endif
     } else {
         [window setDelegate:nil];
     }
@@ -346,8 +363,14 @@
        !!! FIXME:   http://bugzilla.libsdl.org/show_bug.cgi?id=1825
     */
     windows = [NSApp orderedWindows];
-    for (NSWindow *win in windows)
-    {
+#if defined(MAC_OS_X_VERSION_10_5)
+    for (NSWindow *win in windows) {
+#else
+    /* old way to iterate */
+    int i;
+    for (i = 0; i < [windows count]; i++) {
+        NSWindow *win = [windows objectAtIndex:i];
+#endif
         if (win == window) {
             continue;
         }
@@ -597,12 +620,14 @@
         [nswindow miniaturize:nil];
     } else {
         /* Adjust the fullscreen toggle button and readd menu now that we're here. */
+#if MAC_OS_X_VERSION_MIN_REQUIRED > 1070
         if (window->flags & SDL_WINDOW_RESIZABLE) {
             /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
             [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
         } else {
             [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged];
         }
+#endif
         [NSMenu setMenuBarVisible:YES];
 
         pendingWindowOperation = PENDING_OPERATION_NONE;
@@ -620,6 +645,7 @@
     }
 }
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
 {
     if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
@@ -628,6 +654,7 @@
         return proposedOptions;
     }
 }
+#endif
 
 
 /* We'll respond to key events by doing nothing so we don't beep.
@@ -822,6 +849,7 @@
     [self handleTouches:COCOA_TOUCH_CANCELLED withEvent:theEvent];
 }
 
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
 {
     NSSet *touches = 0;
@@ -875,6 +903,7 @@
         touch = (NSTouch*)[enumerator nextObject];
     }
 }
+#endif
 
 @end
 
@@ -1040,6 +1069,7 @@
     [nswindow setBackgroundColor:[NSColor blackColor]];
 
     if (videodata->allow_spaces) {
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
         SDL_assert(videodata->osversion >= 0x1070);
         SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]);
         /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
@@ -1047,6 +1077,7 @@
             /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
             [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
         }
+#endif
     }
 
     /* Create a default view for this window */
@@ -1490,7 +1521,14 @@
         }
 
         NSArray *contexts = [[data->nscontexts copy] autorelease];
+#if defined(MAC_OS_X_VERSION_10_5)
         for (SDLOpenGLContext *context in contexts) {
+#else
+        /* old way to iterate */
+        int i;
+        for (i = 0; i < [contexts count]; i++) {
+            SDLOpenGLContext *context = [contexts objectAtIndex:i];
+#endif
             /* Calling setWindow:NULL causes the context to remove itself from the context list. */            
             [context setWindow:NULL];
         }