Ticket #52210: SDL2-2.0.5_OSX_105.patch
File SDL2-2.0.5_OSX_105.patch, 69.5 KB (added by miniupnp (Thomas BERNARD), 6 years ago) |
---|
-
include/SDL_config.h
Only in SDL2-2.0.5: Makefile Only in SDL2-2.0.5: Makefile.rules Only in SDL2-2.0.5: build Only in SDL2-2.0.5: config.log Only in SDL2-2.0.5: config.status diff -ru SDL2-2.0.5-orig/include/SDL_config.h SDL2-2.0.5/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 63 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 /* #undef HAVE_FCITX_FRONTEND_H */ 50 87 51 #ifdef USING_GENERATED_CONFIG_H 52 #error Wrong SDL_config.h, check your include path? 88 /* C library functions */ 89 #define HAVE_MALLOC 1 90 #define HAVE_CALLOC 1 91 #define HAVE_REALLOC 1 92 #define HAVE_FREE 1 93 #define HAVE_ALLOCA 1 94 #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ 95 #define HAVE_GETENV 1 96 #define HAVE_SETENV 1 97 #define HAVE_PUTENV 1 98 #define HAVE_UNSETENV 1 53 99 #endif 100 #define HAVE_QSORT 1 101 #define HAVE_ABS 1 102 #define HAVE_BCOPY 1 103 #define HAVE_MEMSET 1 104 #define HAVE_MEMCPY 1 105 #define HAVE_MEMMOVE 1 106 #define HAVE_MEMCMP 1 107 #define HAVE_STRLEN 1 108 #define HAVE_STRLCPY 1 109 #define HAVE_STRLCAT 1 110 #define HAVE_STRDUP 1 111 /* #undef HAVE__STRREV */ 112 /* #undef HAVE__STRUPR */ 113 /* #undef HAVE__STRLWR */ 114 /* #undef HAVE_INDEX */ 115 /* #undef HAVE_RINDEX */ 116 #define HAVE_STRCHR 1 117 #define HAVE_STRRCHR 1 118 #define HAVE_STRSTR 1 119 /* #undef HAVE_ITOA */ 120 /* #undef HAVE__LTOA */ 121 /* #undef HAVE__UITOA */ 122 /* #undef HAVE__ULTOA */ 123 #define HAVE_STRTOL 1 124 #define HAVE_STRTOUL 1 125 /* #undef HAVE__I64TOA */ 126 /* #undef HAVE__UI64TOA */ 127 #define HAVE_STRTOLL 1 128 #define HAVE_STRTOULL 1 129 #define HAVE_STRTOD 1 130 #define HAVE_ATOI 1 131 #define HAVE_ATOF 1 132 #define HAVE_STRCMP 1 133 #define HAVE_STRNCMP 1 134 /* #undef HAVE__STRICMP */ 135 #define HAVE_STRCASECMP 1 136 /* #undef HAVE__STRNICMP */ 137 #define HAVE_STRNCASECMP 1 138 /* #undef HAVE_SSCANF */ 139 #define HAVE_VSSCANF 1 140 /* #undef HAVE_SNPRINTF */ 141 #define HAVE_VSNPRINTF 1 142 #define HAVE_M_PI /**/ 143 #define HAVE_ATAN 1 144 #define HAVE_ATAN2 1 145 #define HAVE_ACOS 1 146 #define HAVE_ASIN 1 147 #define HAVE_CEIL 1 148 #define HAVE_COPYSIGN 1 149 #define HAVE_COS 1 150 #define HAVE_COSF 1 151 #define HAVE_FABS 1 152 #define HAVE_FLOOR 1 153 #define HAVE_LOG 1 154 #define HAVE_POW 1 155 #define HAVE_SCALBN 1 156 #define HAVE_SIN 1 157 #define HAVE_SINF 1 158 #define HAVE_SQRT 1 159 #define HAVE_SQRTF 1 160 #define HAVE_TAN 1 161 #define HAVE_TANF 1 162 #define HAVE_FSEEKO 1 163 /* #undef HAVE_FSEEKO64 */ 164 #define HAVE_SIGACTION 1 165 #define HAVE_SA_SIGACTION 1 166 #define HAVE_SETJMP 1 167 #define HAVE_NANOSLEEP 1 168 #define HAVE_SYSCONF 1 169 #define HAVE_SYSCTLBYNAME 1 170 /* #undef HAVE_CLOCK_GETTIME */ 171 /* #undef HAVE_GETPAGESIZE */ 172 #define HAVE_MPROTECT 1 173 #define HAVE_ICONV 1 174 /* #undef HAVE_PTHREAD_SETNAME_NP */ 175 /* #undef HAVE_PTHREAD_SET_NAME_NP */ 176 /* #undef HAVE_SEM_TIMEDWAIT */ 177 178 #else 179 #define HAVE_STDARG_H 1 180 #define HAVE_STDDEF_H 1 181 #define HAVE_STDINT_H 1 182 #endif /* HAVE_LIBC */ 183 184 /* SDL internal assertion support */ 185 /* #undef SDL_DEFAULT_ASSERT_LEVEL */ 186 187 /* Allow disabling of core subsystems */ 188 /* #undef SDL_ATOMIC_DISABLED */ 189 /* #undef SDL_AUDIO_DISABLED */ 190 /* #undef SDL_CPUINFO_DISABLED */ 191 /* #undef SDL_EVENTS_DISABLED */ 192 /* #undef SDL_FILE_DISABLED */ 193 /* #undef SDL_JOYSTICK_DISABLED */ 194 /* #undef SDL_HAPTIC_DISABLED */ 195 /* #undef SDL_LOADSO_DISABLED */ 196 /* #undef SDL_RENDER_DISABLED */ 197 /* #undef SDL_THREADS_DISABLED */ 198 /* #undef SDL_TIMERS_DISABLED */ 199 /* #undef SDL_VIDEO_DISABLED */ 200 /* #undef SDL_POWER_DISABLED */ 201 /* #undef SDL_FILESYSTEM_DISABLED */ 202 203 /* Enable various audio drivers */ 204 /* #undef SDL_AUDIO_DRIVER_ALSA */ 205 /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ 206 /* #undef SDL_AUDIO_DRIVER_ARTS */ 207 /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ 208 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ 209 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ 210 /* #undef SDL_AUDIO_DRIVER_HAIKU */ 211 /* #undef SDL_AUDIO_DRIVER_BSD */ 212 #define SDL_AUDIO_DRIVER_COREAUDIO 1 213 #define SDL_AUDIO_DRIVER_DISK 1 214 #define SDL_AUDIO_DRIVER_DUMMY 1 215 /* #undef SDL_AUDIO_DRIVER_ANDROID */ 216 /* #undef SDL_AUDIO_DRIVER_XAUDIO2 */ 217 /* #undef SDL_AUDIO_DRIVER_DSOUND */ 218 /* #undef SDL_AUDIO_DRIVER_ESD */ 219 /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ 220 /* #undef SDL_AUDIO_DRIVER_NACL */ 221 /* #undef SDL_AUDIO_DRIVER_NAS */ 222 /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ 223 /* #undef SDL_AUDIO_DRIVER_SNDIO */ 224 /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ 225 /* #undef SDL_AUDIO_DRIVER_OSS */ 226 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ 227 /* #undef SDL_AUDIO_DRIVER_PAUDIO */ 228 /* #undef SDL_AUDIO_DRIVER_QSA */ 229 /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ 230 /* #undef SDL_AUDIO_DRIVER_WINMM */ 231 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ 232 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ 233 /* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */ 234 235 /* Enable various input drivers */ 236 /* #undef SDL_INPUT_LINUXEV */ 237 /* #undef SDL_INPUT_LINUXKD */ 238 /* #undef SDL_INPUT_TSLIB */ 239 /* #undef SDL_JOYSTICK_HAIKU */ 240 /* #undef SDL_JOYSTICK_DINPUT */ 241 /* #undef SDL_JOYSTICK_XINPUT */ 242 /* #undef SDL_JOYSTICK_DUMMY */ 243 #define SDL_JOYSTICK_IOKIT 1 244 /* #undef SDL_JOYSTICK_LINUX */ 245 /* #undef SDL_JOYSTICK_ANDROID */ 246 /* #undef SDL_JOYSTICK_WINMM */ 247 /* #undef SDL_JOYSTICK_USBHID */ 248 /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ 249 /* #undef SDL_JOYSTICK_EMSCRIPTEN */ 250 /* #undef SDL_HAPTIC_DUMMY */ 251 /* #undef SDL_HAPTIC_LINUX */ 252 #define SDL_HAPTIC_IOKIT 1 253 /* #undef SDL_HAPTIC_DINPUT */ 254 /* #undef SDL_HAPTIC_XINPUT */ 255 256 /* Enable various shared object loading systems */ 257 /* #undef SDL_LOADSO_HAIKU */ 258 #define SDL_LOADSO_DLOPEN 1 259 /* #undef SDL_LOADSO_DUMMY */ 260 /* #undef SDL_LOADSO_LDG */ 261 /* #undef SDL_LOADSO_WINDOWS */ 262 263 /* Enable various threading systems */ 264 #define SDL_THREAD_PTHREAD 1 265 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 266 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ 267 /* #undef SDL_THREAD_WINDOWS */ 268 269 /* Enable various timer systems */ 270 /* #undef SDL_TIMER_HAIKU */ 271 /* #undef SDL_TIMER_DUMMY */ 272 #define SDL_TIMER_UNIX 1 273 /* #undef SDL_TIMER_WINDOWS */ 274 275 /* Enable various video drivers */ 276 /* #undef SDL_VIDEO_DRIVER_HAIKU */ 277 #define SDL_VIDEO_DRIVER_COCOA 1 278 /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ 279 /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ 280 #define SDL_VIDEO_DRIVER_DUMMY 1 281 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ 282 /* #undef SDL_VIDEO_DRIVER_WAYLAND */ 283 /* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ 284 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ 285 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ 286 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ 287 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ 288 /* #undef SDL_VIDEO_DRIVER_MIR */ 289 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */ 290 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */ 291 #define SDL_VIDEO_DRIVER_X11 1 292 /* #undef SDL_VIDEO_DRIVER_RPI */ 293 /* #undef SDL_VIDEO_DRIVER_ANDROID */ 294 /* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */ 295 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 296 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 297 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "/usr/X11R6/lib/libXcursor.1.dylib" 298 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" 299 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */ 300 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */ 301 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" 302 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" 303 #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 304 #define SDL_VIDEO_DRIVER_X11_XDBE 1 305 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 306 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */ 307 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ 308 /* #undef SDL_VIDEO_DRIVER_X11_XRANDR */ 309 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 310 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 311 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 312 /* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */ 313 /* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */ 314 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 315 /* #undef SDL_VIDEO_DRIVER_NACL */ 316 /* #undef SDL_VIDEO_DRIVER_VIVANTE */ 317 /* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */ 318 319 /* #undef SDL_VIDEO_RENDER_D3D */ 320 /* #undef SDL_VIDEO_RENDER_D3D11 */ 321 #define SDL_VIDEO_RENDER_OGL 1 322 /* #undef SDL_VIDEO_RENDER_OGL_ES */ 323 /* #undef SDL_VIDEO_RENDER_OGL_ES2 */ 324 /* #undef SDL_VIDEO_RENDER_DIRECTFB */ 325 326 /* Enable OpenGL support */ 327 #define SDL_VIDEO_OPENGL 1 328 /* #undef SDL_VIDEO_OPENGL_ES */ 329 /* #undef SDL_VIDEO_OPENGL_ES2 */ 330 /* #undef SDL_VIDEO_OPENGL_BGL */ 331 #define SDL_VIDEO_OPENGL_CGL 1 332 /* #undef SDL_VIDEO_OPENGL_EGL */ 333 #define SDL_VIDEO_OPENGL_GLX 1 334 /* #undef SDL_VIDEO_OPENGL_WGL */ 335 /* #undef SDL_VIDEO_OPENGL_OSMESA */ 336 /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ 337 338 /* Enable system power support */ 339 /* #undef SDL_POWER_LINUX */ 340 /* #undef SDL_POWER_WINDOWS */ 341 #define SDL_POWER_MACOSX 1 342 /* #undef SDL_POWER_HAIKU */ 343 /* #undef SDL_POWER_ANDROID */ 344 /* #undef SDL_POWER_EMSCRIPTEN */ 345 /* #undef SDL_POWER_HARDWIRED */ 346 347 /* Enable system filesystem support */ 348 /* #undef SDL_FILESYSTEM_HAIKU */ 349 #define SDL_FILESYSTEM_COCOA 1 350 /* #undef SDL_FILESYSTEM_DUMMY */ 351 /* #undef SDL_FILESYSTEM_UNIX */ 352 /* #undef SDL_FILESYSTEM_WINDOWS */ 353 /* #undef SDL_FILESYSTEM_NACL */ 354 /* #undef SDL_FILESYSTEM_ANDROID */ 355 /* #undef SDL_FILESYSTEM_EMSCRIPTEN */ 356 357 /* Enable assembly routines */ 358 #define SDL_ASSEMBLY_ROUTINES 1 359 #define SDL_ALTIVEC_BLITTERS 1 360 361 /* Enable ime support */ 362 /* #undef SDL_USE_IME */ 54 363 55 364 #endif /* _SDL_config_h */ -
include/SDL_platform.h
diff -ru SDL2-2.0.5-orig/include/SDL_platform.h SDL2-2.0.5/include/SDL_platform.h
old new 84 84 #undef __MACOSX__ 85 85 #define __MACOSX__ 1 86 86 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 87 #if 0 87 88 # error SDL for Mac OS X only supports deploying on 10.6 and above. 89 #endif 88 90 #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ 89 91 #endif /* TARGET_OS_IPHONE */ 90 92 #endif /* defined(__APPLE__) */ -
include/SDL_syswm.h
diff -ru SDL2-2.0.5-orig/include/SDL_syswm.h SDL2-2.0.5/include/SDL_syswm.h
old new 227 227 #if defined(SDL_VIDEO_DRIVER_COCOA) 228 228 struct 229 229 { 230 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 230 231 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 231 232 NSWindow __unsafe_unretained *window; /* The Cocoa window */ 232 233 #else 233 234 NSWindow *window; /* The Cocoa window */ 234 235 #endif 236 #else 237 NSWindow *window; /* The Cocoa window */ 238 #endif 235 239 } cocoa; 236 240 #endif 237 241 #if defined(SDL_VIDEO_DRIVER_UIKIT) 238 242 struct 239 243 { 244 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 240 245 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 241 246 UIWindow __unsafe_unretained *window; /* The UIKit window */ 242 247 #else 243 248 UIWindow *window; /* The UIKit window */ 244 249 #endif 250 #else 251 UIWindow *window; /* The UIKit window */ 252 #endif 245 253 GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ 246 254 GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ 247 255 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.5: libtool Only in SDL2-2.0.5: sdl2-config Only in SDL2-2.0.5: sdl2-config.cmake Only in SDL2-2.0.5: sdl2.pc diff -ru SDL2-2.0.5-orig/src/atomic/SDL_spinlock.c SDL2-2.0.5/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.5-orig/src/file/cocoa/SDL_rwopsbundlesupport.m SDL2-2.0.5/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.5-orig/src/filesystem/cocoa/SDL_sysfilesystem.m SDL2-2.0.5/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.5-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.5/src/joystick/darwin/SDL_sysjoystick.c
old new 436 436 device->instance_id = ++s_joystick_instance_id; 437 437 438 438 /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */ 439 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 439 440 ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); 441 #else 442 ioservice = 0; 443 #endif 440 444 #if SDL_HAPTIC_IOKIT 441 445 if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { 442 446 device->ffservice = ioservice; -
src/video/cocoa/SDL_cocoaclipboard.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.5/src/video/cocoa/SDL_cocoaclipboard.m
old new 25 25 #include "SDL_cocoavideo.h" 26 26 #include "../../events/SDL_clipboardevents_c.h" 27 27 28 static NSString * 29 GetTextFormat(_THIS) 30 { 31 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 32 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) { 33 return NSPasteboardTypeString; 34 } else { 35 #endif 36 return NSStringPboardType; 37 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 38 } 39 #endif 40 } 41 28 42 int 29 43 Cocoa_SetClipboardText(_THIS, const char *text) 44 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 30 45 { @autoreleasepool 31 46 { 47 #else 48 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 49 #endif 32 50 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 33 51 NSPasteboard *pasteboard; 52 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 34 53 NSString *format = NSPasteboardTypeString; 54 #else 55 NSString *format = GetTextFormat(_this); 56 #endif 35 57 36 58 pasteboard = [NSPasteboard generalPasteboard]; 37 59 data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; 38 60 [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; 39 61 62 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 63 [pool release]; 64 #endif 40 65 return 0; 66 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 41 67 }} 68 #else 69 } 70 #endif 42 71 43 72 char * 44 73 Cocoa_GetClipboardText(_THIS) 74 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 45 75 { @autoreleasepool 46 76 { 77 #else 78 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 79 #endif 47 80 NSPasteboard *pasteboard; 81 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 48 82 NSString *format = NSPasteboardTypeString; 83 #else 84 NSString *format = GetTextFormat(_this); 85 #endif 49 86 NSString *available; 50 87 char *text; 51 88 … … 66 103 text = SDL_strdup(""); 67 104 } 68 105 106 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 107 [pool release]; 108 #endif 69 109 return text; 110 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 70 111 }} 112 #else 113 } 114 #endif 71 115 72 116 SDL_bool 73 117 Cocoa_HasClipboardText(_THIS) … … 83 127 84 128 void 85 129 Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) 130 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 86 131 { @autoreleasepool 87 132 { 133 #else 134 { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 135 #endif 88 136 NSPasteboard *pasteboard; 89 137 NSInteger count; 90 138 … … 96 144 } 97 145 data->clipboard_count = count; 98 146 } 147 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 99 148 }} 149 #else 150 [pool release]; 151 } 152 #endif 100 153 101 154 #endif /* SDL_VIDEO_DRIVER_COCOA */ 102 155 -
src/video/cocoa/SDL_cocoaevents.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoaevents.m SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m
old new 97 97 - (void)setAppleMenu:(NSMenu *)menu; 98 98 @end 99 99 100 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 100 101 @interface SDLAppDelegate : NSObject <NSApplicationDelegate> { 102 #else 103 @interface SDLAppDelegate : NSObject { 104 #endif 101 105 @public 102 106 BOOL seenFirstActivate; 103 107 } … … 157 161 */ 158 162 for (NSWindow *window in [NSApp orderedWindows]) { 159 163 if (window != win && [window canBecomeKeyWindow]) { 160 if (![window isOnActiveSpace]) { 161 continue; 164 if ([window respondsToSelector:@selector(isOnActiveSpace)]) { 165 if (![window isOnActiveSpace]) { 166 continue; 167 } 162 168 } 163 169 [window makeKeyAndOrderFront:self]; 164 170 return; … … 328 334 [windowMenu release]; 329 335 330 336 337 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 331 338 /* Add the fullscreen view toggle menu option, if supported */ 332 339 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { 333 340 /* Create the view menu */ … … 345 352 346 353 [viewMenu release]; 347 354 } 355 #endif 348 356 } 349 357 350 358 void 351 359 Cocoa_RegisterApp(void) 360 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 352 361 { @autoreleasepool 353 362 { 363 #else 364 { 365 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 366 #endif 354 367 /* This can get called more than once! Be careful what you initialize! */ 355 368 356 369 if (NSApp == nil) { … … 360 373 s_bShouldHandleEventsInSDLApplication = SDL_TRUE; 361 374 362 375 if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { 376 #if defined(MAC_OS_X_VERSION_10_6) 377 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6 363 378 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; 379 #endif 380 #endif 364 381 [NSApp activateIgnoringOtherApps:YES]; 365 382 } 366 383 … … 388 405 appDelegate->seenFirstActivate = YES; 389 406 } 390 407 } 408 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 391 409 }} 410 #else 411 [pool release]; 412 } 413 #endif 392 414 393 415 void 394 416 Cocoa_PumpEvents(_THIS) 417 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 395 418 { @autoreleasepool 396 419 { 420 #else 421 { 422 NSAutoreleasePool *pool; 423 #endif 397 424 /* Update activity every 30 seconds to prevent screensaver */ 398 425 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; 399 426 if (_this->suspend_screensaver && !data->screensaver_use_iopm) { … … 405 432 } 406 433 } 407 434 435 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 436 pool = [[NSAutoreleasePool alloc] init]; 437 #endif 408 438 for ( ; ; ) { 409 439 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 410 440 if ( event == nil ) { … … 418 448 // Pass events down to SDLApplication to be handled in sendEvent: 419 449 [NSApp sendEvent:event]; 420 450 } 451 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 421 452 }} 453 #else 454 [pool release]; 455 } 456 #endif 422 457 423 458 void 424 459 Cocoa_SuspendScreenSaver(_THIS) 460 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 425 461 { @autoreleasepool 426 462 { 427 463 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 448 484 &data->screensaver_assertion); 449 485 } 450 486 }} 487 #else 488 { 489 } 490 #endif 451 491 452 492 #endif /* SDL_VIDEO_DRIVER_COCOA */ 453 493 -
src/video/cocoa/SDL_cocoakeyboard.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoakeyboard.m SDL2-2.0.5/src/video/cocoa/SDL_cocoakeyboard.m
old new 143 143 aRange.location, aRange.length, windowHeight, 144 144 NSStringFromRect(rect)); 145 145 146 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 146 147 if ([window respondsToSelector:@selector(convertRectToScreen:)]) { 147 148 rect = [window convertRectToScreen:rect]; 148 149 } else { 150 #endif 149 151 rect.origin = [window convertBaseToScreen:rect.origin]; 152 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 150 153 } 154 #endif 151 155 152 156 return rect; 153 157 } … … 588 592 589 593 void 590 594 Cocoa_StartTextInput(_THIS) 595 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 591 596 { @autoreleasepool 592 597 { 598 #else 599 { 600 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 601 #endif 593 602 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 594 603 SDL_Window *window = SDL_GetKeyboardFocus(); 595 604 NSWindow *nswindow = nil; … … 615 624 [parentView addSubview: data->fieldEdit]; 616 625 [nswindow makeFirstResponder: data->fieldEdit]; 617 626 } 627 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 618 628 }} 629 #else 630 [pool release]; 631 } 632 #endif 619 633 620 634 void 621 635 Cocoa_StopTextInput(_THIS) 636 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 622 637 { @autoreleasepool 638 #endif 623 639 { 624 640 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 625 641 626 642 if (data && data->fieldEdit) { 643 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 644 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 645 #endif 627 646 [data->fieldEdit removeFromSuperview]; 628 647 [data->fieldEdit release]; 629 648 data->fieldEdit = nil; 649 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 650 [pool release]; 651 #endif 630 652 } 653 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 631 654 }} 655 #else 656 } 657 #endif 632 658 633 659 void 634 660 Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) -
src/video/cocoa/SDL_cocoamessagebox.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoamessagebox.m SDL2-2.0.5/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.h
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoamodes.h SDL2-2.0.5/src/video/cocoa/SDL_cocoamodes.h
old new 30 30 31 31 typedef struct 32 32 { 33 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 33 34 CGDisplayModeRef moderef; 35 #else 36 const void *moderef; 37 #endif 34 38 } SDL_DisplayModeData; 35 39 36 40 extern void Cocoa_InitModes(_THIS); -
src/video/cocoa/SDL_cocoamodes.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.5/src/video/cocoa/SDL_cocoamodes.m
old new 100 100 } 101 101 102 102 static SDL_bool 103 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 103 104 GetDisplayMode(_THIS, CGDisplayModeRef vidmode, CVDisplayLinkRef link, SDL_DisplayMode *mode) 105 #else 106 GetDisplayMode(_THIS, const void *moderef, CVDisplayLinkRef link, SDL_DisplayMode *mode) 107 #endif 104 108 { 105 109 SDL_DisplayModeData *data; 110 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 106 111 int width = 0; 107 112 int height = 0; 108 113 int bpp = 0; 109 114 int refreshRate = 0; 110 115 CFStringRef fmt; 116 #else 117 long width = 0; 118 long height = 0; 119 long bpp = 0; 120 long refreshRate = 0; 121 #endif 111 122 112 123 data = (SDL_DisplayModeData *) SDL_malloc(sizeof(*data)); 113 124 if (!data) { 114 125 return SDL_FALSE; 115 126 } 127 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 116 128 data->moderef = vidmode; 129 #else 130 data->moderef = moderef; 131 #endif 117 132 133 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 118 134 fmt = CGDisplayModeCopyPixelEncoding(vidmode); 119 135 width = (int) CGDisplayModeGetWidth(vidmode); 120 136 height = (int) CGDisplayModeGetHeight(vidmode); … … 134 150 } 135 151 136 152 CFRelease(fmt); 153 #else 154 { 155 CFNumberRef number; 156 double refresh; 157 CFDictionaryRef vidmode = (CFDictionaryRef) moderef; 158 number = CFDictionaryGetValue(vidmode, kCGDisplayWidth); 159 CFNumberGetValue(number, kCFNumberLongType, &width); 160 number = CFDictionaryGetValue(vidmode, kCGDisplayHeight); 161 CFNumberGetValue(number, kCFNumberLongType, &height); 162 number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel); 163 CFNumberGetValue(number, kCFNumberLongType, &bpp); 164 number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate); 165 CFNumberGetValue(number, kCFNumberDoubleType, &refresh); 166 refreshRate = (long) (refresh + 0.5); 167 } 168 #endif 137 169 138 170 /* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */ 139 171 if (refreshRate == 0 && link != NULL) { … … 182 214 183 215 void 184 216 Cocoa_InitModes(_THIS) 217 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 185 218 { @autoreleasepool 186 219 { 220 #else 221 { 222 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 223 #endif 187 224 CGDisplayErr result; 188 225 CGDirectDisplayID *displays; 189 226 CGDisplayCount numDisplays; … … 192 229 result = CGGetOnlineDisplayList(0, NULL, &numDisplays); 193 230 if (result != kCGErrorSuccess) { 194 231 CG_SetError("CGGetOnlineDisplayList()", result); 232 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 233 [pool release]; 234 #endif 195 235 return; 196 236 } 197 237 displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); … … 199 239 if (result != kCGErrorSuccess) { 200 240 CG_SetError("CGGetOnlineDisplayList()", result); 201 241 SDL_stack_free(displays); 242 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 243 [pool release]; 244 #endif 202 245 return; 203 246 } 204 247 … … 208 251 SDL_VideoDisplay display; 209 252 SDL_DisplayData *displaydata; 210 253 SDL_DisplayMode mode; 254 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 211 255 CGDisplayModeRef moderef = NULL; 256 #else 257 const void *moderef = NULL; 258 #endif 212 259 CVDisplayLinkRef link = NULL; 213 260 214 261 if (pass == 0) { … … 225 272 continue; 226 273 } 227 274 275 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 228 276 moderef = CGDisplayCopyDisplayMode(displays[i]); 277 #else 278 moderef = CGDisplayCurrentMode(displays[i]); 279 #endif 229 280 230 281 if (!moderef) { 231 282 continue; … … 233 284 234 285 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); 235 286 if (!displaydata) { 287 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 236 288 CGDisplayModeRelease(moderef); 289 #endif 237 290 continue; 238 291 } 239 292 displaydata->display = displays[i]; … … 245 298 display.name = (char *)Cocoa_GetDisplayName(displays[i]); 246 299 if (!GetDisplayMode(_this, moderef, link, &mode)) { 247 300 CVDisplayLinkRelease(link); 301 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 248 302 CGDisplayModeRelease(moderef); 303 #endif 249 304 SDL_free(display.name); 250 305 SDL_free(displaydata); 251 306 continue; … … 261 316 } 262 317 } 263 318 SDL_stack_free(displays); 319 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 320 [pool release]; 321 } 322 #else 264 323 }} 324 #endif 265 325 266 326 int 267 327 Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) … … 340 400 Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) 341 401 { 342 402 SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; 403 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 343 404 CFArrayRef modes = CGDisplayCopyAllDisplayModes(data->display, NULL); 405 #else 406 CFArrayRef modes = CGDisplayAvailableModes(data->display); 407 #endif 344 408 345 409 if (modes) { 346 410 CVDisplayLinkRef link = NULL; … … 350 414 CVDisplayLinkCreateWithCGDisplay(data->display, &link); 351 415 352 416 for (i = 0; i < count; i++) { 417 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 353 418 CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); 419 #else 420 const void *moderef = CFArrayGetValueAtIndex(modes, i); 421 #endif 354 422 SDL_DisplayMode mode; 355 423 if (GetDisplayMode(_this, moderef, link, &mode)) { 424 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 356 425 CGDisplayModeRetain(moderef); 426 #endif 357 427 SDL_AddDisplayMode(display, &mode); 358 428 } 359 429 } … … 378 448 379 449 if (data == display->desktop_mode.driverdata) { 380 450 /* Restoring desktop mode */ 451 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 381 452 CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 453 #else 454 CGDisplaySwitchToMode(displaydata->display, data->moderef); 455 #endif 382 456 383 457 if (CGDisplayIsMain(displaydata->display)) { 384 458 CGReleaseAllDisplays(); … … 403 477 } 404 478 405 479 /* Do the physical switch */ 480 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 406 481 result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 482 #else 483 result = CGDisplaySwitchToMode(displaydata->display, data->moderef); 484 #endif 407 485 if (result != kCGErrorSuccess) { 408 486 CG_SetError("CGDisplaySwitchToMode()", result); 409 487 goto ERR_NO_SWITCH; … … 448 526 } 449 527 450 528 mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata; 529 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 451 530 CGDisplayModeRelease(mode->moderef); 531 #endif 452 532 453 533 for (j = 0; j < display->num_display_modes; j++) { 454 534 mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata; 535 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 455 536 CGDisplayModeRelease(mode->moderef); 537 #endif 456 538 } 457 539 458 540 } -
src/video/cocoa/SDL_cocoamouse.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoamouse.m SDL2-2.0.5/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.5-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.5/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; … … 175 184 176 185 attr[i++] = NSOpenGLPFAAllowOfflineRenderers; 177 186 187 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 188 pool = [[NSAutoreleasePool alloc] init]; 189 #endif 178 190 /* specify a profile if we're on Lion (10.7) or later. */ 191 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 179 192 if (lion_or_later) { 180 193 NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; 181 194 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { … … 184 197 attr[i++] = NSOpenGLPFAOpenGLProfile; 185 198 attr[i++] = profile; 186 199 } 200 #endif 187 201 188 202 attr[i++] = NSOpenGLPFAColorSize; 189 203 attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; … … 239 253 fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr]; 240 254 if (fmt == nil) { 241 255 SDL_SetError("Failed creating OpenGL pixel format"); 256 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 257 [pool release]; 258 #endif 242 259 return NULL; 243 260 } 244 261 … … 252 269 253 270 if (context == nil) { 254 271 SDL_SetError("Failed creating OpenGL context"); 272 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 273 [pool release]; 274 #endif 255 275 return NULL; 256 276 } 257 277 258 278 if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { 259 279 Cocoa_GL_DeleteContext(_this, context); 260 280 SDL_SetError("Failed making OpenGL context current"); 281 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 282 [pool release]; 283 #endif 261 284 return NULL; 262 285 } 263 286 … … 272 295 if (!glGetStringFunc) { 273 296 Cocoa_GL_DeleteContext(_this, context); 274 297 SDL_SetError ("Failed getting OpenGL glGetString entry point"); 298 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 299 [pool release]; 300 #endif 275 301 return NULL; 276 302 } 277 303 … … 279 305 if (glversion == NULL) { 280 306 Cocoa_GL_DeleteContext(_this, context); 281 307 SDL_SetError ("Failed getting OpenGL context version"); 308 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 309 [pool release]; 310 #endif 282 311 return NULL; 283 312 } 284 313 285 314 if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { 286 315 Cocoa_GL_DeleteContext(_this, context); 287 316 SDL_SetError ("Failed parsing OpenGL context version"); 317 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 318 [pool release]; 319 #endif 288 320 return NULL; 289 321 } 290 322 … … 292 324 ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { 293 325 Cocoa_GL_DeleteContext(_this, context); 294 326 SDL_SetError ("Failed creating OpenGL context at version requested"); 327 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 328 [pool release]; 329 #endif 295 330 return NULL; 296 331 } 297 332 … … 301 336 /*_this->gl_config.major_version = glversion_major;*/ 302 337 /*_this->gl_config.minor_version = glversion_minor;*/ 303 338 } 339 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 340 [pool release]; 341 #endif 304 342 return context; 343 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 344 } 345 #else 305 346 }} 347 #endif 306 348 307 349 int 308 350 Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 351 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 309 352 { @autoreleasepool 310 353 { 354 #else 355 { 356 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 357 #endif 311 358 if (context) { 312 359 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 313 360 [nscontext setWindow:window]; … … 317 364 [NSOpenGLContext clearCurrentContext]; 318 365 } 319 366 367 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 368 [pool release]; 369 #endif 320 370 return 0; 371 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 321 372 }} 373 #else 374 } 375 #endif 322 376 323 377 void 324 378 Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) … … 329 383 330 384 /* This gives us the correct viewport for a Retina-enabled view, only 331 385 * supported on 10.7+. */ 386 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 332 387 if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { 333 388 viewport = [contentView convertRectToBacking:viewport]; 334 389 } 390 #endif 335 391 336 392 if (w) { 337 393 *w = viewport.size.width; … … 344 400 345 401 int 346 402 Cocoa_GL_SetSwapInterval(_THIS, int interval) 403 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 347 404 { @autoreleasepool 405 #endif 348 406 { 349 407 NSOpenGLContext *nscontext; 350 408 GLint value; … … 353 411 if (interval < 0) { /* no extension for this on Mac OS X at the moment. */ 354 412 return SDL_SetError("Late swap tearing currently unsupported"); 355 413 } 414 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 415 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 416 #endif 356 417 357 418 nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); 358 419 if (nscontext != nil) { … … 363 424 status = SDL_SetError("No current OpenGL context"); 364 425 } 365 426 427 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 428 [pool release]; 429 #endif 366 430 return status; 431 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 367 432 }} 433 #else 434 } 435 #endif 368 436 369 437 int 370 438 Cocoa_GL_GetSwapInterval(_THIS) 439 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 371 440 { @autoreleasepool 372 441 { 442 #else 443 { 444 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 445 #endif 373 446 NSOpenGLContext *nscontext; 374 447 GLint value; 375 448 int status = 0; … … 380 453 status = (int)value; 381 454 } 382 455 456 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 457 [pool release]; 458 #endif 383 459 return status; 460 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 384 461 }} 462 #else 463 } 464 #endif 385 465 386 466 void 387 467 Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) 468 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 388 469 { @autoreleasepool 389 470 { 471 #else 472 { 473 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 474 #endif 390 475 SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); 391 476 [nscontext flushBuffer]; 392 477 [nscontext updateIfNeeded]; 478 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 393 479 }} 480 #else 481 [pool release]; 482 } 483 #endif 394 484 395 485 void 396 486 Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) 487 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 397 488 { @autoreleasepool 398 489 { 490 #else 491 { 492 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 493 #endif 399 494 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 400 495 401 496 [nscontext setWindow:NULL]; 402 497 [nscontext release]; 498 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 403 499 }} 500 #else 501 [pool release]; 502 } 503 #endif 404 504 405 505 #endif /* SDL_VIDEO_OPENGL_CGL */ 406 506 -
src/video/cocoa/SDL_cocoashape.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoashape.m SDL2-2.0.5/src/video/cocoa/SDL_cocoashape.m
old new 73 73 74 74 int 75 75 Cocoa_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode) 76 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 76 77 { @autoreleasepool 77 78 { 79 #else 80 { 81 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 82 #endif 78 83 SDL_ShapeData* data = (SDL_ShapeData*)shaper->driverdata; 79 84 SDL_WindowData* windata = (SDL_WindowData*)shaper->window->driverdata; 80 85 SDL_CocoaClosure closure; … … 97 102 SDL_TraverseShapeTree(data->shape,&ConvertRects,&closure); 98 103 [closure.path addClip]; 99 104 105 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 106 [pool release]; 107 #endif 100 108 return 0; 109 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 101 110 }} 111 #else 112 } 113 #endif 102 114 103 115 int 104 116 Cocoa_ResizeWindowShape(SDL_Window *window) -
src/video/cocoa/SDL_cocoavideo.m
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoavideo.m SDL2-2.0.5/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" … … 150 157 Cocoa_InitKeyboard(_this); 151 158 Cocoa_InitMouse(_this); 152 159 160 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 153 161 data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); 154 162 155 163 /* The IOPM assertion API can disable the screensaver as of 10.7. */ 156 164 data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 165 #else 166 data->allow_spaces = 0; 167 data->screensaver_use_iopm = 0; 168 #endif 157 169 158 170 return 0; 159 171 } -
src/video/cocoa/SDL_cocoawindow.h
diff -ru SDL2-2.0.5-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.5/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.5-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.5/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 SDL_VideoDevice *_this = SDL_GetVideoDevice(); 120 131 NSPasteboard *pasteboard = [sender draggingPasteboard]; 121 132 NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; … … 131 142 return NO; 132 143 } 133 144 145 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 146 pool = [[NSAutoreleasePool alloc] init]; 147 #endif 148 134 149 SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]); 135 150 NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; 136 151 137 152 for (NSString *path in array) { 138 153 NSURL *fileURL = [NSURL fileURLWithPath:path]; 154 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 139 155 NSNumber *isAlias = nil; 140 156 141 157 [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil]; … … 156 172 } 157 173 } 158 174 } 175 #endif 159 176 160 177 /* !!! FIXME: is there a better way to do this? */ 161 178 if (_this) { … … 168 185 } 169 186 170 187 if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { 188 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 189 [pool release]; 190 #endif 171 191 return NO; 172 192 } 173 193 } 174 194 195 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 196 [pool release]; 197 #endif 175 198 SDL_SendDropComplete(sdlwindow); 176 199 return YES; 200 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 201 } 202 #else 177 203 }} 204 #endif 178 205 179 206 - (BOOL)wantsPeriodicDraggingUpdates 180 207 { … … 284 311 [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; 285 312 [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window]; 286 313 [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; 314 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 287 315 [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; 288 316 [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; 289 317 [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; 290 318 [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; 291 319 [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; 320 #endif 292 321 [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 293 322 [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 294 323 } else { … … 379 408 inFullscreenTransition = YES; 380 409 381 410 /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */ 411 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 382 412 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 413 #endif 383 414 [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO]; 384 415 return YES; 385 416 } … … 415 446 [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; 416 447 [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window]; 417 448 [center removeObserver:self name:NSWindowDidResignKeyNotification object:window]; 449 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 418 450 [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; 419 451 [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; 420 452 [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; 421 453 [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; 422 454 [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; 455 #endif 423 456 [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 424 457 [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 425 458 } else { … … 594 627 [NSMenu setMenuBarVisible:NO]; 595 628 } 596 629 630 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 597 631 const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; 598 632 _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; 599 633 SDL_ToggleModState(KMOD_CAPS, newflags != 0); 634 #endif 600 635 } 601 636 602 637 - (void)windowDidResignKey:(NSNotification *)aNotification … … 623 658 624 659 - (void)windowDidChangeBackingProperties:(NSNotification *)aNotification 625 660 { 661 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 626 662 NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; 627 663 628 664 if (inFullscreenTransition) { … … 635 671 _data->window->h = 0; 636 672 [self windowDidResize:aNotification]; 637 673 } 674 #endif 638 675 } 639 676 640 677 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification … … 735 772 [nswindow miniaturize:nil]; 736 773 } else { 737 774 /* Adjust the fullscreen toggle button and readd menu now that we're here. */ 775 #if MAC_OS_X_VERSION_MIN_REQUIRED > 1070 738 776 if (window->flags & SDL_WINDOW_RESIZABLE) { 739 777 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 740 778 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 741 779 } else { 742 780 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; 743 781 } 782 #endif 744 783 [NSMenu setMenuBarVisible:YES]; 745 784 746 785 pendingWindowOperation = PENDING_OPERATION_NONE; … … 758 797 } 759 798 } 760 799 800 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 761 801 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions 762 802 { 763 803 if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { … … 766 806 return proposedOptions; 767 807 } 768 808 } 809 #endif 769 810 770 811 771 812 /* We'll respond to key events by doing nothing so we don't beep. … … 992 1033 993 1034 - (void)touchesBeganWithEvent:(NSEvent *) theEvent 994 1035 { 1036 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 995 1037 NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; 996 1038 int existingTouchCount = 0; 997 1039 … … 1012 1054 1013 1055 DLog("Began Fingers: %lu .. existing: %d", (unsigned long)[touches count], existingTouchCount); 1014 1056 [self handleTouches:NSTouchPhaseBegan withEvent:theEvent]; 1057 #endif 1015 1058 } 1016 1059 1017 1060 - (void)touchesMovedWithEvent:(NSEvent *) theEvent 1018 1061 { 1062 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1019 1063 [self handleTouches:NSTouchPhaseMoved withEvent:theEvent]; 1064 #endif 1020 1065 } 1021 1066 1022 1067 - (void)touchesEndedWithEvent:(NSEvent *) theEvent 1023 1068 { 1069 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1024 1070 [self handleTouches:NSTouchPhaseEnded withEvent:theEvent]; 1071 #endif 1025 1072 } 1026 1073 1027 1074 - (void)touchesCancelledWithEvent:(NSEvent *) theEvent 1028 1075 { 1076 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1029 1077 [self handleTouches:NSTouchPhaseCancelled withEvent:theEvent]; 1078 #endif 1030 1079 } 1031 1080 1081 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1082 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1032 1083 - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent 1084 #else 1085 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event 1086 #endif 1033 1087 { 1088 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1089 NSSet *touches = 0; 1090 NSEnumerator *enumerator; 1091 NSTouch *touch; 1092 1093 switch (type) { 1094 case COCOA_TOUCH_DOWN: 1095 touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:nil]; 1096 break; 1097 case COCOA_TOUCH_UP: 1098 touches = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil]; 1099 break; 1100 case COCOA_TOUCH_CANCELLED: 1101 touches = [event touchesMatchingPhase:NSTouchPhaseCancelled inView:nil]; 1102 break; 1103 case COCOA_TOUCH_MOVE: 1104 touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:nil]; 1105 break; 1106 } 1107 1108 enumerator = [touches objectEnumerator]; 1109 touch = (NSTouch*)[enumerator nextObject]; 1110 while (touch) { 1111 const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; 1112 if (!SDL_GetTouch(touchId)) { 1113 if (SDL_AddTouch(touchId, "") < 0) { 1114 return; 1115 } 1116 } 1117 1118 const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; 1119 float x = [touch normalizedPosition].x; 1120 float y = [touch normalizedPosition].y; 1121 /* Make the origin the upper left instead of the lower left */ 1122 y = 1.0f - y; 1123 1124 switch (type) { 1125 case COCOA_TOUCH_DOWN: 1126 SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f); 1127 break; 1128 case COCOA_TOUCH_UP: 1129 case COCOA_TOUCH_CANCELLED: 1130 SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f); 1131 break; 1132 case COCOA_TOUCH_MOVE: 1133 SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f); 1134 break; 1135 } 1136 1137 touch = (NSTouch*)[enumerator nextObject]; 1138 } 1139 #else 1034 1140 NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; 1035 1141 1036 1142 for (NSTouch *touch in touches) { … … 1060 1166 break; 1061 1167 } 1062 1168 } 1169 #endif 1063 1170 } 1171 #endif 1064 1172 1065 1173 @end 1066 1174 … … 1127 1235 1128 1236 static int 1129 1237 SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) 1238 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1130 1239 { @autoreleasepool 1131 1240 { 1241 #else 1242 { 1243 NSAutoreleasePool *pool; 1244 #endif 1132 1245 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1133 1246 SDL_WindowData *data; 1134 1247 … … 1143 1256 data->videodata = videodata; 1144 1257 data->nscontexts = [[NSMutableArray alloc] init]; 1145 1258 1259 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1260 pool = [[NSAutoreleasePool alloc] init]; 1261 #endif 1146 1262 /* Create an event listener for the window */ 1147 1263 data->listener = [[Cocoa_WindowListener alloc] init]; 1148 1264 … … 1203 1319 */ 1204 1320 [nswindow setOneShot:NO]; 1205 1321 1322 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1323 [pool release]; 1324 #endif 1206 1325 /* All done! */ 1207 1326 window->driverdata = data; 1208 1327 return 0; 1328 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1329 } 1330 #else 1209 1331 }} 1332 #endif 1210 1333 1211 1334 int 1212 1335 Cocoa_CreateWindow(_THIS, SDL_Window * window) 1336 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1213 1337 { @autoreleasepool 1214 1338 { 1339 #else 1340 { 1341 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1342 #endif 1215 1343 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1216 1344 NSWindow *nswindow; 1217 1345 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); … … 1252 1380 [nswindow setBackgroundColor:[NSColor blackColor]]; 1253 1381 1254 1382 if (videodata->allow_spaces) { 1383 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1255 1384 SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); 1256 1385 SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); 1257 1386 /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ … … 1259 1388 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 1260 1389 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 1261 1390 } 1391 #endif 1262 1392 } 1263 1393 1264 1394 /* Create a default view for this window */ … … 1277 1407 1278 1408 /* Allow files and folders to be dragged onto the window by users */ 1279 1409 [nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; 1410 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1411 [pool release]; 1412 #endif 1280 1413 1281 1414 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { 1282 1415 [nswindow release]; 1283 1416 return -1; 1284 1417 } 1285 1418 return 0; 1419 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1286 1420 }} 1421 #else 1422 } 1423 #endif 1287 1424 1288 1425 int 1289 1426 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 1427 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1290 1428 { @autoreleasepool 1291 1429 { 1430 #else 1431 { 1432 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1433 #endif 1292 1434 NSWindow *nswindow = (NSWindow *) data; 1293 1435 NSString *title; 1294 1436 … … 1299 1441 } 1300 1442 1301 1443 return SetupWindowData(_this, window, nswindow, SDL_FALSE); 1444 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1302 1445 }} 1446 #else 1447 [pool release]; 1448 } 1449 #endif 1303 1450 1304 1451 void 1305 1452 Cocoa_SetWindowTitle(_THIS, SDL_Window * window) 1453 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1306 1454 { @autoreleasepool 1307 1455 { 1456 #else 1457 { 1458 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1459 #endif 1308 1460 const char *title = window->title ? window->title : ""; 1309 1461 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1310 1462 NSString *string = [[NSString alloc] initWithUTF8String:title]; 1311 1463 [nswindow setTitle:string]; 1312 1464 [string release]; 1465 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1313 1466 }} 1467 #else 1468 [pool release]; 1469 } 1470 #endif 1314 1471 1315 1472 void 1316 1473 Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 1474 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1317 1475 { @autoreleasepool 1318 1476 { 1477 #else 1478 { 1479 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1480 #endif 1319 1481 NSImage *nsimage = Cocoa_CreateImage(icon); 1320 1482 1321 1483 if (nsimage) { 1322 1484 [NSApp setApplicationIconImage:nsimage]; 1323 1485 } 1486 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1324 1487 }} 1488 #else 1489 [pool release]; 1490 } 1491 #endif 1325 1492 1326 1493 void 1327 1494 Cocoa_SetWindowPosition(_THIS, SDL_Window * window) 1495 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1328 1496 { @autoreleasepool 1329 1497 { 1498 #else 1499 { 1500 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1501 #endif 1330 1502 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1331 1503 NSWindow *nswindow = windata->nswindow; 1332 1504 NSRect rect; … … 1344 1516 s_moveHack = moveHack; 1345 1517 1346 1518 ScheduleContextUpdates(windata); 1519 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1347 1520 }} 1521 #else 1522 [pool release]; 1523 } 1524 #endif 1348 1525 1349 1526 void 1350 1527 Cocoa_SetWindowSize(_THIS, SDL_Window * window) 1528 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1351 1529 { @autoreleasepool 1352 1530 { 1531 #else 1532 { 1533 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1534 #endif 1353 1535 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1354 1536 NSWindow *nswindow = windata->nswindow; 1355 1537 NSRect rect; … … 1371 1553 s_moveHack = moveHack; 1372 1554 1373 1555 ScheduleContextUpdates(windata); 1556 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1374 1557 }} 1558 #else 1559 [pool release]; 1560 } 1561 #endif 1375 1562 1376 1563 void 1377 1564 Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) 1565 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1378 1566 { @autoreleasepool 1379 1567 { 1568 #else 1569 { 1570 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1571 #endif 1380 1572 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1381 1573 1382 1574 NSSize minSize; … … 1384 1576 minSize.height = window->min_h; 1385 1577 1386 1578 [windata->nswindow setContentMinSize:minSize]; 1579 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1387 1580 }} 1581 #else 1582 [pool release]; 1583 } 1584 #endif 1388 1585 1389 1586 void 1390 1587 Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) 1588 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1391 1589 { @autoreleasepool 1392 1590 { 1591 #else 1592 { 1593 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1594 #endif 1393 1595 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1394 1596 1395 1597 NSSize maxSize; … … 1397 1599 maxSize.height = window->max_h; 1398 1600 1399 1601 [windata->nswindow setContentMaxSize:maxSize]; 1602 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1400 1603 }} 1604 #else 1605 [pool release]; 1606 } 1607 #endif 1401 1608 1402 1609 void 1403 1610 Cocoa_ShowWindow(_THIS, SDL_Window * window) 1611 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1404 1612 { @autoreleasepool 1405 1613 { 1614 #else 1615 { 1616 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1617 #endif 1406 1618 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1407 1619 NSWindow *nswindow = windowData->nswindow; 1408 1620 … … 1411 1623 [nswindow makeKeyAndOrderFront:nil]; 1412 1624 [windowData->listener resumeVisibleObservation]; 1413 1625 } 1626 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1414 1627 }} 1628 #else 1629 [pool release]; 1630 } 1631 #endif 1415 1632 1416 1633 void 1417 1634 Cocoa_HideWindow(_THIS, SDL_Window * window) 1635 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1418 1636 { @autoreleasepool 1419 1637 { 1638 #else 1639 { 1640 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1641 #endif 1420 1642 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1421 1643 1422 1644 [nswindow orderOut:nil]; 1645 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1423 1646 }} 1647 #else 1648 [pool release]; 1649 } 1650 #endif 1424 1651 1425 1652 void 1426 1653 Cocoa_RaiseWindow(_THIS, SDL_Window * window) 1654 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1427 1655 { @autoreleasepool 1428 1656 { 1657 #else 1658 { 1659 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1660 #endif 1429 1661 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1430 1662 NSWindow *nswindow = windowData->nswindow; 1431 1663 … … 1438 1670 [nswindow makeKeyAndOrderFront:nil]; 1439 1671 } 1440 1672 [windowData->listener resumeVisibleObservation]; 1673 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1441 1674 }} 1675 #else 1676 [pool release]; 1677 } 1678 #endif 1442 1679 1443 1680 void 1444 1681 Cocoa_MaximizeWindow(_THIS, SDL_Window * window) 1682 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1445 1683 { @autoreleasepool 1446 1684 { 1685 #else 1686 { 1687 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1688 #endif 1447 1689 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1448 1690 NSWindow *nswindow = windata->nswindow; 1449 1691 1450 1692 [nswindow zoom:nil]; 1451 1693 1452 1694 ScheduleContextUpdates(windata); 1695 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1453 1696 }} 1697 #else 1698 [pool release]; 1699 } 1700 #endif 1454 1701 1455 1702 void 1456 1703 Cocoa_MinimizeWindow(_THIS, SDL_Window * window) 1704 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1457 1705 { @autoreleasepool 1458 1706 { 1707 #else 1708 { 1709 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1710 #endif 1459 1711 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1460 1712 NSWindow *nswindow = data->nswindow; 1461 1713 … … 1464 1716 } else { 1465 1717 [nswindow miniaturize:nil]; 1466 1718 } 1719 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1467 1720 }} 1721 #else 1722 [pool release]; 1723 } 1724 #endif 1468 1725 1469 1726 void 1470 1727 Cocoa_RestoreWindow(_THIS, SDL_Window * window) 1728 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1471 1729 { @autoreleasepool 1472 1730 { 1731 #else 1732 { 1733 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1734 #endif 1473 1735 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1474 1736 1475 1737 if ([nswindow isMiniaturized]) { … … 1477 1739 } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) { 1478 1740 [nswindow zoom:nil]; 1479 1741 } 1742 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1480 1743 }} 1744 #else 1745 [pool release]; 1746 } 1747 #endif 1481 1748 1482 1749 void 1483 1750 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) 1751 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1484 1752 { @autoreleasepool 1485 1753 { 1754 #else 1755 { 1756 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1757 #endif 1486 1758 if (SetWindowStyle(window, GetWindowStyle(window))) { 1487 1759 if (bordered) { 1488 1760 Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */ 1489 1761 } 1490 1762 } 1763 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1491 1764 }} 1765 #else 1766 [pool release]; 1767 } 1768 #endif 1769 1492 1770 1493 1771 void 1494 1772 Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) 1773 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1495 1774 { @autoreleasepool 1496 1775 { 1776 #else 1777 { 1778 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1779 #endif 1497 1780 /* Don't set this if we're in a space! 1498 1781 * The window will get permanently stuck if resizable is false. 1499 1782 * -flibit … … 1503 1786 if (![listener isInFullscreenSpace]) { 1504 1787 SetWindowStyle(window, GetWindowStyle(window)); 1505 1788 } 1789 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1506 1790 }} 1791 #else 1792 [pool release]; 1793 } 1794 #endif 1795 1507 1796 1508 1797 void 1509 1798 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) 1799 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1510 1800 { @autoreleasepool 1511 1801 { 1802 #else 1803 { 1804 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1805 #endif 1512 1806 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1513 1807 NSWindow *nswindow = data->nswindow; 1514 1808 NSRect rect; … … 1579 1873 } 1580 1874 1581 1875 ScheduleContextUpdates(data); 1876 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1582 1877 }} 1878 #else 1879 [pool release]; 1880 } 1881 #endif 1583 1882 1584 1883 int 1585 1884 Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) … … 1664 1963 1665 1964 void 1666 1965 Cocoa_DestroyWindow(_THIS, SDL_Window * window) 1966 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1667 1967 { @autoreleasepool 1668 1968 { 1969 #else 1970 { 1971 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1972 #endif 1669 1973 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1670 1974 1671 1975 if (data) { … … 1688 1992 SDL_free(data); 1689 1993 } 1690 1994 window->driverdata = NULL; 1995 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1691 1996 }} 1997 #else 1998 [pool release]; 1999 } 2000 #endif 1692 2001 1693 2002 SDL_bool 1694 2003 Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) … … 1720 2029 1721 2030 SDL_bool 1722 2031 Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) 2032 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1723 2033 { @autoreleasepool 1724 2034 { 2035 #else 2036 { 2037 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2038 #endif 1725 2039 SDL_bool succeeded = SDL_FALSE; 1726 2040 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1727 2041 … … 1752 2066 succeeded = SDL_TRUE; 1753 2067 } 1754 2068 2069 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 2070 [pool release]; 2071 #endif 1755 2072 return succeeded; 2073 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1756 2074 }} 2075 #else 2076 } 2077 #endif 1757 2078 1758 2079 int 1759 2080 Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)