Ticket #52210: SDL2-2.0.4_OSX_105.patch
File SDL2-2.0.4_OSX_105.patch, 65.9 KB (added by miniupnp (Thomas BERNARD), 6 years ago) |
---|
-
include/SDL_config.h
Only in SDL2-2.0.4: Makefile Only in SDL2-2.0.4: Makefile.rules Only in SDL2-2.0.4: build Only in SDL2-2.0.4: config.log Only in SDL2-2.0.4: config.status diff -ru SDL2-2.0.4-orig/include/SDL_config.h SDL2-2.0.4/include/SDL_config.h
old new 1 /* include/SDL_config.h. Generated from SDL_config.h.in by configure. */ 1 2 /* 2 3 Simple DirectMedia Layer 3 4 Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> … … 22 23 #ifndef _SDL_config_h 23 24 #define _SDL_config_h 24 25 25 #include "SDL_platform.h"26 27 26 /** 28 * \file SDL_config.h 27 * \file SDL_config.h.in 28 * 29 * This is a set of defines to configure the SDL features 29 30 */ 30 31 31 /* Add any platform that doesn't build using the configure system. */ 32 #ifdef USING_PREMAKE_CONFIG_H 33 #include "SDL_config_premake.h" 34 #elif defined(__WIN32__) 35 #include "SDL_config_windows.h" 36 #elif defined(__WINRT__) 37 #include "SDL_config_winrt.h" 38 #elif defined(__MACOSX__) 39 #include "SDL_config_macosx.h" 40 #elif defined(__IPHONEOS__) 41 #include "SDL_config_iphoneos.h" 42 #elif defined(__ANDROID__) 43 #include "SDL_config_android.h" 44 #elif defined(__PSP__) 45 #include "SDL_config_psp.h" 32 /* General platform specific identifiers */ 33 #include "SDL_platform.h" 34 35 /* Make sure that this isn't included by Visual C++ */ 36 #ifdef _MSC_VER 37 #error You should run hg revert SDL_config.h 38 #endif 39 40 /* C language features */ 41 /* #undef const */ 42 /* #undef inline */ 43 /* #undef volatile */ 44 45 /* C datatypes */ 46 #ifdef __LP64__ 47 #define SIZEOF_VOIDP 8 46 48 #else 47 /* This is a minimal configuration just to get SDL running on new platforms */ 48 #include "SDL_config_minimal.h" 49 #endif /* platform config */ 49 #define SIZEOF_VOIDP 4 50 #endif 51 /* #undef HAVE_GCC_ATOMICS */ 52 /* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ 53 54 /* #undef HAVE_DDRAW_H */ 55 /* #undef HAVE_DINPUT_H */ 56 /* #undef HAVE_DSOUND_H */ 57 /* #undef HAVE_DXGI_H */ 58 /* #undef HAVE_XINPUT_H */ 59 60 /* Comment this if you want to build without any C library requirements */ 61 #define HAVE_LIBC 1 62 #if HAVE_LIBC 50 63 51 #ifdef USING_GENERATED_CONFIG_H 52 #error Wrong SDL_config.h, check your include path? 64 /* Useful headers */ 65 #define HAVE_ALLOCA_H 1 66 #define HAVE_SYS_TYPES_H 1 67 #define HAVE_STDIO_H 1 68 #define STDC_HEADERS 1 69 #define HAVE_STDLIB_H 1 70 #define HAVE_STDARG_H 1 71 /* #undef HAVE_MALLOC_H */ 72 #define HAVE_MEMORY_H 1 73 #define HAVE_STRING_H 1 74 #define HAVE_STRINGS_H 1 75 #define HAVE_INTTYPES_H 1 76 #define HAVE_STDINT_H 1 77 #define HAVE_CTYPE_H 1 78 #define HAVE_MATH_H 1 79 #define HAVE_ICONV_H 1 80 #define HAVE_SIGNAL_H 1 81 #define HAVE_ALTIVEC_H 1 82 /* #undef HAVE_PTHREAD_NP_H */ 83 /* #undef HAVE_LIBUDEV_H */ 84 /* #undef HAVE_DBUS_DBUS_H */ 85 /* #undef HAVE_IBUS_IBUS_H */ 86 87 /* C library functions */ 88 #define HAVE_MALLOC 1 89 #define HAVE_CALLOC 1 90 #define HAVE_REALLOC 1 91 #define HAVE_FREE 1 92 #define HAVE_ALLOCA 1 93 #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ 94 #define HAVE_GETENV 1 95 #define HAVE_SETENV 1 96 #define HAVE_PUTENV 1 97 #define HAVE_UNSETENV 1 53 98 #endif 99 #define HAVE_QSORT 1 100 #define HAVE_ABS 1 101 #define HAVE_BCOPY 1 102 #define HAVE_MEMSET 1 103 #define HAVE_MEMCPY 1 104 #define HAVE_MEMMOVE 1 105 #define HAVE_MEMCMP 1 106 #define HAVE_STRLEN 1 107 #define HAVE_STRLCPY 1 108 #define HAVE_STRLCAT 1 109 #define HAVE_STRDUP 1 110 /* #undef HAVE__STRREV */ 111 /* #undef HAVE__STRUPR */ 112 /* #undef HAVE__STRLWR */ 113 /* #undef HAVE_INDEX */ 114 /* #undef HAVE_RINDEX */ 115 #define HAVE_STRCHR 1 116 #define HAVE_STRRCHR 1 117 #define HAVE_STRSTR 1 118 /* #undef HAVE_ITOA */ 119 /* #undef HAVE__LTOA */ 120 /* #undef HAVE__UITOA */ 121 /* #undef HAVE__ULTOA */ 122 #define HAVE_STRTOL 1 123 #define HAVE_STRTOUL 1 124 /* #undef HAVE__I64TOA */ 125 /* #undef HAVE__UI64TOA */ 126 #define HAVE_STRTOLL 1 127 #define HAVE_STRTOULL 1 128 #define HAVE_STRTOD 1 129 #define HAVE_ATOI 1 130 #define HAVE_ATOF 1 131 #define HAVE_STRCMP 1 132 #define HAVE_STRNCMP 1 133 /* #undef HAVE__STRICMP */ 134 #define HAVE_STRCASECMP 1 135 /* #undef HAVE__STRNICMP */ 136 #define HAVE_STRNCASECMP 1 137 /* #undef HAVE_SSCANF */ 138 #define HAVE_VSSCANF 1 139 /* #undef HAVE_SNPRINTF */ 140 #define HAVE_VSNPRINTF 1 141 #define HAVE_M_PI /**/ 142 #define HAVE_ATAN 1 143 #define HAVE_ATAN2 1 144 #define HAVE_ACOS 1 145 #define HAVE_ASIN 1 146 #define HAVE_CEIL 1 147 #define HAVE_COPYSIGN 1 148 #define HAVE_COS 1 149 #define HAVE_COSF 1 150 #define HAVE_FABS 1 151 #define HAVE_FLOOR 1 152 #define HAVE_LOG 1 153 #define HAVE_POW 1 154 #define HAVE_SCALBN 1 155 #define HAVE_SIN 1 156 #define HAVE_SINF 1 157 #define HAVE_SQRT 1 158 #define HAVE_SQRTF 1 159 #define HAVE_TAN 1 160 #define HAVE_TANF 1 161 #define HAVE_FSEEKO 1 162 /* #undef HAVE_FSEEKO64 */ 163 #define HAVE_SIGACTION 1 164 #define HAVE_SA_SIGACTION 1 165 #define HAVE_SETJMP 1 166 #define HAVE_NANOSLEEP 1 167 #define HAVE_SYSCONF 1 168 #define HAVE_SYSCTLBYNAME 1 169 /* #undef HAVE_CLOCK_GETTIME */ 170 /* #undef HAVE_GETPAGESIZE */ 171 #define HAVE_MPROTECT 1 172 #define HAVE_ICONV 1 173 /* #undef HAVE_PTHREAD_SETNAME_NP */ 174 /* #undef HAVE_PTHREAD_SET_NAME_NP */ 175 /* #undef HAVE_SEM_TIMEDWAIT */ 176 177 #else 178 #define HAVE_STDARG_H 1 179 #define HAVE_STDDEF_H 1 180 #define HAVE_STDINT_H 1 181 #endif /* HAVE_LIBC */ 182 183 /* SDL internal assertion support */ 184 /* #undef SDL_DEFAULT_ASSERT_LEVEL */ 185 186 /* Allow disabling of core subsystems */ 187 /* #undef SDL_ATOMIC_DISABLED */ 188 /* #undef SDL_AUDIO_DISABLED */ 189 /* #undef SDL_CPUINFO_DISABLED */ 190 /* #undef SDL_EVENTS_DISABLED */ 191 /* #undef SDL_FILE_DISABLED */ 192 /* #undef SDL_JOYSTICK_DISABLED */ 193 /* #undef SDL_HAPTIC_DISABLED */ 194 /* #undef SDL_LOADSO_DISABLED */ 195 /* #undef SDL_RENDER_DISABLED */ 196 /* #undef SDL_THREADS_DISABLED */ 197 /* #undef SDL_TIMERS_DISABLED */ 198 /* #undef SDL_VIDEO_DISABLED */ 199 /* #undef SDL_POWER_DISABLED */ 200 /* #undef SDL_FILESYSTEM_DISABLED */ 201 202 /* Enable various audio drivers */ 203 /* #undef SDL_AUDIO_DRIVER_ALSA */ 204 /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ 205 /* #undef SDL_AUDIO_DRIVER_ARTS */ 206 /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ 207 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ 208 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ 209 /* #undef SDL_AUDIO_DRIVER_HAIKU */ 210 /* #undef SDL_AUDIO_DRIVER_BSD */ 211 #define SDL_AUDIO_DRIVER_COREAUDIO 1 212 #define SDL_AUDIO_DRIVER_DISK 1 213 #define SDL_AUDIO_DRIVER_DUMMY 1 214 /* #undef SDL_AUDIO_DRIVER_ANDROID */ 215 /* #undef SDL_AUDIO_DRIVER_XAUDIO2 */ 216 /* #undef SDL_AUDIO_DRIVER_DSOUND */ 217 /* #undef SDL_AUDIO_DRIVER_ESD */ 218 /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ 219 /* #undef SDL_AUDIO_DRIVER_NACL */ 220 /* #undef SDL_AUDIO_DRIVER_NAS */ 221 /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ 222 /* #undef SDL_AUDIO_DRIVER_SNDIO */ 223 /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ 224 /* #undef SDL_AUDIO_DRIVER_OSS */ 225 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ 226 /* #undef SDL_AUDIO_DRIVER_PAUDIO */ 227 /* #undef SDL_AUDIO_DRIVER_QSA */ 228 /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ 229 /* #undef SDL_AUDIO_DRIVER_WINMM */ 230 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ 231 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ 232 /* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */ 233 234 /* Enable various input drivers */ 235 /* #undef SDL_INPUT_LINUXEV */ 236 /* #undef SDL_INPUT_LINUXKD */ 237 /* #undef SDL_INPUT_TSLIB */ 238 /* #undef SDL_JOYSTICK_HAIKU */ 239 /* #undef SDL_JOYSTICK_DINPUT */ 240 /* #undef SDL_JOYSTICK_XINPUT */ 241 /* #undef SDL_JOYSTICK_DUMMY */ 242 #define SDL_JOYSTICK_IOKIT 1 243 /* #undef SDL_JOYSTICK_LINUX */ 244 /* #undef SDL_JOYSTICK_ANDROID */ 245 /* #undef SDL_JOYSTICK_WINMM */ 246 /* #undef SDL_JOYSTICK_USBHID */ 247 /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ 248 /* #undef SDL_JOYSTICK_EMSCRIPTEN */ 249 /* #undef SDL_HAPTIC_DUMMY */ 250 /* #undef SDL_HAPTIC_LINUX */ 251 #define SDL_HAPTIC_IOKIT 1 252 /* #undef SDL_HAPTIC_DINPUT */ 253 /* #undef SDL_HAPTIC_XINPUT */ 254 255 /* Enable various shared object loading systems */ 256 /* #undef SDL_LOADSO_HAIKU */ 257 #define SDL_LOADSO_DLOPEN 1 258 /* #undef SDL_LOADSO_DUMMY */ 259 /* #undef SDL_LOADSO_LDG */ 260 /* #undef SDL_LOADSO_WINDOWS */ 261 262 /* Enable various threading systems */ 263 #define SDL_THREAD_PTHREAD 1 264 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 265 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ 266 /* #undef SDL_THREAD_WINDOWS */ 267 268 /* Enable various timer systems */ 269 /* #undef SDL_TIMER_HAIKU */ 270 /* #undef SDL_TIMER_DUMMY */ 271 #define SDL_TIMER_UNIX 1 272 /* #undef SDL_TIMER_WINDOWS */ 273 274 /* Enable various video drivers */ 275 /* #undef SDL_VIDEO_DRIVER_HAIKU */ 276 #define SDL_VIDEO_DRIVER_COCOA 1 277 /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ 278 /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ 279 #define SDL_VIDEO_DRIVER_DUMMY 1 280 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ 281 /* #undef SDL_VIDEO_DRIVER_WAYLAND */ 282 /* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ 283 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ 284 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ 285 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ 286 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ 287 /* #undef SDL_VIDEO_DRIVER_MIR */ 288 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */ 289 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */ 290 #define SDL_VIDEO_DRIVER_X11 1 291 /* #undef SDL_VIDEO_DRIVER_RPI */ 292 /* #undef SDL_VIDEO_DRIVER_ANDROID */ 293 /* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */ 294 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 295 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 296 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "/usr/X11R6/lib/libXcursor.1.dylib" 297 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" 298 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */ 299 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */ 300 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" 301 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" 302 #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 303 #define SDL_VIDEO_DRIVER_X11_XDBE 1 304 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 305 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */ 306 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ 307 /* #undef SDL_VIDEO_DRIVER_X11_XRANDR */ 308 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 309 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 310 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 311 /* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */ 312 /* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */ 313 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 314 /* #undef SDL_VIDEO_DRIVER_NACL */ 315 /* #undef SDL_VIDEO_DRIVER_VIVANTE */ 316 /* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */ 317 318 /* #undef SDL_VIDEO_RENDER_D3D */ 319 /* #undef SDL_VIDEO_RENDER_D3D11 */ 320 #define SDL_VIDEO_RENDER_OGL 1 321 /* #undef SDL_VIDEO_RENDER_OGL_ES */ 322 /* #undef SDL_VIDEO_RENDER_OGL_ES2 */ 323 /* #undef SDL_VIDEO_RENDER_DIRECTFB */ 324 325 /* Enable OpenGL support */ 326 #define SDL_VIDEO_OPENGL 1 327 /* #undef SDL_VIDEO_OPENGL_ES */ 328 /* #undef SDL_VIDEO_OPENGL_ES2 */ 329 /* #undef SDL_VIDEO_OPENGL_BGL */ 330 #define SDL_VIDEO_OPENGL_CGL 1 331 /* #undef SDL_VIDEO_OPENGL_EGL */ 332 #define SDL_VIDEO_OPENGL_GLX 1 333 /* #undef SDL_VIDEO_OPENGL_WGL */ 334 /* #undef SDL_VIDEO_OPENGL_OSMESA */ 335 /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ 336 337 /* Enable system power support */ 338 /* #undef SDL_POWER_LINUX */ 339 /* #undef SDL_POWER_WINDOWS */ 340 #define SDL_POWER_MACOSX 1 341 /* #undef SDL_POWER_HAIKU */ 342 /* #undef SDL_POWER_ANDROID */ 343 /* #undef SDL_POWER_EMSCRIPTEN */ 344 /* #undef SDL_POWER_HARDWIRED */ 345 346 /* Enable system filesystem support */ 347 /* #undef SDL_FILESYSTEM_HAIKU */ 348 #define SDL_FILESYSTEM_COCOA 1 349 /* #undef SDL_FILESYSTEM_DUMMY */ 350 /* #undef SDL_FILESYSTEM_UNIX */ 351 /* #undef SDL_FILESYSTEM_WINDOWS */ 352 /* #undef SDL_FILESYSTEM_NACL */ 353 /* #undef SDL_FILESYSTEM_ANDROID */ 354 /* #undef SDL_FILESYSTEM_EMSCRIPTEN */ 355 356 /* Enable assembly routines */ 357 #define SDL_ASSEMBLY_ROUTINES 1 358 #define SDL_ALTIVEC_BLITTERS 1 54 359 55 360 #endif /* _SDL_config_h */ -
include/SDL_platform.h
diff -ru SDL2-2.0.4-orig/include/SDL_platform.h SDL2-2.0.4/include/SDL_platform.h
old new 70 70 /* lets us know what version of Mac OS X we're compiling on */ 71 71 #include "AvailabilityMacros.h" 72 72 #include "TargetConditionals.h" 73 #if TARGET_OS_IPHONE73 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE 74 74 /* if compiling for iPhone */ 75 75 #undef __IPHONEOS__ 76 76 #define __IPHONEOS__ 1 … … 80 80 #undef __MACOSX__ 81 81 #define __MACOSX__ 1 82 82 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 83 #if 0 83 84 # error SDL for Mac OS X only supports deploying on 10.5 and above. 85 #endif 84 86 #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ 85 87 #endif /* TARGET_OS_IPHONE */ 86 88 #endif /* defined(__APPLE__) */ -
include/SDL_syswm.h
diff -ru SDL2-2.0.4-orig/include/SDL_syswm.h SDL2-2.0.4/include/SDL_syswm.h
old new 215 215 #if defined(SDL_VIDEO_DRIVER_COCOA) 216 216 struct 217 217 { 218 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 218 219 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 219 220 NSWindow __unsafe_unretained *window; /* The Cocoa window */ 220 221 #else 221 222 NSWindow *window; /* The Cocoa window */ 222 223 #endif 224 #else 225 NSWindow *window; /* The Cocoa window */ 226 #endif 223 227 } cocoa; 224 228 #endif 225 229 #if defined(SDL_VIDEO_DRIVER_UIKIT) 226 230 struct 227 231 { 232 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 228 233 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 229 234 UIWindow __unsafe_unretained *window; /* The UIKit window */ 230 235 #else 231 236 UIWindow *window; /* The UIKit window */ 232 237 #endif 238 #else 239 UIWindow *window; /* The UIKit window */ 240 #endif 233 241 GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ 234 242 GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ 235 243 GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ -
src/atomic/SDL_spinlock.c
Only in SDL2-2.0.4: libtool Only in SDL2-2.0.4: sdl2-config Only in SDL2-2.0.4: sdl2-config.cmake Only in SDL2-2.0.4: sdl2.pc diff -ru SDL2-2.0.4-orig/src/atomic/SDL_spinlock.c SDL2-2.0.4/src/atomic/SDL_spinlock.c
old new 28 28 #include "SDL_mutex.h" 29 29 #include "SDL_timer.h" 30 30 31 #if defined(__MACOSX__) || defined(__IPHONEOS__) 32 #include <libkern/OSAtomic.h> 33 #endif 34 31 35 #if !defined(HAVE_GCC_ATOMICS) && defined(__SOLARIS__) 32 36 #include <atomic.h> 33 37 #endif -
src/file/cocoa/SDL_rwopsbundlesupport.m
diff -ru SDL2-2.0.4-orig/src/file/cocoa/SDL_rwopsbundlesupport.m SDL2-2.0.4/src/file/cocoa/SDL_rwopsbundlesupport.m
old new 33 33 Also, note the bundle layouts are different for iPhone and Mac. 34 34 */ 35 35 FILE* SDL_OpenFPFromBundleOrFallback(const char *file, const char *mode) 36 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 36 37 { @autoreleasepool 38 #endif 37 39 { 38 40 FILE* fp = NULL; 39 41 … … 42 44 return fopen(file, mode); 43 45 } 44 46 47 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 48 NSAutoreleasePool* autorelease_pool = [[NSAutoreleasePool alloc] init]; 49 #endif 45 50 NSFileManager* file_manager = [NSFileManager defaultManager]; 46 51 NSString* resource_path = [[NSBundle mainBundle] resourcePath]; 47 52 … … 54 59 fp = fopen(file, mode); 55 60 } 56 61 62 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 63 [autorelease_pool drain]; 64 #endif 57 65 return fp; 66 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 67 } 68 #else 58 69 }} 70 #endif 59 71 60 72 #endif /* __APPLE__ */ 61 73 -
src/filesystem/cocoa/SDL_sysfilesystem.m
diff -ru SDL2-2.0.4-orig/src/filesystem/cocoa/SDL_sysfilesystem.m SDL2-2.0.4/src/filesystem/cocoa/SDL_sysfilesystem.m
old new 35 35 36 36 char * 37 37 SDL_GetBasePath(void) 38 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 38 39 { @autoreleasepool 39 40 { 41 #else 42 { 43 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 44 #endif 40 45 NSBundle *bundle = [NSBundle mainBundle]; 41 46 const char* baseType = [[[bundle infoDictionary] objectForKey:@"SDL_FILESYSTEM_BASE_DIR_TYPE"] UTF8String]; 42 47 const char *base = NULL; … … 64 69 } 65 70 } 66 71 72 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 67 73 return retval; 68 74 }} 75 #else 76 [pool release]; 77 return retval; 78 } 79 #endif 69 80 70 81 char * 71 82 SDL_GetPrefPath(const char *org, const char *app) 83 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 72 84 { @autoreleasepool 73 85 { 86 #else 87 { 88 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 89 #endif 74 90 char *retval = NULL; 75 91 76 92 NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); … … 98 114 } 99 115 } 100 116 117 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 101 118 return retval; 102 119 }} 120 #else 121 [pool release]; 122 return retval; 123 } 124 #endif 103 125 104 126 #endif /* SDL_FILESYSTEM_COCOA */ 105 127 -
src/joystick/darwin/SDL_sysjoystick.c
diff -ru SDL2-2.0.4-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.4/src/joystick/darwin/SDL_sysjoystick.c
old new 452 452 453 453 /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */ 454 454 455 #if MAC_OS_X_VERSION_MIN_REQUIRED <1060455 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 456 456 if (IOHIDDeviceGetService != NULL) { /* weak reference: available in 10.6 and later. */ 457 #endif458 457 459 458 const io_service_t ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); 460 459 #if SDL_HAPTIC_IOKIT … … 464 463 } 465 464 #endif 466 465 467 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060468 466 } 469 467 #endif 470 468 -
src/video/cocoa/SDL_cocoaclipboard.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.4/src/video/cocoa/SDL_cocoaclipboard.m
old new 28 28 static NSString * 29 29 GetTextFormat(_THIS) 30 30 { 31 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 31 32 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { 32 33 return NSPasteboardTypeString; 33 34 } else { 35 #endif 34 36 return NSStringPboardType; 37 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 35 38 } 39 #endif 36 40 } 37 41 38 42 int 39 43 Cocoa_SetClipboardText(_THIS, const char *text) 44 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 40 45 { @autoreleasepool 41 46 { 47 #else 48 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 49 #endif 42 50 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 43 51 NSPasteboard *pasteboard; 44 52 NSString *format = GetTextFormat(_this); … … 47 55 data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; 48 56 [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; 49 57 58 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 59 [pool release]; 60 #endif 50 61 return 0; 62 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 51 63 }} 64 #else 65 } 66 #endif 52 67 53 68 char * 54 69 Cocoa_GetClipboardText(_THIS) 70 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 55 71 { @autoreleasepool 56 72 { 73 #else 74 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 75 #endif 57 76 NSPasteboard *pasteboard; 58 77 NSString *format = GetTextFormat(_this); 59 78 NSString *available; … … 76 95 text = SDL_strdup(""); 77 96 } 78 97 98 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 99 [pool release]; 100 #endif 79 101 return text; 102 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 80 103 }} 104 #else 105 } 106 #endif 81 107 82 108 SDL_bool 83 109 Cocoa_HasClipboardText(_THIS) … … 93 119 94 120 void 95 121 Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) 122 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 96 123 { @autoreleasepool 97 124 { 125 #else 126 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 127 #endif 98 128 NSPasteboard *pasteboard; 99 129 NSInteger count; 100 130 … … 106 136 } 107 137 data->clipboard_count = count; 108 138 } 139 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 109 140 }} 141 #else 142 [pool release]; 143 } 144 #endif 110 145 111 146 #endif /* SDL_VIDEO_DRIVER_COCOA */ 112 147 -
src/video/cocoa/SDL_cocoaevents.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoaevents.m SDL2-2.0.4/src/video/cocoa/SDL_cocoaevents.m
old new 54 54 - (void)setAppleMenu:(NSMenu *)menu; 55 55 @end 56 56 57 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 57 58 @interface SDLAppDelegate : NSObject <NSApplicationDelegate> { 59 #else 60 @interface SDLAppDelegate : NSObject { 61 #endif 58 62 @public 59 63 BOOL seenFirstActivate; 60 64 } … … 311 315 312 316 void 313 317 Cocoa_RegisterApp(void) 318 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 314 319 { @autoreleasepool 320 #endif 315 321 { 316 322 /* This can get called more than once! Be careful what you initialize! */ 317 323 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 324 NSAutoreleasePool *pool; 325 pool = [[NSAutoreleasePool alloc] init]; 326 #endif 318 327 if (NSApp == nil) { 319 328 [SDLApplication sharedApplication]; 320 329 SDL_assert(NSApp != nil); 321 330 322 331 const char *hint = SDL_GetHint(SDL_HINT_MAC_BACKGROUND_APP); 323 332 if (!hint || *hint == '0') { 333 #if defined(MAC_OS_X_VERSION_10_6) 324 334 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 325 335 if ([NSApp respondsToSelector:@selector(setActivationPolicy:)]) { 326 336 #endif … … 331 341 TransformProcessType(&psn, kProcessTransformToForegroundApplication); 332 342 } 333 343 #endif 344 #endif 334 345 [NSApp activateIgnoringOtherApps:YES]; 335 346 } 336 347 … … 358 369 appDelegate->seenFirstActivate = YES; 359 370 } 360 371 } 372 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 361 373 }} 374 #else 375 [pool release]; 376 } 377 #endif 362 378 363 379 void 364 380 Cocoa_PumpEvents(_THIS) 381 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 365 382 { @autoreleasepool 366 383 { 384 #else 385 { 386 NSAutoreleasePool *pool; 387 #endif 367 388 /* Update activity every 30 seconds to prevent screensaver */ 368 389 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; 369 390 if (_this->suspend_screensaver && !data->screensaver_use_iopm) { … … 375 396 } 376 397 } 377 398 399 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 400 pool = [[NSAutoreleasePool alloc] init]; 401 #endif 378 402 for ( ; ; ) { 379 403 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 380 404 if ( event == nil ) { … … 406 430 /* Pass through to NSApp to make sure everything stays in sync */ 407 431 [NSApp sendEvent:event]; 408 432 } 433 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 409 434 }} 435 #else 436 [pool release]; 437 } 438 #endif 410 439 411 440 void 412 441 Cocoa_SuspendScreenSaver(_THIS) 442 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 413 443 { @autoreleasepool 414 444 { 415 445 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 436 466 &data->screensaver_assertion); 437 467 } 438 468 }} 469 #else 470 { 471 } 472 #endif 439 473 440 474 #endif /* SDL_VIDEO_DRIVER_COCOA */ 441 475 -
src/video/cocoa/SDL_cocoakeyboard.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoakeyboard.m SDL2-2.0.4/src/video/cocoa/SDL_cocoakeyboard.m
old new 150 150 aRange.location, aRange.length, windowHeight, 151 151 NSStringFromRect(rect)); 152 152 153 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 153 154 if ([[self window] respondsToSelector:@selector(convertRectToScreen:)]) { 154 155 rect = [[self window] convertRectToScreen:rect]; 155 156 } else { 157 #endif 156 158 rect.origin = [[self window] convertBaseToScreen:rect.origin]; 159 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 157 160 } 161 #endif 158 162 159 163 return rect; 160 164 } … … 498 502 SDL_SetScancodeName(SDL_SCANCODE_RALT, "Right Option"); 499 503 SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); 500 504 505 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 501 506 /* On pre-10.6, you might have the initial capslock key state wrong. */ 502 507 if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { 503 508 data->modifierFlags = [NSEvent modifierFlags]; 504 509 SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0); 505 510 } 511 #endif 506 512 } 507 513 508 514 void 509 515 Cocoa_StartTextInput(_THIS) 516 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 510 517 { @autoreleasepool 518 #endif 511 519 { 512 520 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 521 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 522 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 523 #endif 513 524 SDL_Window *window = SDL_GetKeyboardFocus(); 514 525 NSWindow *nswindow = nil; 515 526 if (window) { … … 534 545 [parentView addSubview: data->fieldEdit]; 535 546 [nswindow makeFirstResponder: data->fieldEdit]; 536 547 } 548 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 537 549 }} 550 #else 551 [pool release]; 552 } 553 #endif 538 554 539 555 void 540 556 Cocoa_StopTextInput(_THIS) 557 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 541 558 { @autoreleasepool 559 #endif 542 560 { 543 561 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 544 562 545 563 if (data && data->fieldEdit) { 564 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 565 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 566 #endif 546 567 [data->fieldEdit removeFromSuperview]; 547 568 [data->fieldEdit release]; 548 569 data->fieldEdit = nil; 570 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 571 [pool release]; 572 #endif 549 573 } 574 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 550 575 }} 576 #else 577 } 578 #endif 551 579 552 580 void 553 581 Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) -
src/video/cocoa/SDL_cocoamessagebox.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoamessagebox.m SDL2-2.0.4/src/video/cocoa/SDL_cocoamessagebox.m
old new 79 79 /* Display a Cocoa message box */ 80 80 int 81 81 Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) 82 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 82 83 { @autoreleasepool 84 #endif 83 85 { 84 86 Cocoa_RegisterApp(); 85 87 88 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 89 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 90 #endif 86 91 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 87 92 88 93 if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { … … 124 129 returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked); 125 130 } 126 131 132 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 133 [pool release]; 134 #endif 127 135 return returnValue; 136 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 128 137 }} 138 #else 139 } 140 #endif 129 141 130 142 #endif /* SDL_VIDEO_DRIVER_COCOA */ 131 143 -
src/video/cocoa/SDL_cocoamodes.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.4/src/video/cocoa/SDL_cocoamodes.m
old new 70 70 #if FORCE_OLD_API 71 71 return NO; 72 72 #else 73 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 73 74 return floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5; 75 #else 76 return NO; 77 #endif 74 78 #endif 75 79 } 76 80 … … 132 136 } 133 137 data->moderef = moderef; 134 138 139 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 135 140 if (IS_SNOW_LEOPARD_OR_LATER()) { 136 141 CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef; 137 142 CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode); … … 154 159 155 160 CFRelease(fmt); 156 161 } 162 #endif 157 163 158 164 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 159 165 if (!IS_SNOW_LEOPARD_OR_LATER()) { … … 206 212 static void 207 213 Cocoa_ReleaseDisplayMode(_THIS, const void *moderef) 208 214 { 215 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 209 216 if (IS_SNOW_LEOPARD_OR_LATER()) { 210 217 CGDisplayModeRelease((CGDisplayModeRef) moderef); /* NULL is ok */ 211 218 } 219 #endif 212 220 } 213 221 214 222 static void 215 223 Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist) 216 224 { 225 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 217 226 if (IS_SNOW_LEOPARD_OR_LATER()) { 218 227 CFRelease(modelist); /* NULL is ok */ 219 228 } 229 #endif 220 230 } 221 231 222 232 static const char * … … 235 245 236 246 void 237 247 Cocoa_InitModes(_THIS) 248 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 238 249 { @autoreleasepool 239 250 { 251 #else 252 { 253 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 254 #endif 240 255 CGDisplayErr result; 241 256 CGDirectDisplayID *displays; 242 257 CGDisplayCount numDisplays; … … 245 260 result = CGGetOnlineDisplayList(0, NULL, &numDisplays); 246 261 if (result != kCGErrorSuccess) { 247 262 CG_SetError("CGGetOnlineDisplayList()", result); 263 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 264 [pool release]; 265 #endif 248 266 return; 249 267 } 250 268 displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); … … 252 270 if (result != kCGErrorSuccess) { 253 271 CG_SetError("CGGetOnlineDisplayList()", result); 254 272 SDL_stack_free(displays); 273 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 274 [pool release]; 275 #endif 255 276 return; 256 277 } 257 278 … … 278 299 continue; 279 300 } 280 301 302 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 281 303 if (IS_SNOW_LEOPARD_OR_LATER()) { 282 304 moderef = CGDisplayCopyDisplayMode(displays[i]); 283 305 } 306 #endif 284 307 285 308 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 286 309 if (!IS_SNOW_LEOPARD_OR_LATER()) { … … 322 345 } 323 346 } 324 347 SDL_stack_free(displays); 348 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 349 [pool release]; 350 } 351 #else 325 352 }} 353 #endif 326 354 327 355 int 328 356 Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) … … 344 372 SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; 345 373 CFArrayRef modes = NULL; 346 374 375 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 347 376 if (IS_SNOW_LEOPARD_OR_LATER()) { 348 377 modes = CGDisplayCopyAllDisplayModes(data->display, NULL); 349 378 } 379 #endif 350 380 351 381 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 352 382 if (!IS_SNOW_LEOPARD_OR_LATER()) { … … 365 395 const void *moderef = CFArrayGetValueAtIndex(modes, i); 366 396 SDL_DisplayMode mode; 367 397 if (GetDisplayMode(_this, moderef, link, &mode)) { 398 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 368 399 if (IS_SNOW_LEOPARD_OR_LATER()) { 369 400 CGDisplayModeRetain((CGDisplayModeRef) moderef); 370 401 } 402 #endif 371 403 SDL_AddDisplayMode(display, &mode); 372 404 } 373 405 } … … 380 412 static CGError 381 413 Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode) 382 414 { 415 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 383 416 if (IS_SNOW_LEOPARD_OR_LATER()) { 384 417 return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL); 385 418 } 419 #endif 386 420 387 421 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 388 422 if (!IS_SNOW_LEOPARD_OR_LATER()) { -
src/video/cocoa/SDL_cocoamouse.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoamouse.m SDL2-2.0.4/src/video/cocoa/SDL_cocoamouse.m
old new 66 66 67 67 static SDL_Cursor * 68 68 Cocoa_CreateDefaultCursor() 69 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 69 70 { @autoreleasepool 70 71 { 72 #else 73 { 74 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 75 #endif 71 76 NSCursor *nscursor; 72 77 SDL_Cursor *cursor = NULL; 73 78 … … 81 86 } 82 87 } 83 88 89 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 90 [pool release]; 91 #endif 84 92 return cursor; 93 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 85 94 }} 95 #else 96 } 97 #endif 86 98 87 99 static SDL_Cursor * 88 100 Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) 101 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 89 102 { @autoreleasepool 90 103 { 104 #else 105 { 106 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 107 #endif 91 108 NSImage *nsimage; 92 109 NSCursor *nscursor = NULL; 93 110 SDL_Cursor *cursor = NULL; … … 106 123 } 107 124 } 108 125 126 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 127 [pool release]; 128 #endif 109 129 return cursor; 130 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 110 131 }} 132 #else 133 } 134 #endif 111 135 112 136 static SDL_Cursor * 113 137 Cocoa_CreateSystemCursor(SDL_SystemCursor id) 138 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 114 139 { @autoreleasepool 115 140 { 141 #else 142 { 143 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 144 #endif 116 145 NSCursor *nscursor = NULL; 117 146 SDL_Cursor *cursor = NULL; 118 147 … … 165 194 } 166 195 } 167 196 197 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 198 [pool release]; 199 #endif 168 200 return cursor; 201 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 169 202 }} 203 #else 204 } 205 #endif 170 206 171 207 static void 172 208 Cocoa_FreeCursor(SDL_Cursor * cursor) 209 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 173 210 { @autoreleasepool 174 211 { 212 #else 213 { 214 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 215 #endif 175 216 NSCursor *nscursor = (NSCursor *)cursor->driverdata; 176 217 177 218 [nscursor release]; 178 219 SDL_free(cursor); 220 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 179 221 }} 222 #else 223 [pool release]; 224 } 225 #endif 180 226 181 227 static int 182 228 Cocoa_ShowCursor(SDL_Cursor * cursor) 229 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 183 230 { @autoreleasepool 184 231 { 232 #else 233 { 234 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 235 #endif 185 236 SDL_VideoDevice *device = SDL_GetVideoDevice(); 186 237 SDL_Window *window = (device ? device->windows : NULL); 187 238 for (; window != NULL; window = window->next) { … … 192 243 waitUntilDone:NO]; 193 244 } 194 245 } 246 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 247 [pool release]; 248 #endif 195 249 return 0; 250 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 196 251 }} 252 #else 253 } 254 #endif 197 255 198 256 static SDL_Window * 199 257 SDL_FindWindowAtPoint(const int x, const int y) -
src/video/cocoa/SDL_cocoaopengl.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.4/src/video/cocoa/SDL_cocoaopengl.m
old new 150 150 151 151 SDL_GLContext 152 152 Cocoa_GL_CreateContext(_THIS, SDL_Window * window) 153 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 153 154 { @autoreleasepool 154 155 { 156 #else 157 { 158 NSAutoreleasePool *pool; 159 #endif 155 160 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); 156 161 SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; 162 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1670 157 163 SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 164 #else 165 SDL_bool lion_or_later = SDL_FALSE; 166 #endif 158 167 NSOpenGLPixelFormatAttribute attr[32]; 159 168 NSOpenGLPixelFormat *fmt; 160 169 SDLOpenGLContext *context; … … 173 182 return NULL; 174 183 } 175 184 185 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 186 pool = [[NSAutoreleasePool alloc] init]; 187 #endif 176 188 /* specify a profile if we're on Lion (10.7) or later. */ 189 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 177 190 if (lion_or_later) { 178 191 NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; 179 192 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { … … 182 195 attr[i++] = NSOpenGLPFAOpenGLProfile; 183 196 attr[i++] = profile; 184 197 } 198 #endif 185 199 186 200 attr[i++] = NSOpenGLPFAColorSize; 187 201 attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; … … 237 251 fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr]; 238 252 if (fmt == nil) { 239 253 SDL_SetError("Failed creating OpenGL pixel format"); 254 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 255 [pool release]; 256 #endif 240 257 return NULL; 241 258 } 242 259 … … 250 267 251 268 if (context == nil) { 252 269 SDL_SetError("Failed creating OpenGL context"); 270 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 271 [pool release]; 272 #endif 253 273 return NULL; 254 274 } 255 275 256 276 if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { 257 277 Cocoa_GL_DeleteContext(_this, context); 258 278 SDL_SetError("Failed making OpenGL context current"); 279 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 280 [pool release]; 281 #endif 259 282 return NULL; 260 283 } 261 284 … … 270 293 if (!glGetStringFunc) { 271 294 Cocoa_GL_DeleteContext(_this, context); 272 295 SDL_SetError ("Failed getting OpenGL glGetString entry point"); 296 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 297 [pool release]; 298 #endif 273 299 return NULL; 274 300 } 275 301 … … 277 303 if (glversion == NULL) { 278 304 Cocoa_GL_DeleteContext(_this, context); 279 305 SDL_SetError ("Failed getting OpenGL context version"); 306 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 307 [pool release]; 308 #endif 280 309 return NULL; 281 310 } 282 311 283 312 if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { 284 313 Cocoa_GL_DeleteContext(_this, context); 285 314 SDL_SetError ("Failed parsing OpenGL context version"); 315 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 316 [pool release]; 317 #endif 286 318 return NULL; 287 319 } 288 320 … … 290 322 ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { 291 323 Cocoa_GL_DeleteContext(_this, context); 292 324 SDL_SetError ("Failed creating OpenGL context at version requested"); 325 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 326 [pool release]; 327 #endif 293 328 return NULL; 294 329 } 295 330 … … 299 334 /*_this->gl_config.major_version = glversion_major;*/ 300 335 /*_this->gl_config.minor_version = glversion_minor;*/ 301 336 } 337 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 338 [pool release]; 339 #endif 302 340 return context; 341 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 342 } 343 #else 303 344 }} 345 #endif 304 346 305 347 int 306 348 Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 349 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 307 350 { @autoreleasepool 308 351 { 352 #else 353 { 354 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 355 #endif 309 356 if (context) { 310 357 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 311 358 [nscontext setWindow:window]; … … 315 362 [NSOpenGLContext clearCurrentContext]; 316 363 } 317 364 365 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 366 [pool release]; 367 #endif 318 368 return 0; 369 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 319 370 }} 371 #else 372 } 373 #endif 320 374 321 375 void 322 376 Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) … … 327 381 328 382 /* This gives us the correct viewport for a Retina-enabled view, only 329 383 * supported on 10.7+. */ 384 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 330 385 if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { 331 386 viewport = [contentView convertRectToBacking:viewport]; 332 387 } 388 #endif 333 389 334 390 if (w) { 335 391 *w = viewport.size.width; … … 342 398 343 399 int 344 400 Cocoa_GL_SetSwapInterval(_THIS, int interval) 401 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 345 402 { @autoreleasepool 403 #endif 346 404 { 347 405 NSOpenGLContext *nscontext; 348 406 GLint value; … … 351 409 if (interval < 0) { /* no extension for this on Mac OS X at the moment. */ 352 410 return SDL_SetError("Late swap tearing currently unsupported"); 353 411 } 412 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 413 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 414 #endif 354 415 355 416 nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); 356 417 if (nscontext != nil) { … … 361 422 status = SDL_SetError("No current OpenGL context"); 362 423 } 363 424 425 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 426 [pool release]; 427 #endif 364 428 return status; 429 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 365 430 }} 431 #else 432 } 433 #endif 366 434 367 435 int 368 436 Cocoa_GL_GetSwapInterval(_THIS) 437 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 369 438 { @autoreleasepool 370 439 { 440 #else 441 { 442 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 443 #endif 371 444 NSOpenGLContext *nscontext; 372 445 GLint value; 373 446 int status = 0; … … 378 451 status = (int)value; 379 452 } 380 453 454 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 455 [pool release]; 456 #endif 381 457 return status; 458 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 382 459 }} 460 #else 461 } 462 #endif 383 463 384 464 void 385 465 Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) 466 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 386 467 { @autoreleasepool 387 468 { 469 #else 470 { 471 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 472 #endif 388 473 SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); 389 474 [nscontext flushBuffer]; 390 475 [nscontext updateIfNeeded]; 476 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 391 477 }} 478 #else 479 [pool release]; 480 } 481 #endif 392 482 393 483 void 394 484 Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) 485 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 395 486 { @autoreleasepool 396 487 { 488 #else 489 { 490 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 491 #endif 397 492 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 398 493 399 494 [nscontext setWindow:NULL]; 400 495 [nscontext release]; 496 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 401 497 }} 498 #else 499 [pool release]; 500 } 501 #endif 402 502 403 503 #endif /* SDL_VIDEO_OPENGL_CGL */ 404 504 -
src/video/cocoa/SDL_cocoashape.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoashape.m SDL2-2.0.4/src/video/cocoa/SDL_cocoashape.m
old new 75 75 76 76 int 77 77 Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode) 78 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 78 79 { @autoreleasepool 79 80 { 81 #else 82 { 83 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 84 #endif 80 85 SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata; 81 86 SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata; 82 87 SDL_CocoaClosure closure; … … 99 104 SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); 100 105 [closure.path addClip]; 101 106 107 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 108 [pool release]; 109 #endif 102 110 return 0; 111 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 103 112 }} 113 #else 114 } 115 #endif 104 116 105 117 int 106 118 Cocoa_ResizeWindowShape(SDL_Window *window) -
src/video/cocoa/SDL_cocoavideo.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoavideo.m SDL2-2.0.4/src/video/cocoa/SDL_cocoavideo.m
old new 22 22 23 23 #if SDL_VIDEO_DRIVER_COCOA 24 24 25 #if defined(__APPLE__) && defined(__POWERPC__) && !defined(__APPLE_ALTIVEC__) 26 #include <altivec.h> 27 #undef bool 28 #undef vector 29 #undef pixel 30 #endif 31 25 32 #include "SDL.h" 26 33 #include "SDL_endian.h" 27 34 #include "SDL_cocoavideo.h" … … 147 154 Cocoa_InitMouse(_this); 148 155 149 156 const char *hint = SDL_GetHint(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES); 157 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 150 158 data->allow_spaces = ( (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && (!hint || (*hint != '0')) ); 151 159 152 160 /* The IOPM assertion API can disable the screensaver as of 10.7. */ 153 161 data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 162 #else 163 data->allow_spaces = 0; 164 data->screensaver_use_iopm = 0; 165 #endif 154 166 155 167 return 0; 156 168 } -
src/video/cocoa/SDL_cocoawindow.h
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.4/src/video/cocoa/SDL_cocoawindow.h
old new 35 35 PENDING_OPERATION_MINIMIZE 36 36 } PendingWindowOperation; 37 37 38 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 38 39 @interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> { 40 #else 41 @interface Cocoa_WindowListener : NSResponder { 42 #endif 39 43 SDL_WindowData *_data; 40 44 BOOL observingVisible; 41 45 BOOL wasCtrlLeft; … … 75 79 -(void) windowDidEnterFullScreen:(NSNotification *) aNotification; 76 80 -(void) windowWillExitFullScreen:(NSNotification *) aNotification; 77 81 -(void) windowDidExitFullScreen:(NSNotification *) aNotification; 82 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 78 83 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions; 84 #endif 79 85 80 86 /* See if event is in a drag area, toggle on window dragging. */ 81 87 -(BOOL) processHitTest:(NSEvent *)theEvent; … … 98 104 -(void) touchesCancelledWithEvent:(NSEvent *) theEvent; 99 105 100 106 /* Touch event handling */ 107 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 101 108 -(void) handleTouches:(NSTouchPhase) phase withEvent:(NSEvent*) theEvent; 109 #else 110 typedef enum { 111 COCOA_TOUCH_DOWN, 112 COCOA_TOUCH_UP, 113 COCOA_TOUCH_MOVE, 114 COCOA_TOUCH_CANCELLED 115 } cocoaTouchType; 116 -(void) handleTouches:(cocoaTouchType)type withEvent:(NSEvent*) event; 117 #endif 102 118 103 119 @end 104 120 /* *INDENT-ON* */ -
src/video/cocoa/SDL_cocoawindow.m
diff -ru SDL2-2.0.4-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.4/src/video/cocoa/SDL_cocoawindow.m
old new 23 23 #if SDL_VIDEO_DRIVER_COCOA 24 24 25 25 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 26 #if 0 26 27 # error SDL for Mac OS X must be built with a 10.7 SDK or above. 28 #endif 27 29 #endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */ 28 30 29 31 #include "SDL_syswm.h" … … 53 55 #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) 54 56 55 57 58 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 59 @interface SDLWindow : NSWindow 60 #else 56 61 @interface SDLWindow : NSWindow <NSDraggingDestination> 62 #endif 57 63 /* These are needed for borderless/fullscreen windows */ 58 64 - (BOOL)canBecomeKeyWindow; 59 65 - (BOOL)canBecomeMainWindow; … … 114 120 } 115 121 116 122 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 123 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 117 124 { @autoreleasepool 118 125 { 126 #else 127 { 128 NSAutoreleasePool *pool; 129 #endif 119 130 NSPasteboard *pasteboard = [sender draggingPasteboard]; 120 131 NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; 121 132 NSString *desiredType = [pasteboard availableTypeFromArray:types]; … … 128 139 return NO; 129 140 } 130 141 142 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 143 pool = [[NSAutoreleasePool alloc] init]; 144 #endif 131 145 SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]); 132 146 NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; 133 147 134 148 for (NSString *path in array) { 135 149 NSURL *fileURL = [[NSURL fileURLWithPath:path] autorelease]; 150 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 136 151 NSNumber *isAlias = nil; 137 152 138 153 /* Functionality for resolving URL aliases was added with OS X 10.6. */ … … 156 171 } 157 172 } 158 173 } 174 #endif 159 175 160 176 if (!SDL_SendDropFile([[fileURL path] UTF8String])) { 177 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 178 [pool release]; 179 #endif 161 180 return NO; 162 181 } 163 182 } 164 183 184 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 185 [pool release]; 186 #endif 165 187 return YES; 188 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 189 } 190 #else 166 191 }} 192 #endif 167 193 168 194 - (BOOL)wantsPeriodicDraggingUpdates 169 195 { … … 277 303 [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; 278 304 [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window]; 279 305 [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; 306 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 280 307 [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; 281 308 [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; 282 309 [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; 283 310 [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; 284 311 [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; 312 #endif 285 313 [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 286 314 [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 287 315 } else { … … 302 330 303 331 [view setNextResponder:self]; 304 332 333 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 305 334 if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) { 306 335 [view setAcceptsTouchEvents:YES]; 307 336 } 337 #endif 308 338 } 309 339 310 340 - (void)observeValueForKeyPath:(NSString *)keyPath … … 374 404 inFullscreenTransition = YES; 375 405 376 406 /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */ 407 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 377 408 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 409 #endif 378 410 [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO]; 379 411 return YES; 380 412 } … … 410 442 [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; 411 443 [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window]; 412 444 [center removeObserver:self name:NSWindowDidResignKeyNotification object:window]; 445 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 413 446 [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; 414 447 [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; 415 448 [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; 416 449 [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; 417 450 [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; 451 #endif 418 452 [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 419 453 [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 420 454 } else { … … 589 623 [NSMenu setMenuBarVisible:NO]; 590 624 } 591 625 626 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 592 627 /* On pre-10.6, you might have the capslock key state wrong now because we can't check here. */ 593 628 if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_6) { 594 629 const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; 595 630 _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; 596 631 SDL_ToggleModState(KMOD_CAPS, newflags != 0); 597 632 } 633 #endif 598 634 } 599 635 600 636 - (void)windowDidResignKey:(NSNotification *)aNotification … … 621 657 622 658 - (void)windowDidChangeBackingProperties:(NSNotification *)aNotification 623 659 { 660 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 624 661 NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; 625 662 626 663 if (inFullscreenTransition) { … … 633 670 _data->window->h = 0; 634 671 [self windowDidResize:aNotification]; 635 672 } 673 #endif 636 674 } 637 675 638 676 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification … … 733 771 [nswindow miniaturize:nil]; 734 772 } else { 735 773 /* Adjust the fullscreen toggle button and readd menu now that we're here. */ 774 #if MAC_OS_X_VERSION_MIN_REQUIRED > 1070 736 775 if (window->flags & SDL_WINDOW_RESIZABLE) { 737 776 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 738 777 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 739 778 } else { 740 779 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; 741 780 } 781 #endif 742 782 [NSMenu setMenuBarVisible:YES]; 743 783 744 784 pendingWindowOperation = PENDING_OPERATION_NONE; … … 756 796 } 757 797 } 758 798 799 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 759 800 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions 760 801 { 761 802 if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { … … 764 805 return proposedOptions; 765 806 } 766 807 } 808 #endif 767 809 768 810 769 811 /* We'll respond to key events by doing nothing so we don't beep. … … 993 1035 994 1036 - (void)touchesBeganWithEvent:(NSEvent *) theEvent 995 1037 { 1038 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 996 1039 NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; 997 1040 int existingTouchCount = 0; 998 1041 … … 1013 1056 1014 1057 DLog("Began Fingers: %lu .. existing: %d", (unsigned long)[touches count], existingTouchCount); 1015 1058 [self handleTouches:NSTouchPhaseBegan withEvent:theEvent]; 1059 #endif 1016 1060 } 1017 1061 1018 1062 - (void)touchesMovedWithEvent:(NSEvent *) theEvent 1019 1063 { 1064 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1020 1065 [self handleTouches:NSTouchPhaseMoved withEvent:theEvent]; 1066 #endif 1021 1067 } 1022 1068 1023 1069 - (void)touchesEndedWithEvent:(NSEvent *) theEvent 1024 1070 { 1071 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1025 1072 [self handleTouches:NSTouchPhaseEnded withEvent:theEvent]; 1073 #endif 1026 1074 } 1027 1075 1028 1076 - (void)touchesCancelledWithEvent:(NSEvent *) theEvent 1029 1077 { 1078 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1030 1079 [self handleTouches:NSTouchPhaseCancelled withEvent:theEvent]; 1080 #endif 1031 1081 } 1032 1082 1083 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1084 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1033 1085 - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent 1086 #else 1087 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event 1088 #endif 1034 1089 { 1090 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1091 NSSet *touches = 0; 1092 NSEnumerator *enumerator; 1093 NSTouch *touch; 1094 1095 switch (type) { 1096 case COCOA_TOUCH_DOWN: 1097 touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:nil]; 1098 break; 1099 case COCOA_TOUCH_UP: 1100 touches = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil]; 1101 break; 1102 case COCOA_TOUCH_CANCELLED: 1103 touches = [event touchesMatchingPhase:NSTouchPhaseCancelled inView:nil]; 1104 break; 1105 case COCOA_TOUCH_MOVE: 1106 touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:nil]; 1107 break; 1108 } 1109 1110 enumerator = [touches objectEnumerator]; 1111 touch = (NSTouch*)[enumerator nextObject]; 1112 while (touch) { 1113 const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; 1114 if (!SDL_GetTouch(touchId)) { 1115 if (SDL_AddTouch(touchId, "") < 0) { 1116 return; 1117 } 1118 } 1119 1120 const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; 1121 float x = [touch normalizedPosition].x; 1122 float y = [touch normalizedPosition].y; 1123 /* Make the origin the upper left instead of the lower left */ 1124 y = 1.0f - y; 1125 1126 switch (type) { 1127 case COCOA_TOUCH_DOWN: 1128 SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f); 1129 break; 1130 case COCOA_TOUCH_UP: 1131 case COCOA_TOUCH_CANCELLED: 1132 SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f); 1133 break; 1134 case COCOA_TOUCH_MOVE: 1135 SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f); 1136 break; 1137 } 1138 1139 touch = (NSTouch*)[enumerator nextObject]; 1140 } 1141 #else 1035 1142 NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; 1036 1143 1037 1144 for (NSTouch *touch in touches) { … … 1061 1168 break; 1062 1169 } 1063 1170 } 1171 #endif 1064 1172 } 1173 #endif 1065 1174 1066 1175 @end 1067 1176 … … 1118 1227 1119 1228 static int 1120 1229 SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) 1230 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1121 1231 { @autoreleasepool 1122 1232 { 1233 #else 1234 { 1235 NSAutoreleasePool *pool; 1236 #endif 1123 1237 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1124 1238 SDL_WindowData *data; 1125 1239 … … 1134 1248 data->videodata = videodata; 1135 1249 data->nscontexts = [[NSMutableArray alloc] init]; 1136 1250 1251 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1252 pool = [[NSAutoreleasePool alloc] init]; 1253 #endif 1137 1254 /* Create an event listener for the window */ 1138 1255 data->listener = [[Cocoa_WindowListener alloc] init]; 1139 1256 … … 1194 1311 */ 1195 1312 [nswindow setOneShot:NO]; 1196 1313 1314 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1315 [pool release]; 1316 #endif 1197 1317 /* All done! */ 1198 1318 window->driverdata = data; 1199 1319 return 0; 1320 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1321 } 1322 #else 1200 1323 }} 1324 #endif 1201 1325 1202 1326 int 1203 1327 Cocoa_CreateWindow(_THIS, SDL_Window * window) 1328 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1204 1329 { @autoreleasepool 1205 1330 { 1331 #else 1332 { 1333 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1334 #endif 1206 1335 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1207 1336 NSWindow *nswindow; 1208 1337 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); … … 1243 1372 [nswindow setBackgroundColor:[NSColor blackColor]]; 1244 1373 1245 1374 if (videodata->allow_spaces) { 1375 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1246 1376 SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); 1247 1377 SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); 1248 1378 /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ … … 1250 1380 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 1251 1381 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 1252 1382 } 1383 #endif 1253 1384 } 1254 1385 1255 1386 /* Create a default view for this window */ … … 1268 1399 1269 1400 /* Allow files and folders to be dragged onto the window by users */ 1270 1401 [nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; 1402 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1403 [pool release]; 1404 #endif 1271 1405 1272 1406 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { 1273 1407 [nswindow release]; 1274 1408 return -1; 1275 1409 } 1276 1410 return 0; 1411 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1277 1412 }} 1413 #else 1414 } 1415 #endif 1278 1416 1279 1417 int 1280 1418 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 1419 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1281 1420 { @autoreleasepool 1282 1421 { 1422 #else 1423 { 1424 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1425 #endif 1283 1426 NSWindow *nswindow = (NSWindow *) data; 1284 1427 NSString *title; 1285 1428 … … 1290 1433 } 1291 1434 1292 1435 return SetupWindowData(_this, window, nswindow, SDL_FALSE); 1436 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1293 1437 }} 1438 #else 1439 [pool release]; 1440 } 1441 #endif 1294 1442 1295 1443 void 1296 1444 Cocoa_SetWindowTitle(_THIS, SDL_Window * window) 1445 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1297 1446 { @autoreleasepool 1298 1447 { 1448 #else 1449 { 1450 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1451 #endif 1299 1452 const char *title = window->title ? window->title : ""; 1300 1453 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1301 1454 NSString *string = [[NSString alloc] initWithUTF8String:title]; 1302 1455 [nswindow setTitle:string]; 1303 1456 [string release]; 1457 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1304 1458 }} 1459 #else 1460 [pool release]; 1461 } 1462 #endif 1305 1463 1306 1464 void 1307 1465 Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 1466 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1308 1467 { @autoreleasepool 1309 1468 { 1469 #else 1470 { 1471 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1472 #endif 1310 1473 NSImage *nsimage = Cocoa_CreateImage(icon); 1311 1474 1312 1475 if (nsimage) { 1313 1476 [NSApp setApplicationIconImage:nsimage]; 1314 1477 } 1478 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1315 1479 }} 1480 #else 1481 [pool release]; 1482 } 1483 #endif 1316 1484 1317 1485 void 1318 1486 Cocoa_SetWindowPosition(_THIS, SDL_Window * window) 1487 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1319 1488 { @autoreleasepool 1320 1489 { 1490 #else 1491 { 1492 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1493 #endif 1321 1494 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1322 1495 NSWindow *nswindow = windata->nswindow; 1323 1496 NSRect rect; … … 1335 1508 s_moveHack = moveHack; 1336 1509 1337 1510 ScheduleContextUpdates(windata); 1511 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1338 1512 }} 1513 #else 1514 [pool release]; 1515 } 1516 #endif 1339 1517 1340 1518 void 1341 1519 Cocoa_SetWindowSize(_THIS, SDL_Window * window) 1520 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1342 1521 { @autoreleasepool 1343 1522 { 1523 #else 1524 { 1525 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1526 #endif 1344 1527 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1345 1528 NSWindow *nswindow = windata->nswindow; 1346 1529 NSRect rect; … … 1362 1545 s_moveHack = moveHack; 1363 1546 1364 1547 ScheduleContextUpdates(windata); 1548 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1365 1549 }} 1550 #else 1551 [pool release]; 1552 } 1553 #endif 1366 1554 1367 1555 void 1368 1556 Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) 1557 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1369 1558 { @autoreleasepool 1370 1559 { 1560 #else 1561 { 1562 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1563 #endif 1371 1564 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1372 1565 1373 1566 NSSize minSize; … … 1375 1568 minSize.height = window->min_h; 1376 1569 1377 1570 [windata->nswindow setContentMinSize:minSize]; 1571 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1378 1572 }} 1573 #else 1574 [pool release]; 1575 } 1576 #endif 1379 1577 1380 1578 void 1381 1579 Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) 1580 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1382 1581 { @autoreleasepool 1383 1582 { 1583 #else 1584 { 1585 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1586 #endif 1384 1587 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1385 1588 1386 1589 NSSize maxSize; … … 1388 1591 maxSize.height = window->max_h; 1389 1592 1390 1593 [windata->nswindow setContentMaxSize:maxSize]; 1594 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1391 1595 }} 1596 #else 1597 [pool release]; 1598 } 1599 #endif 1392 1600 1393 1601 void 1394 1602 Cocoa_ShowWindow(_THIS, SDL_Window * window) 1603 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1395 1604 { @autoreleasepool 1396 1605 { 1606 #else 1607 { 1608 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1609 #endif 1397 1610 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1398 1611 NSWindow *nswindow = windowData->nswindow; 1399 1612 … … 1402 1615 [nswindow makeKeyAndOrderFront:nil]; 1403 1616 [windowData->listener resumeVisibleObservation]; 1404 1617 } 1618 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1405 1619 }} 1620 #else 1621 [pool release]; 1622 } 1623 #endif 1406 1624 1407 1625 void 1408 1626 Cocoa_HideWindow(_THIS, SDL_Window * window) 1627 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1409 1628 { @autoreleasepool 1410 1629 { 1630 #else 1631 { 1632 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1633 #endif 1411 1634 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1412 1635 1413 1636 [nswindow orderOut:nil]; 1637 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1414 1638 }} 1639 #else 1640 [pool release]; 1641 } 1642 #endif 1415 1643 1416 1644 void 1417 1645 Cocoa_RaiseWindow(_THIS, SDL_Window * window) 1646 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1418 1647 { @autoreleasepool 1419 1648 { 1649 #else 1650 { 1651 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1652 #endif 1420 1653 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1421 1654 NSWindow *nswindow = windowData->nswindow; 1422 1655 … … 1429 1662 [nswindow makeKeyAndOrderFront:nil]; 1430 1663 } 1431 1664 [windowData->listener resumeVisibleObservation]; 1665 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1432 1666 }} 1667 #else 1668 [pool release]; 1669 } 1670 #endif 1433 1671 1434 1672 void 1435 1673 Cocoa_MaximizeWindow(_THIS, SDL_Window * window) 1674 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1436 1675 { @autoreleasepool 1437 1676 { 1677 #else 1678 { 1679 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1680 #endif 1438 1681 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1439 1682 NSWindow *nswindow = windata->nswindow; 1440 1683 1441 1684 [nswindow zoom:nil]; 1442 1685 1443 1686 ScheduleContextUpdates(windata); 1687 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1444 1688 }} 1689 #else 1690 [pool release]; 1691 } 1692 #endif 1445 1693 1446 1694 void 1447 1695 Cocoa_MinimizeWindow(_THIS, SDL_Window * window) 1696 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1448 1697 { @autoreleasepool 1449 1698 { 1699 #else 1700 { 1701 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1702 #endif 1450 1703 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1451 1704 NSWindow *nswindow = data->nswindow; 1452 1705 … … 1455 1708 } else { 1456 1709 [nswindow miniaturize:nil]; 1457 1710 } 1711 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1458 1712 }} 1713 #else 1714 [pool release]; 1715 } 1716 #endif 1459 1717 1460 1718 void 1461 1719 Cocoa_RestoreWindow(_THIS, SDL_Window * window) 1720 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1462 1721 { @autoreleasepool 1463 1722 { 1723 #else 1724 { 1725 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1726 #endif 1464 1727 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1465 1728 1466 1729 if ([nswindow isMiniaturized]) { … … 1468 1731 } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) { 1469 1732 [nswindow zoom:nil]; 1470 1733 } 1734 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1471 1735 }} 1736 #else 1737 [pool release]; 1738 } 1739 #endif 1472 1740 1473 1741 static NSWindow * 1474 1742 Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style) … … 1493 1761 1494 1762 void 1495 1763 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) 1764 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1496 1765 { @autoreleasepool 1497 1766 { 1767 #else 1768 { 1769 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1770 #endif 1498 1771 if (SetWindowStyle(window, GetWindowStyle(window))) { 1499 1772 if (bordered) { 1500 1773 Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */ 1501 1774 } 1502 1775 } 1776 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1503 1777 }} 1778 #else 1779 [pool release]; 1780 } 1781 #endif 1504 1782 1505 1783 1506 1784 void 1507 1785 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) 1786 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1508 1787 { @autoreleasepool 1509 1788 { 1789 #else 1790 { 1791 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1792 #endif 1510 1793 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1511 1794 NSWindow *nswindow = data->nswindow; 1512 1795 NSRect rect; … … 1585 1868 } 1586 1869 1587 1870 ScheduleContextUpdates(data); 1871 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1588 1872 }} 1873 #else 1874 [pool release]; 1875 } 1876 #endif 1589 1877 1590 1878 int 1591 1879 Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) … … 1670 1958 1671 1959 void 1672 1960 Cocoa_DestroyWindow(_THIS, SDL_Window * window) 1961 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1673 1962 { @autoreleasepool 1674 1963 { 1964 #else 1965 { 1966 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1967 #endif 1675 1968 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1676 1969 1677 1970 if (data) { … … 1694 1987 SDL_free(data); 1695 1988 } 1696 1989 window->driverdata = NULL; 1990 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1697 1991 }} 1992 #else 1993 [pool release]; 1994 } 1995 #endif 1698 1996 1699 1997 SDL_bool 1700 1998 Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) … … 1726 2024 1727 2025 SDL_bool 1728 2026 Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) 2027 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1729 2028 { @autoreleasepool 1730 2029 { 2030 #else 2031 { 2032 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2033 #endif 1731 2034 SDL_bool succeeded = SDL_FALSE; 1732 2035 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1733 2036 … … 1758 2061 succeeded = SDL_TRUE; 1759 2062 } 1760 2063 2064 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 2065 [pool release]; 2066 #endif 1761 2067 return succeeded; 2068 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1762 2069 }} 2070 #else 2071 } 2072 #endif 1763 2073 1764 2074 int 1765 2075 Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)