Ticket #52210: SDL2-2.0.8_OSX_105.patch
File SDL2-2.0.8_OSX_105.patch, 75.4 KB (added by miniupnp (Thomas BERNARD), 6 years ago) |
---|
-
include/SDL_config.h
Only in SDL2-2.0.8: Makefile Only in SDL2-2.0.8: Makefile.rules Only in SDL2-2.0.8: build Only in SDL2-2.0.8: config.log Only in SDL2-2.0.8: config.status diff -ru SDL2-2.0.8-orig/include/SDL_config.h SDL2-2.0.8/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-2018 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 #if defined(__WIN32__) 33 #include "SDL_config_windows.h" 34 #elif defined(__WINRT__) 35 #include "SDL_config_winrt.h" 36 #elif defined(__MACOSX__) 37 #include "SDL_config_macosx.h" 38 #elif defined(__IPHONEOS__) 39 #include "SDL_config_iphoneos.h" 40 #elif defined(__ANDROID__) 41 #include "SDL_config_android.h" 42 #elif defined(__PSP__) 43 #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 44 48 #else 45 /* This is a minimal configuration just to get SDL running on new platforms */ 46 #include "SDL_config_minimal.h" 47 #endif /* platform config */ 49 #define SIZEOF_VOIDP 4 50 #endif 51 /* #undef HAVE_GCC_ATOMICS */ 52 /* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */ 48 53 49 #ifdef USING_GENERATED_CONFIG_H 50 #error Wrong SDL_config.h, check your include path? 54 /* Comment this if you want to build without any C library requirements */ 55 #define HAVE_LIBC 1 56 #if HAVE_LIBC 57 58 /* Useful headers */ 59 #define STDC_HEADERS 1 60 #define HAVE_ALLOCA_H 1 61 #define HAVE_CTYPE_H 1 62 #define HAVE_FLOAT_H 1 63 #define HAVE_ICONV_H 1 64 #define HAVE_INTTYPES_H 1 65 #define HAVE_LIMITS_H 1 66 /* #undef HAVE_MALLOC_H */ 67 #define HAVE_MATH_H 1 68 #define HAVE_MEMORY_H 1 69 #define HAVE_SIGNAL_H 1 70 #define HAVE_STDARG_H 1 71 #define HAVE_STDINT_H 1 72 #define HAVE_STDIO_H 1 73 #define HAVE_STDLIB_H 1 74 #define HAVE_STRINGS_H 1 75 #define HAVE_STRING_H 1 76 #define HAVE_SYS_TYPES_H 1 77 #define HAVE_WCHAR_H 1 78 /* #undef HAVE_PTHREAD_NP_H */ 79 /* #undef HAVE_LIBUNWIND_H */ 80 81 /* C library functions */ 82 #define HAVE_MALLOC 1 83 #define HAVE_CALLOC 1 84 #define HAVE_REALLOC 1 85 #define HAVE_FREE 1 86 #define HAVE_ALLOCA 1 87 #ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ 88 #define HAVE_GETENV 1 89 #define HAVE_SETENV 1 90 #define HAVE_PUTENV 1 91 #define HAVE_UNSETENV 1 51 92 #endif 93 #define HAVE_QSORT 1 94 #define HAVE_ABS 1 95 #define HAVE_BCOPY 1 96 #define HAVE_MEMSET 1 97 #define HAVE_MEMCPY 1 98 #define HAVE_MEMMOVE 1 99 #define HAVE_MEMCMP 1 100 #define HAVE_WCSLEN 1 101 /* #undef HAVE_WCSLCPY */ 102 /* #undef HAVE_WCSLCAT */ 103 #define HAVE_WCSCMP 1 104 #define HAVE_STRLEN 1 105 #define HAVE_STRLCPY 1 106 #define HAVE_STRLCAT 1 107 /* #undef HAVE__STRREV */ 108 /* #undef HAVE__STRUPR */ 109 /* #undef HAVE__STRLWR */ 110 /* #undef HAVE_INDEX */ 111 /* #undef HAVE_RINDEX */ 112 #define HAVE_STRCHR 1 113 #define HAVE_STRRCHR 1 114 #define HAVE_STRSTR 1 115 /* #undef HAVE_ITOA */ 116 /* #undef HAVE__LTOA */ 117 /* #undef HAVE__UITOA */ 118 /* #undef HAVE__ULTOA */ 119 #define HAVE_STRTOL 1 120 #define HAVE_STRTOUL 1 121 /* #undef HAVE__I64TOA */ 122 /* #undef HAVE__UI64TOA */ 123 #define HAVE_STRTOLL 1 124 #define HAVE_STRTOULL 1 125 #define HAVE_STRTOD 1 126 #define HAVE_ATOI 1 127 #define HAVE_ATOF 1 128 #define HAVE_STRCMP 1 129 #define HAVE_STRNCMP 1 130 /* #undef HAVE__STRICMP */ 131 #define HAVE_STRCASECMP 1 132 /* #undef HAVE__STRNICMP */ 133 #define HAVE_STRNCASECMP 1 134 /* #undef HAVE_SSCANF */ 135 #define HAVE_VSSCANF 1 136 /* #undef HAVE_SNPRINTF */ 137 #define HAVE_VSNPRINTF 1 138 #define HAVE_M_PI /**/ 139 #define HAVE_ACOS 1 140 #define HAVE_ACOSF 1 141 #define HAVE_ASIN 1 142 #define HAVE_ASINF 1 143 #define HAVE_ATAN 1 144 #define HAVE_ATANF 1 145 #define HAVE_ATAN2 1 146 #define HAVE_ATAN2F 1 147 #define HAVE_CEIL 1 148 #define HAVE_CEILF 1 149 #define HAVE_COPYSIGN 1 150 #define HAVE_COPYSIGNF 1 151 #define HAVE_COS 1 152 #define HAVE_COSF 1 153 #define HAVE_FABS 1 154 #define HAVE_FABSF 1 155 #define HAVE_FLOOR 1 156 #define HAVE_FLOORF 1 157 #define HAVE_FMOD 1 158 #define HAVE_FMODF 1 159 #define HAVE_LOG 1 160 #define HAVE_LOGF 1 161 #define HAVE_LOG10 1 162 #define HAVE_LOG10F 1 163 #define HAVE_POW 1 164 #define HAVE_POWF 1 165 #define HAVE_SCALBN 1 166 #define HAVE_SCALBNF 1 167 #define HAVE_SIN 1 168 #define HAVE_SINF 1 169 #define HAVE_SQRT 1 170 #define HAVE_SQRTF 1 171 #define HAVE_TAN 1 172 #define HAVE_TANF 1 173 /* #undef HAVE_FOPEN64 */ 174 #define HAVE_FSEEKO 1 175 /* #undef HAVE_FSEEKO64 */ 176 #define HAVE_SIGACTION 1 177 #define HAVE_SA_SIGACTION 1 178 #define HAVE_SETJMP 1 179 #define HAVE_NANOSLEEP 1 180 #define HAVE_SYSCONF 1 181 #define HAVE_SYSCTLBYNAME 1 182 /* #undef HAVE_CLOCK_GETTIME */ 183 /* #undef HAVE_GETPAGESIZE */ 184 #define HAVE_MPROTECT 1 185 #define HAVE_ICONV 1 186 /* #undef HAVE_PTHREAD_SETNAME_NP */ 187 /* #undef HAVE_PTHREAD_SET_NAME_NP */ 188 /* #undef HAVE_SEM_TIMEDWAIT */ 189 /* #undef HAVE_GETAUXVAL */ 190 #define HAVE_POLL 1 191 192 #else 193 #define HAVE_STDARG_H 1 194 #define HAVE_STDDEF_H 1 195 #define HAVE_STDINT_H 1 196 #endif /* HAVE_LIBC */ 197 198 #define HAVE_ALTIVEC_H 1 199 /* #undef HAVE_DBUS_DBUS_H */ 200 /* #undef HAVE_FCITX_FRONTEND_H */ 201 /* #undef HAVE_IBUS_IBUS_H */ 202 /* #undef HAVE_IMMINTRIN_H */ 203 /* #undef HAVE_LIBSAMPLERATE_H */ 204 /* #undef HAVE_LIBUDEV_H */ 205 206 /* #undef HAVE_DDRAW_H */ 207 /* #undef HAVE_DINPUT_H */ 208 /* #undef HAVE_DSOUND_H */ 209 /* #undef HAVE_DXGI_H */ 210 /* #undef HAVE_XINPUT_H */ 211 /* #undef HAVE_XINPUT_GAMEPAD_EX */ 212 /* #undef HAVE_XINPUT_STATE_EX */ 213 214 /* SDL internal assertion support */ 215 /* #undef SDL_DEFAULT_ASSERT_LEVEL */ 216 217 /* Allow disabling of core subsystems */ 218 /* #undef SDL_ATOMIC_DISABLED */ 219 /* #undef SDL_AUDIO_DISABLED */ 220 /* #undef SDL_CPUINFO_DISABLED */ 221 /* #undef SDL_EVENTS_DISABLED */ 222 /* #undef SDL_FILE_DISABLED */ 223 /* #undef SDL_JOYSTICK_DISABLED */ 224 /* #undef SDL_HAPTIC_DISABLED */ 225 /* #undef SDL_LOADSO_DISABLED */ 226 /* #undef SDL_RENDER_DISABLED */ 227 /* #undef SDL_THREADS_DISABLED */ 228 /* #undef SDL_TIMERS_DISABLED */ 229 /* #undef SDL_VIDEO_DISABLED */ 230 /* #undef SDL_POWER_DISABLED */ 231 /* #undef SDL_FILESYSTEM_DISABLED */ 232 233 /* Enable various audio drivers */ 234 /* #undef SDL_AUDIO_DRIVER_ALSA */ 235 /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ 236 /* #undef SDL_AUDIO_DRIVER_ANDROID */ 237 /* #undef SDL_AUDIO_DRIVER_ARTS */ 238 /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ 239 #define SDL_AUDIO_DRIVER_COREAUDIO 1 240 #define SDL_AUDIO_DRIVER_DISK 1 241 /* #undef SDL_AUDIO_DRIVER_DSOUND */ 242 #define SDL_AUDIO_DRIVER_DUMMY 1 243 /* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */ 244 /* #undef SDL_AUDIO_DRIVER_ESD */ 245 /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ 246 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ 247 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ 248 /* #undef SDL_AUDIO_DRIVER_HAIKU */ 249 /* #undef SDL_AUDIO_DRIVER_JACK */ 250 /* #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC */ 251 /* #undef SDL_AUDIO_DRIVER_NACL */ 252 /* #undef SDL_AUDIO_DRIVER_NAS */ 253 /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ 254 /* #undef SDL_AUDIO_DRIVER_NETBSD */ 255 /* #undef SDL_AUDIO_DRIVER_OSS */ 256 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ 257 /* #undef SDL_AUDIO_DRIVER_PAUDIO */ 258 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ 259 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ 260 /* #undef SDL_AUDIO_DRIVER_QSA */ 261 /* #undef SDL_AUDIO_DRIVER_SNDIO */ 262 /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ 263 /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ 264 /* #undef SDL_AUDIO_DRIVER_WASAPI */ 265 /* #undef SDL_AUDIO_DRIVER_WINMM */ 266 267 /* Enable various input drivers */ 268 /* #undef SDL_INPUT_LINUXEV */ 269 /* #undef SDL_INPUT_LINUXKD */ 270 /* #undef SDL_INPUT_TSLIB */ 271 /* #undef SDL_JOYSTICK_HAIKU */ 272 /* #undef SDL_JOYSTICK_DINPUT */ 273 /* #undef SDL_JOYSTICK_XINPUT */ 274 /* #undef SDL_JOYSTICK_DUMMY */ 275 #define SDL_JOYSTICK_IOKIT 1 276 /* #undef SDL_JOYSTICK_LINUX */ 277 /* #undef SDL_JOYSTICK_ANDROID */ 278 /* #undef SDL_JOYSTICK_WINMM */ 279 /* #undef SDL_JOYSTICK_USBHID */ 280 /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ 281 /* #undef SDL_JOYSTICK_EMSCRIPTEN */ 282 /* #undef SDL_HAPTIC_DUMMY */ 283 /* #undef SDL_HAPTIC_ANDROID */ 284 /* #undef SDL_HAPTIC_LINUX */ 285 #define SDL_HAPTIC_IOKIT 1 286 /* #undef SDL_HAPTIC_DINPUT */ 287 /* #undef SDL_HAPTIC_XINPUT */ 288 289 /* Enable various shared object loading systems */ 290 #define SDL_LOADSO_DLOPEN 1 291 /* #undef SDL_LOADSO_DUMMY */ 292 /* #undef SDL_LOADSO_LDG */ 293 /* #undef SDL_LOADSO_WINDOWS */ 294 295 /* Enable various threading systems */ 296 #define SDL_THREAD_PTHREAD 1 297 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 298 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ 299 /* #undef SDL_THREAD_WINDOWS */ 300 301 /* Enable various timer systems */ 302 /* #undef SDL_TIMER_HAIKU */ 303 /* #undef SDL_TIMER_DUMMY */ 304 #define SDL_TIMER_UNIX 1 305 /* #undef SDL_TIMER_WINDOWS */ 306 307 /* Enable various video drivers */ 308 /* #undef SDL_VIDEO_DRIVER_HAIKU */ 309 #define SDL_VIDEO_DRIVER_COCOA 1 310 /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ 311 /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ 312 #define SDL_VIDEO_DRIVER_DUMMY 1 313 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ 314 /* #undef SDL_VIDEO_DRIVER_WAYLAND */ 315 /* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ 316 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ 317 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ 318 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ 319 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ 320 /* #undef SDL_VIDEO_DRIVER_MIR */ 321 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */ 322 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */ 323 #define SDL_VIDEO_DRIVER_X11 1 324 /* #undef SDL_VIDEO_DRIVER_RPI */ 325 /* #undef SDL_VIDEO_DRIVER_KMSDRM */ 326 /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ 327 /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */ 328 /* #undef SDL_VIDEO_DRIVER_ANDROID */ 329 /* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */ 330 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 331 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 332 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "/usr/X11R6/lib/libXcursor.1.dylib" 333 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" 334 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */ 335 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */ 336 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" 337 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" 338 #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 339 #define SDL_VIDEO_DRIVER_X11_XDBE 1 340 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 341 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */ 342 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ 343 /* #undef SDL_VIDEO_DRIVER_X11_XRANDR */ 344 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 345 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 346 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 347 /* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */ 348 /* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */ 349 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 350 /* #undef SDL_VIDEO_DRIVER_NACL */ 351 /* #undef SDL_VIDEO_DRIVER_VIVANTE */ 352 /* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */ 353 /* #undef SDL_VIDEO_DRIVER_QNX */ 354 355 /* #undef SDL_VIDEO_RENDER_D3D */ 356 /* #undef SDL_VIDEO_RENDER_D3D11 */ 357 #define SDL_VIDEO_RENDER_OGL 1 358 /* #undef SDL_VIDEO_RENDER_OGL_ES */ 359 /* #undef SDL_VIDEO_RENDER_OGL_ES2 */ 360 /* #undef SDL_VIDEO_RENDER_DIRECTFB */ 361 /* #undef SDL_VIDEO_RENDER_METAL */ 362 363 /* Enable OpenGL support */ 364 #define SDL_VIDEO_OPENGL 1 365 /* #undef SDL_VIDEO_OPENGL_ES */ 366 /* #undef SDL_VIDEO_OPENGL_ES2 */ 367 /* #undef SDL_VIDEO_OPENGL_BGL */ 368 #define SDL_VIDEO_OPENGL_CGL 1 369 /* #undef SDL_VIDEO_OPENGL_EGL */ 370 #define SDL_VIDEO_OPENGL_GLX 1 371 /* #undef SDL_VIDEO_OPENGL_WGL */ 372 /* #undef SDL_VIDEO_OPENGL_OSMESA */ 373 /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ 374 375 /* Enable Vulkan support */ 376 /* #undef SDL_VIDEO_VULKAN */ 377 378 /* Enable system power support */ 379 /* #undef SDL_POWER_LINUX */ 380 /* #undef SDL_POWER_WINDOWS */ 381 #define SDL_POWER_MACOSX 1 382 /* #undef SDL_POWER_HAIKU */ 383 /* #undef SDL_POWER_ANDROID */ 384 /* #undef SDL_POWER_EMSCRIPTEN */ 385 /* #undef SDL_POWER_HARDWIRED */ 386 387 /* Enable system filesystem support */ 388 /* #undef SDL_FILESYSTEM_HAIKU */ 389 #define SDL_FILESYSTEM_COCOA 1 390 /* #undef SDL_FILESYSTEM_DUMMY */ 391 /* #undef SDL_FILESYSTEM_UNIX */ 392 /* #undef SDL_FILESYSTEM_WINDOWS */ 393 /* #undef SDL_FILESYSTEM_NACL */ 394 /* #undef SDL_FILESYSTEM_ANDROID */ 395 /* #undef SDL_FILESYSTEM_EMSCRIPTEN */ 396 397 /* Enable assembly routines */ 398 #define SDL_ASSEMBLY_ROUTINES 1 399 #define SDL_ALTIVEC_BLITTERS 1 400 401 /* Enable ime support */ 402 /* #undef SDL_USE_IME */ 403 404 /* Enable dynamic udev support */ 405 /* #undef SDL_UDEV_DYNAMIC */ 406 407 /* Enable dynamic libsamplerate support */ 408 /* #undef SDL_LIBSAMPLERATE_DYNAMIC */ 52 409 53 410 #endif /* SDL_config_h_ */ -
include/SDL_platform.h
diff -ru SDL2-2.0.8-orig/include/SDL_platform.h SDL2-2.0.8/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.8-orig/include/SDL_syswm.h SDL2-2.0.8/include/SDL_syswm.h
old new 229 229 #if defined(SDL_VIDEO_DRIVER_COCOA) 230 230 struct 231 231 { 232 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 232 233 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 233 234 NSWindow __unsafe_unretained *window; /**< The Cocoa window */ 234 235 #else 235 236 NSWindow *window; /**< The Cocoa window */ 236 237 #endif 238 #else 239 NSWindow *window; /**< The Cocoa window */ 240 #endif 237 241 } cocoa; 238 242 #endif 239 243 #if defined(SDL_VIDEO_DRIVER_UIKIT) 240 244 struct 241 245 { 246 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 242 247 #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) 243 248 UIWindow __unsafe_unretained *window; /**< The UIKit window */ 244 249 #else 245 250 UIWindow *window; /**< The UIKit window */ 246 251 #endif 252 #else 253 UIWindow *window; /**< The UIKit window */ 254 #endif 247 255 GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ 248 256 GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ 249 257 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.8: libtool Only in SDL2-2.0.8: sdl2-config Only in SDL2-2.0.8: sdl2-config.cmake Only in SDL2-2.0.8: sdl2.pc diff -ru SDL2-2.0.8-orig/src/atomic/SDL_spinlock.c SDL2-2.0.8/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.8-orig/src/file/cocoa/SDL_rwopsbundlesupport.m SDL2-2.0.8/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.8-orig/src/filesystem/cocoa/SDL_sysfilesystem.m SDL2-2.0.8/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 if (!app) { 75 91 SDL_InvalidParamError("app"); 76 92 return NULL; … … 109 125 } 110 126 } 111 127 128 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 112 129 return retval; 113 130 }} 131 #else 132 [pool release]; 133 return retval; 134 } 135 #endif 114 136 115 137 #endif /* SDL_FILESYSTEM_COCOA */ 116 138 -
src/joystick/darwin/SDL_sysjoystick.c
diff -ru SDL2-2.0.8-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.8/src/joystick/darwin/SDL_sysjoystick.c
old new 469 469 device->instance_id = ++s_joystick_instance_id; 470 470 471 471 /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */ 472 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 472 473 ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); 474 #else 475 ioservice = 0; 476 #endif 473 477 #if SDL_HAPTIC_IOKIT 474 478 if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { 475 479 device->ffservice = ioservice; -
src/video/cocoa/SDL_cocoaclipboard.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.8/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.8-orig/src/video/cocoa/SDL_cocoaevents.m SDL2-2.0.8/src/video/cocoa/SDL_cocoaevents.m
old new 57 57 SDL_VideoDevice *_this = SDL_GetVideoDevice(); 58 58 59 59 switch ([theEvent type]) { 60 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 61 case NSLeftMouseDown: 62 case NSOtherMouseDown: 63 case NSRightMouseDown: 64 case NSLeftMouseUp: 65 case NSOtherMouseUp: 66 case NSRightMouseUp: 67 case NSLeftMouseDragged: 68 case NSRightMouseDragged: 69 case NSOtherMouseDragged: /* usually middle mouse dragged */ 70 case NSMouseMoved: 71 case NSScrollWheel: 72 #else 60 73 case NSEventTypeLeftMouseDown: 61 74 case NSEventTypeOtherMouseDown: 62 75 case NSEventTypeRightMouseDown: … … 68 81 case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */ 69 82 case NSEventTypeMouseMoved: 70 83 case NSEventTypeScrollWheel: 84 #endif 71 85 Cocoa_HandleMouseEvent(_this, theEvent); 72 86 break; 87 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 88 case NSKeyDown: 89 case NSKeyUp: 90 case NSFlagsChanged: 91 #else 73 92 case NSEventTypeKeyDown: 74 93 case NSEventTypeKeyUp: 75 94 case NSEventTypeFlagsChanged: 95 #endif 76 96 Cocoa_HandleKeyEvent(_this, theEvent); 77 97 break; 78 98 default: … … 110 130 - (void)setAppleMenu:(NSMenu *)menu; 111 131 @end 112 132 133 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 113 134 @interface SDLAppDelegate : NSObject <NSApplicationDelegate> { 135 #else 136 @interface SDLAppDelegate : NSObject { 137 #endif 114 138 @public 115 139 BOOL seenFirstActivate; 116 140 } … … 170 194 */ 171 195 for (NSWindow *window in [NSApp orderedWindows]) { 172 196 if (window != win && [window canBecomeKeyWindow]) { 173 if (![window isOnActiveSpace]) { 174 continue; 197 if ([window respondsToSelector:@selector(isOnActiveSpace)]) { 198 if (![window isOnActiveSpace]) { 199 continue; 200 } 175 201 } 176 202 [window makeKeyAndOrderFront:self]; 177 203 return; … … 357 383 [windowMenu release]; 358 384 359 385 386 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 360 387 /* Add the fullscreen view toggle menu option, if supported */ 361 388 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { 362 389 /* Create the view menu */ … … 374 401 375 402 [viewMenu release]; 376 403 } 404 #endif 377 405 } 378 406 379 407 void 380 408 Cocoa_RegisterApp(void) 409 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 381 410 { @autoreleasepool 382 411 { 412 #else 413 { 414 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 415 #endif 383 416 /* This can get called more than once! Be careful what you initialize! */ 384 417 385 418 if (NSApp == nil) { … … 389 422 s_bShouldHandleEventsInSDLApplication = SDL_TRUE; 390 423 391 424 if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { 425 #if defined(MAC_OS_X_VERSION_10_6) 392 426 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; 427 #endif 393 428 } 394 429 395 430 if ([NSApp mainMenu] == nil) { … … 415 450 appDelegate->seenFirstActivate = YES; 416 451 } 417 452 } 453 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 418 454 }} 455 #else 456 [pool release]; 457 } 458 #endif 419 459 420 460 void 421 461 Cocoa_PumpEvents(_THIS) 462 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 422 463 { @autoreleasepool 423 464 { 465 #else 466 { 467 NSAutoreleasePool *pool; 468 #endif 424 469 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 425 470 /* Update activity every 30 seconds to prevent screensaver */ 426 471 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 434 479 } 435 480 #endif 436 481 482 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 483 pool = [[NSAutoreleasePool alloc] init]; 484 #endif 437 485 for ( ; ; ) { 486 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 487 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 488 #else 438 489 NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 490 #endif 439 491 if ( event == nil ) { 440 492 break; 441 493 } … … 447 499 // Pass events down to SDLApplication to be handled in sendEvent: 448 500 [NSApp sendEvent:event]; 449 501 } 502 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 450 503 }} 504 #else 505 [pool release]; 506 } 507 #endif 451 508 452 509 void 453 510 Cocoa_SuspendScreenSaver(_THIS) 511 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 454 512 { @autoreleasepool 455 513 { 456 514 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 477 535 &data->screensaver_assertion); 478 536 } 479 537 }} 538 #else 539 { 540 } 541 #endif 480 542 481 543 #endif /* SDL_VIDEO_DRIVER_COCOA */ 482 544 -
src/video/cocoa/SDL_cocoakeyboard.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoakeyboard.m SDL2-2.0.8/src/video/cocoa/SDL_cocoakeyboard.m
old new 144 144 NSStringFromRect(rect)); 145 145 146 146 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 147 #if defined(MAC_OS_X_VERSION_10_7) 147 148 if (![window respondsToSelector:@selector(convertRectToScreen:)]) { 149 #endif 148 150 rect.origin = [window convertBaseToScreen:rect.origin]; 151 #if defined(MAC_OS_X_VERSION_10_7) 149 152 } else 150 153 #endif 154 #endif 151 155 { 156 #if defined(MAC_OS_X_VERSION_10_7) 152 157 rect = [window convertRectToScreen:rect]; 158 #endif 153 159 } 154 160 155 161 return rect; … … 591 597 592 598 void 593 599 Cocoa_StartTextInput(_THIS) 600 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 594 601 { @autoreleasepool 595 602 { 603 #else 604 { 605 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 606 #endif 596 607 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 597 608 SDL_Window *window = SDL_GetKeyboardFocus(); 598 609 NSWindow *nswindow = nil; … … 618 629 [parentView addSubview: data->fieldEdit]; 619 630 [nswindow makeFirstResponder: data->fieldEdit]; 620 631 } 632 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 621 633 }} 634 #else 635 [pool release]; 636 } 637 #endif 622 638 623 639 void 624 640 Cocoa_StopTextInput(_THIS) 641 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 625 642 { @autoreleasepool 643 #endif 626 644 { 627 645 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; 628 646 629 647 if (data && data->fieldEdit) { 648 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 649 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 650 #endif 630 651 [data->fieldEdit removeFromSuperview]; 631 652 [data->fieldEdit release]; 632 653 data->fieldEdit = nil; 654 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 655 [pool release]; 656 #endif 633 657 } 658 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 634 659 }} 660 #else 661 } 662 #endif 635 663 636 664 void 637 665 Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) … … 673 701 } 674 702 675 703 switch ([event type]) { 704 #if !defined(MAC_OS_X_VERSION_10_12) 705 case NSKeyDown: 706 #else 676 707 case NSEventTypeKeyDown: 708 #endif 677 709 if (![event isARepeat]) { 678 710 /* See if we need to rebuild the keyboard layout */ 679 711 UpdateKeymap(data, SDL_TRUE); … … 697 729 #endif 698 730 } 699 731 break; 732 #if !defined(MAC_OS_X_VERSION_10_12) 733 case NSKeyUp: 734 #else 700 735 case NSEventTypeKeyUp: 736 #endif 701 737 SDL_SendKeyboardKey(SDL_RELEASED, code); 702 738 break; 739 #if !defined(MAC_OS_X_VERSION_10_12) 740 case NSFlagsChanged: 741 #else 703 742 case NSEventTypeFlagsChanged: 743 #endif 704 744 /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ 705 745 HandleModifiers(_this, scancode, [event modifierFlags]); 706 746 break; -
src/video/cocoa/SDL_cocoamessagebox.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoamessagebox.m SDL2-2.0.8/src/video/cocoa/SDL_cocoamessagebox.m
old new 92 92 /* Display a Cocoa message box */ 93 93 int 94 94 Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) 95 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 95 96 { @autoreleasepool 97 #endif 96 98 { 97 99 Cocoa_RegisterApp(); 98 100 101 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 102 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 103 #endif 99 104 NSAlert* alert = [[[NSAlert alloc] init] autorelease]; 100 105 101 106 if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { … … 137 142 returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked); 138 143 } 139 144 145 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 146 [pool release]; 147 #endif 140 148 return returnValue; 149 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 141 150 }} 151 #else 152 } 153 #endif 142 154 143 155 #endif /* SDL_VIDEO_DRIVER_COCOA */ 144 156 -
src/video/cocoa/SDL_cocoamodes.h
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoamodes.h SDL2-2.0.8/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.8-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.8/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) … … 341 401 { 342 402 SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; 343 403 CVDisplayLinkRef link = NULL; 404 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 344 405 CGDisplayModeRef desktopmoderef; 345 406 SDL_DisplayMode desktopmode; 407 #endif 346 408 CFArrayRef modes; 347 409 348 410 CVDisplayLinkCreateWithCGDisplay(data->display, &link); 349 411 412 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 350 413 desktopmoderef = CGDisplayCopyDisplayMode(data->display); 351 414 352 415 /* CopyAllDisplayModes won't always contain the desktop display mode (if … … 363 426 } else { 364 427 CGDisplayModeRelease(desktopmoderef); 365 428 } 429 #endif 366 430 431 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 367 432 modes = CGDisplayCopyAllDisplayModes(data->display, NULL); 433 #else 434 modes = CGDisplayAvailableModes(data->display); 435 #endif 368 436 369 437 if (modes) { 370 438 CFIndex i; 371 439 const CFIndex count = CFArrayGetCount(modes); 372 440 373 441 for (i = 0; i < count; i++) { 442 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 374 443 CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); 444 #else 445 const void *moderef = CFArrayGetValueAtIndex(modes, i); 446 #endif 375 447 SDL_DisplayMode mode; 376 448 377 449 if (GetDisplayMode(_this, moderef, link, &mode)) { 378 450 if (SDL_AddDisplayMode(display, &mode)) { 451 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 379 452 CGDisplayModeRetain(moderef); 453 #endif 380 454 } else { 381 455 SDL_free(mode.driverdata); 382 456 } … … 404 478 405 479 if (data == display->desktop_mode.driverdata) { 406 480 /* Restoring desktop mode */ 481 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 407 482 CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 483 #else 484 CGDisplaySwitchToMode(displaydata->display, data->moderef); 485 #endif 408 486 409 487 if (CGDisplayIsMain(displaydata->display)) { 410 488 CGReleaseAllDisplays(); … … 429 507 } 430 508 431 509 /* Do the physical switch */ 510 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 432 511 result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 512 #else 513 result = CGDisplaySwitchToMode(displaydata->display, data->moderef); 514 #endif 433 515 if (result != kCGErrorSuccess) { 434 516 CG_SetError("CGDisplaySwitchToMode()", result); 435 517 goto ERR_NO_SWITCH; … … 474 556 } 475 557 476 558 mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata; 559 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 477 560 CGDisplayModeRelease(mode->moderef); 561 #endif 478 562 479 563 for (j = 0; j < display->num_display_modes; j++) { 480 564 mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata; 565 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 481 566 CGDisplayModeRelease(mode->moderef); 567 #endif 482 568 } 483 569 484 570 } -
src/video/cocoa/SDL_cocoamouse.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoamouse.m SDL2-2.0.8/src/video/cocoa/SDL_cocoamouse.m
old new 67 67 68 68 static SDL_Cursor * 69 69 Cocoa_CreateDefaultCursor() 70 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 70 71 { @autoreleasepool 71 72 { 73 #else 74 { 75 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 76 #endif 72 77 NSCursor *nscursor; 73 78 SDL_Cursor *cursor = NULL; 74 79 … … 82 87 } 83 88 } 84 89 90 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 91 [pool release]; 92 #endif 85 93 return cursor; 94 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 86 95 }} 96 #else 97 } 98 #endif 87 99 88 100 static SDL_Cursor * 89 101 Cocoa_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) 102 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 90 103 { @autoreleasepool 91 104 { 105 #else 106 { 107 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 108 #endif 92 109 NSImage *nsimage; 93 110 NSCursor *nscursor = NULL; 94 111 SDL_Cursor *cursor = NULL; … … 107 124 } 108 125 } 109 126 127 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 128 [pool release]; 129 #endif 110 130 return cursor; 131 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 111 132 }} 133 #else 134 } 135 #endif 112 136 113 137 static SDL_Cursor * 114 138 Cocoa_CreateSystemCursor(SDL_SystemCursor id) 139 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 115 140 { @autoreleasepool 116 141 { 142 #else 143 { 144 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 145 #endif 117 146 NSCursor *nscursor = NULL; 118 147 SDL_Cursor *cursor = NULL; 119 148 … … 166 195 } 167 196 } 168 197 198 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 199 [pool release]; 200 #endif 169 201 return cursor; 202 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 170 203 }} 204 #else 205 } 206 #endif 171 207 172 208 static void 173 209 Cocoa_FreeCursor(SDL_Cursor * cursor) 210 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 174 211 { @autoreleasepool 175 212 { 213 #else 214 { 215 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 216 #endif 176 217 NSCursor *nscursor = (NSCursor *)cursor->driverdata; 177 218 178 219 [nscursor release]; 179 220 SDL_free(cursor); 221 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 180 222 }} 223 #else 224 [pool release]; 225 } 226 #endif 181 227 182 228 static int 183 229 Cocoa_ShowCursor(SDL_Cursor * cursor) 230 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 184 231 { @autoreleasepool 185 232 { 233 #else 234 { 235 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 236 #endif 186 237 SDL_VideoDevice *device = SDL_GetVideoDevice(); 187 238 SDL_Window *window = (device ? device->windows : NULL); 188 239 for (; window != NULL; window = window->next) { … … 193 244 waitUntilDone:NO]; 194 245 } 195 246 } 247 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 248 [pool release]; 249 #endif 196 250 return 0; 251 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 197 252 }} 253 #else 254 } 255 #endif 198 256 199 257 static SDL_Window * 200 258 SDL_FindWindowAtPoint(const int x, const int y) … … 364 422 Cocoa_HandleMouseEvent(_THIS, NSEvent *event) 365 423 { 366 424 switch ([event type]) { 425 #if !defined(MAC_OS_X_VERSION_10_12) 426 case NSMouseMoved: 427 case NSLeftMouseDragged: 428 case NSRightMouseDragged: 429 case NSOtherMouseDragged: 430 #else 367 431 case NSEventTypeMouseMoved: 368 432 case NSEventTypeLeftMouseDragged: 369 433 case NSEventTypeRightMouseDragged: 370 434 case NSEventTypeOtherMouseDragged: 435 #endif 371 436 break; 372 437 373 438 default: -
src/video/cocoa/SDL_cocoaopengl.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.8/src/video/cocoa/SDL_cocoaopengl.m
old new 151 151 152 152 SDL_GLContext 153 153 Cocoa_GL_CreateContext(_THIS, SDL_Window * window) 154 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 154 155 { @autoreleasepool 155 156 { 157 #else 158 { 159 NSAutoreleasePool *pool; 160 #endif 156 161 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); 157 162 SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; 163 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1670 158 164 SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 165 #else 166 SDL_bool lion_or_later = SDL_FALSE; 167 #endif 159 168 NSOpenGLPixelFormatAttribute attr[32]; 160 169 NSOpenGLPixelFormat *fmt; 161 170 SDLOpenGLContext *context; … … 195 204 196 205 attr[i++] = NSOpenGLPFAAllowOfflineRenderers; 197 206 207 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 208 pool = [[NSAutoreleasePool alloc] init]; 209 #endif 198 210 /* specify a profile if we're on Lion (10.7) or later. */ 211 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 199 212 if (lion_or_later) { 200 213 NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; 201 214 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { … … 204 217 attr[i++] = NSOpenGLPFAOpenGLProfile; 205 218 attr[i++] = profile; 206 219 } 220 #endif 207 221 208 222 attr[i++] = NSOpenGLPFAColorSize; 209 223 attr[i++] = SDL_BYTESPERPIXEL(display->current_mode.format)*8; … … 259 273 fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr]; 260 274 if (fmt == nil) { 261 275 SDL_SetError("Failed creating OpenGL pixel format"); 276 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 277 [pool release]; 278 #endif 262 279 return NULL; 263 280 } 264 281 … … 272 289 273 290 if (context == nil) { 274 291 SDL_SetError("Failed creating OpenGL context"); 292 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 293 [pool release]; 294 #endif 275 295 return NULL; 276 296 } 277 297 278 298 if ( Cocoa_GL_MakeCurrent(_this, window, context) < 0 ) { 279 299 Cocoa_GL_DeleteContext(_this, context); 280 300 SDL_SetError("Failed making OpenGL context current"); 301 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 302 [pool release]; 303 #endif 281 304 return NULL; 282 305 } 283 306 … … 292 315 if (!glGetStringFunc) { 293 316 Cocoa_GL_DeleteContext(_this, context); 294 317 SDL_SetError ("Failed getting OpenGL glGetString entry point"); 318 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 319 [pool release]; 320 #endif 295 321 return NULL; 296 322 } 297 323 … … 299 325 if (glversion == NULL) { 300 326 Cocoa_GL_DeleteContext(_this, context); 301 327 SDL_SetError ("Failed getting OpenGL context version"); 328 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 329 [pool release]; 330 #endif 302 331 return NULL; 303 332 } 304 333 305 334 if (SDL_sscanf(glversion, "%d.%d", &glversion_major, &glversion_minor) != 2) { 306 335 Cocoa_GL_DeleteContext(_this, context); 307 336 SDL_SetError ("Failed parsing OpenGL context version"); 337 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 338 [pool release]; 339 #endif 308 340 return NULL; 309 341 } 310 342 … … 312 344 ((glversion_major == _this->gl_config.major_version) && (glversion_minor < _this->gl_config.minor_version))) { 313 345 Cocoa_GL_DeleteContext(_this, context); 314 346 SDL_SetError ("Failed creating OpenGL context at version requested"); 347 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 348 [pool release]; 349 #endif 315 350 return NULL; 316 351 } 317 352 … … 321 356 /*_this->gl_config.major_version = glversion_major;*/ 322 357 /*_this->gl_config.minor_version = glversion_minor;*/ 323 358 } 359 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 360 [pool release]; 361 #endif 324 362 return context; 363 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 364 } 365 #else 325 366 }} 367 #endif 326 368 327 369 int 328 370 Cocoa_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) 371 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 329 372 { @autoreleasepool 330 373 { 374 #else 375 { 376 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 377 #endif 331 378 if (context) { 332 379 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 333 380 [nscontext setWindow:window]; … … 337 384 [NSOpenGLContext clearCurrentContext]; 338 385 } 339 386 387 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 388 [pool release]; 389 #endif 340 390 return 0; 391 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 341 392 }} 393 #else 394 } 395 #endif 342 396 343 397 void 344 398 Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h) … … 349 403 350 404 /* This gives us the correct viewport for a Retina-enabled view, only 351 405 * supported on 10.7+. */ 406 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 352 407 if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { 353 408 viewport = [contentView convertRectToBacking:viewport]; 354 409 } 410 #endif 355 411 356 412 if (w) { 357 413 *w = viewport.size.width; … … 364 420 365 421 int 366 422 Cocoa_GL_SetSwapInterval(_THIS, int interval) 423 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 367 424 { @autoreleasepool 425 #endif 368 426 { 369 427 NSOpenGLContext *nscontext; 370 428 GLint value; … … 373 431 if (interval < 0) { /* no extension for this on Mac OS X at the moment. */ 374 432 return SDL_SetError("Late swap tearing currently unsupported"); 375 433 } 434 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 435 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 436 #endif 376 437 377 438 nscontext = (NSOpenGLContext*)SDL_GL_GetCurrentContext(); 378 439 if (nscontext != nil) { … … 383 444 status = SDL_SetError("No current OpenGL context"); 384 445 } 385 446 447 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 448 [pool release]; 449 #endif 386 450 return status; 451 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 387 452 }} 453 #else 454 } 455 #endif 388 456 389 457 int 390 458 Cocoa_GL_GetSwapInterval(_THIS) 459 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 391 460 { @autoreleasepool 392 461 { 462 #else 463 { 464 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 465 #endif 393 466 NSOpenGLContext *nscontext; 394 467 GLint value; 395 468 int status = 0; … … 400 473 status = (int)value; 401 474 } 402 475 476 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 477 [pool release]; 478 #endif 403 479 return status; 480 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 404 481 }} 482 #else 483 } 484 #endif 405 485 406 486 int 407 487 Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) 488 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 408 489 { @autoreleasepool 409 490 { 491 #else 492 { 493 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 494 #endif 410 495 SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); 411 496 [nscontext flushBuffer]; 412 497 [nscontext updateIfNeeded]; 498 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 499 [pool release]; 500 #endif 413 501 return 0; 502 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 414 503 }} 504 #else 505 } 506 #endif 415 507 416 508 void 417 509 Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) 510 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 418 511 { @autoreleasepool 419 512 { 513 #else 514 { 515 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 516 #endif 420 517 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 421 518 422 519 [nscontext setWindow:NULL]; 423 520 [nscontext release]; 521 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 424 522 }} 523 #else 524 [pool release]; 525 } 526 #endif 425 527 426 528 #endif /* SDL_VIDEO_OPENGL_CGL */ 427 529 -
src/video/cocoa/SDL_cocoashape.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoashape.m SDL2-2.0.8/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.h
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoavideo.h SDL2-2.0.8/src/video/cocoa/SDL_cocoavideo.h
old new 58 58 DECLARE_EVENT(FlagsChanged); 59 59 #undef DECLARE_EVENT 60 60 61 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 61 62 static const NSEventMask NSEventMaskAny = NSAnyEventMask; 63 #endif 62 64 63 65 #define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask 64 66 DECLARE_MODIFIER_FLAG(Shift); … … 79 81 DECLARE_WINDOW_MASK(Resizable); 80 82 DECLARE_WINDOW_MASK(TexturedBackground); 81 83 DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar); 84 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 82 85 DECLARE_WINDOW_MASK(FullScreen); 86 #endif 83 87 /*DECLARE_WINDOW_MASK(FullSizeContentView);*/ /* Not used, fails compile on older SDKs */ 84 88 static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask; 85 89 static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; -
src/video/cocoa/SDL_cocoavideo.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoavideo.m SDL2-2.0.8/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" … … 169 176 Cocoa_InitKeyboard(_this); 170 177 Cocoa_InitMouse(_this); 171 178 179 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 172 180 data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); 173 181 174 182 /* The IOPM assertion API can disable the screensaver as of 10.7. */ 175 183 data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 184 #else 185 data->allow_spaces = 0; 186 data->screensaver_use_iopm = 0; 187 #endif 176 188 177 189 return 0; 178 190 } -
src/video/cocoa/SDL_cocoawindow.h
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.8/src/video/cocoa/SDL_cocoawindow.h
old new 39 39 PENDING_OPERATION_MINIMIZE 40 40 } PendingWindowOperation; 41 41 42 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 42 43 @interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> { 44 #else 45 @interface Cocoa_WindowListener : NSResponder { 46 #endif 43 47 SDL_WindowData *_data; 44 48 BOOL observingVisible; 45 49 BOOL wasCtrlLeft; … … 79 83 -(void) windowDidEnterFullScreen:(NSNotification *) aNotification; 80 84 -(void) windowWillExitFullScreen:(NSNotification *) aNotification; 81 85 -(void) windowDidExitFullScreen:(NSNotification *) aNotification; 86 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 82 87 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions; 88 #endif 83 89 84 90 /* See if event is in a drag area, toggle on window dragging. */ 85 91 -(BOOL) processHitTest:(NSEvent *)theEvent; … … 102 108 -(void) touchesCancelledWithEvent:(NSEvent *) theEvent; 103 109 104 110 /* Touch event handling */ 111 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 105 112 -(void) handleTouches:(NSTouchPhase) phase withEvent:(NSEvent*) theEvent; 113 #else 114 typedef enum { 115 COCOA_TOUCH_DOWN, 116 COCOA_TOUCH_UP, 117 COCOA_TOUCH_MOVE, 118 COCOA_TOUCH_CANCELLED 119 } cocoaTouchType; 120 -(void) handleTouches:(cocoaTouchType)type withEvent:(NSEvent*) event; 121 #endif 106 122 107 123 @end 108 124 /* *INDENT-ON* */ -
src/video/cocoa/SDL_cocoawindow.m
diff -ru SDL2-2.0.8-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.8/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" … … 55 57 #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) 56 58 57 59 60 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 61 @interface SDLWindow : NSWindow 62 #else 58 63 @interface SDLWindow : NSWindow <NSDraggingDestination> 64 #endif 59 65 /* These are needed for borderless/fullscreen windows */ 60 66 - (BOOL)canBecomeKeyWindow; 61 67 - (BOOL)canBecomeMainWindow; … … 137 143 } 138 144 139 145 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 146 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 140 147 { @autoreleasepool 141 148 { 149 #else 150 { 151 NSAutoreleasePool *pool; 152 #endif 142 153 NSPasteboard *pasteboard = [sender draggingPasteboard]; 143 154 NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; 144 155 NSString *desiredType = [pasteboard availableTypeFromArray:types]; … … 153 164 return NO; 154 165 } 155 166 167 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 168 pool = [[NSAutoreleasePool alloc] init]; 169 #endif 170 156 171 SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]); 157 172 NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; 158 173 159 174 for (NSString *path in array) { 160 175 NSURL *fileURL = [NSURL fileURLWithPath:path]; 176 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 161 177 NSNumber *isAlias = nil; 162 178 163 179 [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil]; … … 178 194 } 179 195 } 180 196 } 197 #endif 181 198 182 199 if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { 200 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 201 [pool release]; 202 #endif 183 203 return NO; 184 204 } 185 205 } 186 206 207 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 208 [pool release]; 209 #endif 187 210 SDL_SendDropComplete(sdlwindow); 188 211 return YES; 212 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 213 } 214 #else 189 215 }} 216 #endif 190 217 191 218 - (BOOL)wantsPeriodicDraggingUpdates 192 219 { … … 314 341 [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; 315 342 [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window]; 316 343 [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; 344 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 317 345 [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; 318 346 [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; 319 347 [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; 320 348 [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; 321 349 [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; 350 #endif 322 351 [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 323 352 [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 324 353 } else { … … 409 438 inFullscreenTransition = YES; 410 439 411 440 /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */ 441 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 412 442 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 443 #endif 413 444 [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO]; 414 445 return YES; 415 446 } … … 445 476 [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; 446 477 [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window]; 447 478 [center removeObserver:self name:NSWindowDidResignKeyNotification object:window]; 479 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 448 480 [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; 449 481 [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; 450 482 [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; 451 483 [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; 452 484 [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; 485 #endif 453 486 [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 454 487 [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 455 488 } else { … … 629 662 [NSMenu setMenuBarVisible:NO]; 630 663 } 631 664 665 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 632 666 const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; 633 667 _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; 634 668 SDL_ToggleModState(KMOD_CAPS, newflags != 0); 669 #endif 635 670 } 636 671 637 672 - (void)windowDidResignKey:(NSNotification *)aNotification … … 658 693 659 694 - (void)windowDidChangeBackingProperties:(NSNotification *)aNotification 660 695 { 696 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 661 697 NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; 662 698 663 699 if (inFullscreenTransition) { … … 670 706 _data->window->h = 0; 671 707 [self windowDidResize:aNotification]; 672 708 } 709 #endif 673 710 } 674 711 675 712 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification … … 778 815 [nswindow miniaturize:nil]; 779 816 } else { 780 817 /* Adjust the fullscreen toggle button and readd menu now that we're here. */ 818 #if MAC_OS_X_VERSION_MIN_REQUIRED > 1070 781 819 if (window->flags & SDL_WINDOW_RESIZABLE) { 782 820 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 783 821 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 784 822 } else { 785 823 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; 786 824 } 825 #endif 787 826 [NSMenu setMenuBarVisible:YES]; 788 827 789 828 pendingWindowOperation = PENDING_OPERATION_NONE; … … 826 865 } 827 866 } 828 867 868 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 829 869 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions 830 870 { 831 871 if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { … … 834 874 return proposedOptions; 835 875 } 836 876 } 877 #endif 837 878 838 879 839 880 /* We'll respond to key events by doing nothing so we don't beep. … … 1060 1101 1061 1102 - (void)touchesBeganWithEvent:(NSEvent *) theEvent 1062 1103 { 1104 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1063 1105 NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; 1064 1106 int existingTouchCount = 0; 1065 1107 … … 1080 1122 1081 1123 DLog("Began Fingers: %lu .. existing: %d", (unsigned long)[touches count], existingTouchCount); 1082 1124 [self handleTouches:NSTouchPhaseBegan withEvent:theEvent]; 1125 #endif 1083 1126 } 1084 1127 1085 1128 - (void)touchesMovedWithEvent:(NSEvent *) theEvent 1086 1129 { 1130 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1087 1131 [self handleTouches:NSTouchPhaseMoved withEvent:theEvent]; 1132 #endif 1088 1133 } 1089 1134 1090 1135 - (void)touchesEndedWithEvent:(NSEvent *) theEvent 1091 1136 { 1137 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1092 1138 [self handleTouches:NSTouchPhaseEnded withEvent:theEvent]; 1139 #endif 1093 1140 } 1094 1141 1095 1142 - (void)touchesCancelledWithEvent:(NSEvent *) theEvent 1096 1143 { 1144 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1097 1145 [self handleTouches:NSTouchPhaseCancelled withEvent:theEvent]; 1146 #endif 1098 1147 } 1099 1148 1149 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1150 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1100 1151 - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent 1152 #else 1153 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event 1154 #endif 1101 1155 { 1156 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1157 NSSet *touches = 0; 1158 NSEnumerator *enumerator; 1159 NSTouch *touch; 1160 1161 switch (type) { 1162 case COCOA_TOUCH_DOWN: 1163 touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:nil]; 1164 break; 1165 case COCOA_TOUCH_UP: 1166 touches = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil]; 1167 break; 1168 case COCOA_TOUCH_CANCELLED: 1169 touches = [event touchesMatchingPhase:NSTouchPhaseCancelled inView:nil]; 1170 break; 1171 case COCOA_TOUCH_MOVE: 1172 touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:nil]; 1173 break; 1174 } 1175 1176 enumerator = [touches objectEnumerator]; 1177 touch = (NSTouch*)[enumerator nextObject]; 1178 while (touch) { 1179 const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; 1180 if (!SDL_GetTouch(touchId)) { 1181 if (SDL_AddTouch(touchId, "") < 0) { 1182 return; 1183 } 1184 } 1185 1186 const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; 1187 float x = [touch normalizedPosition].x; 1188 float y = [touch normalizedPosition].y; 1189 /* Make the origin the upper left instead of the lower left */ 1190 y = 1.0f - y; 1191 1192 switch (type) { 1193 case COCOA_TOUCH_DOWN: 1194 SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f); 1195 break; 1196 case COCOA_TOUCH_UP: 1197 case COCOA_TOUCH_CANCELLED: 1198 SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f); 1199 break; 1200 case COCOA_TOUCH_MOVE: 1201 SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f); 1202 break; 1203 } 1204 1205 touch = (NSTouch*)[enumerator nextObject]; 1206 } 1207 #else 1102 1208 NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; 1103 1209 1104 1210 for (NSTouch *touch in touches) { … … 1128 1234 break; 1129 1235 } 1130 1236 } 1237 #endif 1131 1238 } 1239 #endif 1132 1240 1133 1241 @end 1134 1242 … … 1200 1308 1201 1309 static int 1202 1310 SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) 1311 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1203 1312 { @autoreleasepool 1204 1313 { 1314 #else 1315 { 1316 NSAutoreleasePool *pool; 1317 #endif 1205 1318 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1206 1319 SDL_WindowData *data; 1207 1320 … … 1216 1329 data->videodata = videodata; 1217 1330 data->nscontexts = [[NSMutableArray alloc] init]; 1218 1331 1332 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1333 pool = [[NSAutoreleasePool alloc] init]; 1334 #endif 1219 1335 /* Create an event listener for the window */ 1220 1336 data->listener = [[Cocoa_WindowListener alloc] init]; 1221 1337 … … 1276 1392 */ 1277 1393 [nswindow setOneShot:NO]; 1278 1394 1395 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1396 [pool release]; 1397 #endif 1279 1398 /* All done! */ 1280 1399 window->driverdata = data; 1281 1400 return 0; 1401 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1402 } 1403 #else 1282 1404 }} 1405 #endif 1283 1406 1284 1407 int 1285 1408 Cocoa_CreateWindow(_THIS, SDL_Window * window) 1409 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1286 1410 { @autoreleasepool 1287 1411 { 1412 #else 1413 { 1414 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1415 #endif 1288 1416 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1289 1417 NSWindow *nswindow; 1290 1418 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); … … 1324 1452 } 1325 1453 1326 1454 if (videodata->allow_spaces) { 1455 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1327 1456 SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); 1328 1457 SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); 1329 1458 /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ … … 1331 1460 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 1332 1461 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 1333 1462 } 1463 #endif 1334 1464 } 1335 1465 1336 1466 /* Create a default view for this window */ … … 1359 1489 1360 1490 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { 1361 1491 [nswindow release]; 1492 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1493 [pool release]; 1494 #endif 1362 1495 return -1; 1363 1496 } 1364 1497 1365 1498 if (!(window->flags & SDL_WINDOW_OPENGL)) { 1499 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1500 [pool release]; 1501 #endif 1366 1502 return 0; 1367 1503 } 1368 1504 … … 1372 1508 #if SDL_VIDEO_OPENGL_EGL 1373 1509 if (Cocoa_GLES_SetupWindow(_this, window) < 0) { 1374 1510 Cocoa_DestroyWindow(_this, window); 1511 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1512 [pool release]; 1513 #endif 1375 1514 return -1; 1376 1515 } 1516 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1517 [pool release]; 1518 #endif 1377 1519 return 0; 1378 1520 #else 1521 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1522 [pool release]; 1523 #endif 1379 1524 return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); 1380 1525 #endif /* SDL_VIDEO_OPENGL_EGL */ 1381 1526 } 1382 1527 #endif /* SDL_VIDEO_OPENGL_ES2 */ 1528 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1529 [pool release]; 1530 #endif 1383 1531 return 0; 1532 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1384 1533 }} 1534 #else 1535 } 1536 #endif 1385 1537 1386 1538 int 1387 1539 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 1540 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1388 1541 { @autoreleasepool 1389 1542 { 1543 #else 1544 { 1545 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1546 #endif 1390 1547 NSWindow *nswindow = (NSWindow *) data; 1391 1548 NSString *title; 1392 1549 … … 1397 1554 } 1398 1555 1399 1556 return SetupWindowData(_this, window, nswindow, SDL_FALSE); 1557 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1400 1558 }} 1559 #else 1560 [pool release]; 1561 } 1562 #endif 1401 1563 1402 1564 void 1403 1565 Cocoa_SetWindowTitle(_THIS, SDL_Window * window) 1566 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1404 1567 { @autoreleasepool 1405 1568 { 1569 #else 1570 { 1571 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1572 #endif 1406 1573 const char *title = window->title ? window->title : ""; 1407 1574 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1408 1575 NSString *string = [[NSString alloc] initWithUTF8String:title]; 1409 1576 [nswindow setTitle:string]; 1410 1577 [string release]; 1578 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1411 1579 }} 1580 #else 1581 [pool release]; 1582 } 1583 #endif 1412 1584 1413 1585 void 1414 1586 Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 1587 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1415 1588 { @autoreleasepool 1416 1589 { 1590 #else 1591 { 1592 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1593 #endif 1417 1594 NSImage *nsimage = Cocoa_CreateImage(icon); 1418 1595 1419 1596 if (nsimage) { 1420 1597 [NSApp setApplicationIconImage:nsimage]; 1421 1598 } 1599 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1422 1600 }} 1601 #else 1602 [pool release]; 1603 } 1604 #endif 1423 1605 1424 1606 void 1425 1607 Cocoa_SetWindowPosition(_THIS, SDL_Window * window) 1608 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1426 1609 { @autoreleasepool 1427 1610 { 1611 #else 1612 { 1613 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1614 #endif 1428 1615 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1429 1616 NSWindow *nswindow = windata->nswindow; 1430 1617 NSRect rect; … … 1442 1629 s_moveHack = moveHack; 1443 1630 1444 1631 ScheduleContextUpdates(windata); 1632 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1445 1633 }} 1634 #else 1635 [pool release]; 1636 } 1637 #endif 1446 1638 1447 1639 void 1448 1640 Cocoa_SetWindowSize(_THIS, SDL_Window * window) 1641 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1449 1642 { @autoreleasepool 1450 1643 { 1644 #else 1645 { 1646 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1647 #endif 1451 1648 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1452 1649 NSWindow *nswindow = windata->nswindow; 1453 1650 NSRect rect; … … 1469 1666 s_moveHack = moveHack; 1470 1667 1471 1668 ScheduleContextUpdates(windata); 1669 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1472 1670 }} 1671 #else 1672 [pool release]; 1673 } 1674 #endif 1473 1675 1474 1676 void 1475 1677 Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) 1678 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1476 1679 { @autoreleasepool 1477 1680 { 1681 #else 1682 { 1683 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1684 #endif 1478 1685 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1479 1686 1480 1687 NSSize minSize; … … 1482 1689 minSize.height = window->min_h; 1483 1690 1484 1691 [windata->nswindow setContentMinSize:minSize]; 1692 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1485 1693 }} 1694 #else 1695 [pool release]; 1696 } 1697 #endif 1486 1698 1487 1699 void 1488 1700 Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) 1701 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1489 1702 { @autoreleasepool 1490 1703 { 1704 #else 1705 { 1706 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1707 #endif 1491 1708 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1492 1709 1493 1710 NSSize maxSize; … … 1495 1712 maxSize.height = window->max_h; 1496 1713 1497 1714 [windata->nswindow setContentMaxSize:maxSize]; 1715 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1498 1716 }} 1717 #else 1718 [pool release]; 1719 } 1720 #endif 1499 1721 1500 1722 void 1501 1723 Cocoa_ShowWindow(_THIS, SDL_Window * window) 1724 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1502 1725 { @autoreleasepool 1503 1726 { 1727 #else 1728 { 1729 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1730 #endif 1504 1731 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1505 1732 NSWindow *nswindow = windowData->nswindow; 1506 1733 … … 1509 1736 [nswindow makeKeyAndOrderFront:nil]; 1510 1737 [windowData->listener resumeVisibleObservation]; 1511 1738 } 1739 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1512 1740 }} 1741 #else 1742 [pool release]; 1743 } 1744 #endif 1513 1745 1514 1746 void 1515 1747 Cocoa_HideWindow(_THIS, SDL_Window * window) 1748 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1516 1749 { @autoreleasepool 1517 1750 { 1751 #else 1752 { 1753 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1754 #endif 1518 1755 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1519 1756 1520 1757 [nswindow orderOut:nil]; 1758 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1521 1759 }} 1760 #else 1761 [pool release]; 1762 } 1763 #endif 1522 1764 1523 1765 void 1524 1766 Cocoa_RaiseWindow(_THIS, SDL_Window * window) 1767 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1525 1768 { @autoreleasepool 1526 1769 { 1770 #else 1771 { 1772 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1773 #endif 1527 1774 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1528 1775 NSWindow *nswindow = windowData->nswindow; 1529 1776 … … 1536 1783 [nswindow makeKeyAndOrderFront:nil]; 1537 1784 } 1538 1785 [windowData->listener resumeVisibleObservation]; 1786 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1539 1787 }} 1788 #else 1789 [pool release]; 1790 } 1791 #endif 1540 1792 1541 1793 void 1542 1794 Cocoa_MaximizeWindow(_THIS, SDL_Window * window) 1795 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1543 1796 { @autoreleasepool 1544 1797 { 1798 #else 1799 { 1800 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1801 #endif 1545 1802 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1546 1803 NSWindow *nswindow = windata->nswindow; 1547 1804 1548 1805 [nswindow zoom:nil]; 1549 1806 1550 1807 ScheduleContextUpdates(windata); 1808 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1551 1809 }} 1810 #else 1811 [pool release]; 1812 } 1813 #endif 1552 1814 1553 1815 void 1554 1816 Cocoa_MinimizeWindow(_THIS, SDL_Window * window) 1817 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1555 1818 { @autoreleasepool 1556 1819 { 1820 #else 1821 { 1822 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1823 #endif 1557 1824 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1558 1825 NSWindow *nswindow = data->nswindow; 1559 1826 … … 1562 1829 } else { 1563 1830 [nswindow miniaturize:nil]; 1564 1831 } 1832 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1565 1833 }} 1834 #else 1835 [pool release]; 1836 } 1837 #endif 1566 1838 1567 1839 void 1568 1840 Cocoa_RestoreWindow(_THIS, SDL_Window * window) 1841 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1569 1842 { @autoreleasepool 1570 1843 { 1844 #else 1845 { 1846 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1847 #endif 1571 1848 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1572 1849 1573 1850 if ([nswindow isMiniaturized]) { … … 1575 1852 } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) { 1576 1853 [nswindow zoom:nil]; 1577 1854 } 1855 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1578 1856 }} 1857 #else 1858 [pool release]; 1859 } 1860 #endif 1579 1861 1580 1862 void 1581 1863 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) 1864 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1582 1865 { @autoreleasepool 1583 1866 { 1867 #else 1868 { 1869 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1870 #endif 1584 1871 if (SetWindowStyle(window, GetWindowStyle(window))) { 1585 1872 if (bordered) { 1586 1873 Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */ 1587 1874 } 1588 1875 } 1876 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1589 1877 }} 1878 #else 1879 [pool release]; 1880 } 1881 #endif 1882 1590 1883 1591 1884 void 1592 1885 Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) 1886 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1593 1887 { @autoreleasepool 1594 1888 { 1889 #else 1890 { 1891 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1892 #endif 1595 1893 /* Don't set this if we're in a space! 1596 1894 * The window will get permanently stuck if resizable is false. 1597 1895 * -flibit … … 1601 1899 if (![listener isInFullscreenSpace]) { 1602 1900 SetWindowStyle(window, GetWindowStyle(window)); 1603 1901 } 1902 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1604 1903 }} 1904 #else 1905 [pool release]; 1906 } 1907 #endif 1908 1605 1909 1606 1910 void 1607 1911 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) 1912 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1608 1913 { @autoreleasepool 1609 1914 { 1915 #else 1916 { 1917 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1918 #endif 1610 1919 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1611 1920 NSWindow *nswindow = data->nswindow; 1612 1921 NSRect rect; … … 1677 1986 } 1678 1987 1679 1988 ScheduleContextUpdates(data); 1989 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1680 1990 }} 1991 #else 1992 [pool release]; 1993 } 1994 #endif 1681 1995 1682 1996 int 1683 1997 Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) … … 1767 2081 1768 2082 void 1769 2083 Cocoa_DestroyWindow(_THIS, SDL_Window * window) 2084 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1770 2085 { @autoreleasepool 1771 2086 { 2087 #else 2088 { 2089 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2090 #endif 1772 2091 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1773 2092 1774 2093 if (data) { … … 1791 2110 SDL_free(data); 1792 2111 } 1793 2112 window->driverdata = NULL; 2113 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1794 2114 }} 2115 #else 2116 [pool release]; 2117 } 2118 #endif 1795 2119 1796 2120 SDL_bool 1797 2121 Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) … … 1823 2147 1824 2148 SDL_bool 1825 2149 Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) 2150 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1826 2151 { @autoreleasepool 1827 2152 { 2153 #else 2154 { 2155 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2156 #endif 1828 2157 SDL_bool succeeded = SDL_FALSE; 1829 2158 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1830 2159 … … 1855 2184 succeeded = SDL_TRUE; 1856 2185 } 1857 2186 2187 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 2188 [pool release]; 2189 #endif 1858 2190 return succeeded; 2191 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1859 2192 }} 2193 #else 2194 } 2195 #endif 1860 2196 1861 2197 int 1862 2198 Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)