Ticket #52210: SDL2-2.0.7_OSX_105.patch
File SDL2-2.0.7_OSX_105.patch, 74.1 KB (added by miniupnp (Thomas BERNARD), 6 years ago) |
---|
-
include/SDL_config.h
Only in SDL2-2.0.7: Makefile Only in SDL2-2.0.7: Makefile.rules Only in SDL2-2.0.7: build Only in SDL2-2.0.7: config.log Only in SDL2-2.0.7: config.status diff -ru SDL2-2.0.7-orig/include/SDL_config.h SDL2-2.0.7/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-2017 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_ATAN 1 140 #define HAVE_ATAN2 1 141 #define HAVE_ACOS 1 142 #define HAVE_ASIN 1 143 #define HAVE_CEIL 1 144 #define HAVE_COPYSIGN 1 145 #define HAVE_COS 1 146 #define HAVE_COSF 1 147 #define HAVE_FABS 1 148 #define HAVE_FLOOR 1 149 #define HAVE_LOG 1 150 #define HAVE_POW 1 151 #define HAVE_SCALBN 1 152 #define HAVE_SIN 1 153 #define HAVE_SINF 1 154 #define HAVE_SQRT 1 155 #define HAVE_SQRTF 1 156 #define HAVE_TAN 1 157 #define HAVE_TANF 1 158 /* #undef HAVE_FOPEN64 */ 159 #define HAVE_FSEEKO 1 160 /* #undef HAVE_FSEEKO64 */ 161 #define HAVE_SIGACTION 1 162 #define HAVE_SA_SIGACTION 1 163 #define HAVE_SETJMP 1 164 #define HAVE_NANOSLEEP 1 165 #define HAVE_SYSCONF 1 166 #define HAVE_SYSCTLBYNAME 1 167 /* #undef HAVE_CLOCK_GETTIME */ 168 /* #undef HAVE_GETPAGESIZE */ 169 #define HAVE_MPROTECT 1 170 #define HAVE_ICONV 1 171 /* #undef HAVE_PTHREAD_SETNAME_NP */ 172 /* #undef HAVE_PTHREAD_SET_NAME_NP */ 173 /* #undef HAVE_SEM_TIMEDWAIT */ 174 /* #undef HAVE_GETAUXVAL */ 175 #define HAVE_POLL 1 176 177 #else 178 #define HAVE_STDARG_H 1 179 #define HAVE_STDDEF_H 1 180 #define HAVE_STDINT_H 1 181 #endif /* HAVE_LIBC */ 182 183 #define HAVE_ALTIVEC_H 1 184 /* #undef HAVE_LIBUDEV_H */ 185 /* #undef HAVE_DBUS_DBUS_H */ 186 /* #undef HAVE_IBUS_IBUS_H */ 187 /* #undef HAVE_FCITX_FRONTEND_H */ 188 /* #undef HAVE_LIBSAMPLERATE_H */ 189 190 /* #undef HAVE_DDRAW_H */ 191 /* #undef HAVE_DINPUT_H */ 192 /* #undef HAVE_DSOUND_H */ 193 /* #undef HAVE_DXGI_H */ 194 /* #undef HAVE_XINPUT_H */ 195 /* #undef HAVE_XINPUT_GAMEPAD_EX */ 196 /* #undef HAVE_XINPUT_STATE_EX */ 197 198 /* SDL internal assertion support */ 199 /* #undef SDL_DEFAULT_ASSERT_LEVEL */ 200 201 /* Allow disabling of core subsystems */ 202 /* #undef SDL_ATOMIC_DISABLED */ 203 /* #undef SDL_AUDIO_DISABLED */ 204 /* #undef SDL_CPUINFO_DISABLED */ 205 /* #undef SDL_EVENTS_DISABLED */ 206 /* #undef SDL_FILE_DISABLED */ 207 /* #undef SDL_JOYSTICK_DISABLED */ 208 /* #undef SDL_HAPTIC_DISABLED */ 209 /* #undef SDL_LOADSO_DISABLED */ 210 /* #undef SDL_RENDER_DISABLED */ 211 /* #undef SDL_THREADS_DISABLED */ 212 /* #undef SDL_TIMERS_DISABLED */ 213 /* #undef SDL_VIDEO_DISABLED */ 214 /* #undef SDL_POWER_DISABLED */ 215 /* #undef SDL_FILESYSTEM_DISABLED */ 216 217 /* Enable various audio drivers */ 218 /* #undef SDL_AUDIO_DRIVER_ALSA */ 219 /* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */ 220 /* #undef SDL_AUDIO_DRIVER_ANDROID */ 221 /* #undef SDL_AUDIO_DRIVER_ARTS */ 222 /* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */ 223 #define SDL_AUDIO_DRIVER_COREAUDIO 1 224 #define SDL_AUDIO_DRIVER_DISK 1 225 /* #undef SDL_AUDIO_DRIVER_DSOUND */ 226 #define SDL_AUDIO_DRIVER_DUMMY 1 227 /* #undef SDL_AUDIO_DRIVER_EMSCRIPTEN */ 228 /* #undef SDL_AUDIO_DRIVER_ESD */ 229 /* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */ 230 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */ 231 /* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */ 232 /* #undef SDL_AUDIO_DRIVER_HAIKU */ 233 /* #undef SDL_AUDIO_DRIVER_JACK */ 234 /* #undef SDL_AUDIO_DRIVER_JACK_DYNAMIC */ 235 /* #undef SDL_AUDIO_DRIVER_NACL */ 236 /* #undef SDL_AUDIO_DRIVER_NAS */ 237 /* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */ 238 /* #undef SDL_AUDIO_DRIVER_NETBSD */ 239 /* #undef SDL_AUDIO_DRIVER_OSS */ 240 /* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */ 241 /* #undef SDL_AUDIO_DRIVER_PAUDIO */ 242 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */ 243 /* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ 244 /* #undef SDL_AUDIO_DRIVER_QSA */ 245 /* #undef SDL_AUDIO_DRIVER_SNDIO */ 246 /* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */ 247 /* #undef SDL_AUDIO_DRIVER_SUNAUDIO */ 248 /* #undef SDL_AUDIO_DRIVER_WASAPI */ 249 /* #undef SDL_AUDIO_DRIVER_WINMM */ 250 /* #undef SDL_AUDIO_DRIVER_XAUDIO2 */ 251 252 /* Enable various input drivers */ 253 /* #undef SDL_INPUT_LINUXEV */ 254 /* #undef SDL_INPUT_LINUXKD */ 255 /* #undef SDL_INPUT_TSLIB */ 256 /* #undef SDL_JOYSTICK_HAIKU */ 257 /* #undef SDL_JOYSTICK_DINPUT */ 258 /* #undef SDL_JOYSTICK_XINPUT */ 259 /* #undef SDL_JOYSTICK_DUMMY */ 260 #define SDL_JOYSTICK_IOKIT 1 261 /* #undef SDL_JOYSTICK_LINUX */ 262 /* #undef SDL_JOYSTICK_ANDROID */ 263 /* #undef SDL_JOYSTICK_WINMM */ 264 /* #undef SDL_JOYSTICK_USBHID */ 265 /* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */ 266 /* #undef SDL_JOYSTICK_EMSCRIPTEN */ 267 /* #undef SDL_HAPTIC_DUMMY */ 268 /* #undef SDL_HAPTIC_LINUX */ 269 #define SDL_HAPTIC_IOKIT 1 270 /* #undef SDL_HAPTIC_DINPUT */ 271 /* #undef SDL_HAPTIC_XINPUT */ 272 273 /* Enable various shared object loading systems */ 274 #define SDL_LOADSO_DLOPEN 1 275 /* #undef SDL_LOADSO_DUMMY */ 276 /* #undef SDL_LOADSO_LDG */ 277 /* #undef SDL_LOADSO_WINDOWS */ 278 279 /* Enable various threading systems */ 280 #define SDL_THREAD_PTHREAD 1 281 #define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 282 /* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */ 283 /* #undef SDL_THREAD_WINDOWS */ 284 285 /* Enable various timer systems */ 286 /* #undef SDL_TIMER_HAIKU */ 287 /* #undef SDL_TIMER_DUMMY */ 288 #define SDL_TIMER_UNIX 1 289 /* #undef SDL_TIMER_WINDOWS */ 290 291 /* Enable various video drivers */ 292 /* #undef SDL_VIDEO_DRIVER_HAIKU */ 293 #define SDL_VIDEO_DRIVER_COCOA 1 294 /* #undef SDL_VIDEO_DRIVER_DIRECTFB */ 295 /* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */ 296 #define SDL_VIDEO_DRIVER_DUMMY 1 297 /* #undef SDL_VIDEO_DRIVER_WINDOWS */ 298 /* #undef SDL_VIDEO_DRIVER_WAYLAND */ 299 /* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ 300 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ 301 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */ 302 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */ 303 /* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */ 304 /* #undef SDL_VIDEO_DRIVER_MIR */ 305 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */ 306 /* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */ 307 #define SDL_VIDEO_DRIVER_X11 1 308 /* #undef SDL_VIDEO_DRIVER_RPI */ 309 /* #undef SDL_VIDEO_DRIVER_KMSDRM */ 310 /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ 311 /* #undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM */ 312 /* #undef SDL_VIDEO_DRIVER_ANDROID */ 313 /* #undef SDL_VIDEO_DRIVER_EMSCRIPTEN */ 314 #define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" 315 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" 316 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR "/usr/X11R6/lib/libXcursor.1.dylib" 317 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" 318 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */ 319 /* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */ 320 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" 321 #define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" 322 #define SDL_VIDEO_DRIVER_X11_XCURSOR 1 323 #define SDL_VIDEO_DRIVER_X11_XDBE 1 324 #define SDL_VIDEO_DRIVER_X11_XINERAMA 1 325 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */ 326 /* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ 327 /* #undef SDL_VIDEO_DRIVER_X11_XRANDR */ 328 #define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 329 #define SDL_VIDEO_DRIVER_X11_XSHAPE 1 330 #define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 331 /* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */ 332 /* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */ 333 #define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 334 /* #undef SDL_VIDEO_DRIVER_NACL */ 335 /* #undef SDL_VIDEO_DRIVER_VIVANTE */ 336 /* #undef SDL_VIDEO_DRIVER_VIVANTE_VDK */ 337 /* #undef SDL_VIDEO_DRIVER_QNX */ 338 339 /* #undef SDL_VIDEO_RENDER_D3D */ 340 /* #undef SDL_VIDEO_RENDER_D3D11 */ 341 #define SDL_VIDEO_RENDER_OGL 1 342 /* #undef SDL_VIDEO_RENDER_OGL_ES */ 343 /* #undef SDL_VIDEO_RENDER_OGL_ES2 */ 344 /* #undef SDL_VIDEO_RENDER_DIRECTFB */ 345 346 /* Enable OpenGL support */ 347 #define SDL_VIDEO_OPENGL 1 348 /* #undef SDL_VIDEO_OPENGL_ES */ 349 /* #undef SDL_VIDEO_OPENGL_ES2 */ 350 /* #undef SDL_VIDEO_OPENGL_BGL */ 351 #define SDL_VIDEO_OPENGL_CGL 1 352 /* #undef SDL_VIDEO_OPENGL_EGL */ 353 #define SDL_VIDEO_OPENGL_GLX 1 354 /* #undef SDL_VIDEO_OPENGL_WGL */ 355 /* #undef SDL_VIDEO_OPENGL_OSMESA */ 356 /* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */ 357 358 /* Enable Vulkan support */ 359 /* #undef SDL_VIDEO_VULKAN */ 360 361 /* Enable system power support */ 362 /* #undef SDL_POWER_LINUX */ 363 /* #undef SDL_POWER_WINDOWS */ 364 #define SDL_POWER_MACOSX 1 365 /* #undef SDL_POWER_HAIKU */ 366 /* #undef SDL_POWER_ANDROID */ 367 /* #undef SDL_POWER_EMSCRIPTEN */ 368 /* #undef SDL_POWER_HARDWIRED */ 369 370 /* Enable system filesystem support */ 371 /* #undef SDL_FILESYSTEM_HAIKU */ 372 #define SDL_FILESYSTEM_COCOA 1 373 /* #undef SDL_FILESYSTEM_DUMMY */ 374 /* #undef SDL_FILESYSTEM_UNIX */ 375 /* #undef SDL_FILESYSTEM_WINDOWS */ 376 /* #undef SDL_FILESYSTEM_NACL */ 377 /* #undef SDL_FILESYSTEM_ANDROID */ 378 /* #undef SDL_FILESYSTEM_EMSCRIPTEN */ 379 380 /* Enable assembly routines */ 381 #define SDL_ASSEMBLY_ROUTINES 1 382 #define SDL_ALTIVEC_BLITTERS 1 383 384 /* Enable ime support */ 385 /* #undef SDL_USE_IME */ 386 387 /* Enable dynamic udev support */ 388 /* #undef SDL_UDEV_DYNAMIC */ 389 390 /* Enable dynamic libsamplerate support */ 391 /* #undef SDL_LIBSAMPLERATE_DYNAMIC */ 52 392 53 393 #endif /* SDL_config_h_ */ -
include/SDL_platform.h
diff -ru SDL2-2.0.7-orig/include/SDL_platform.h SDL2-2.0.7/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.7-orig/include/SDL_syswm.h SDL2-2.0.7/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.7: libtool Only in SDL2-2.0.7: sdl2-config Only in SDL2-2.0.7: sdl2-config.cmake Only in SDL2-2.0.7: sdl2.pc diff -ru SDL2-2.0.7-orig/src/atomic/SDL_spinlock.c SDL2-2.0.7/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.7-orig/src/file/cocoa/SDL_rwopsbundlesupport.m SDL2-2.0.7/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.7-orig/src/filesystem/cocoa/SDL_sysfilesystem.m SDL2-2.0.7/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.7-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.7/src/joystick/darwin/SDL_sysjoystick.c
old new 459 459 device->instance_id = ++s_joystick_instance_id; 460 460 461 461 /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */ 462 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 462 463 ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); 464 #else 465 ioservice = 0; 466 #endif 463 467 #if SDL_HAPTIC_IOKIT 464 468 if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { 465 469 device->ffservice = ioservice; -
src/video/cocoa/SDL_cocoaclipboard.m
diff -ru SDL2-2.0.7-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoaevents.m SDL2-2.0.7/src/video/cocoa/SDL_cocoaevents.m
old new 55 55 SDL_VideoDevice *_this = SDL_GetVideoDevice(); 56 56 57 57 switch ([theEvent type]) { 58 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 59 case NSLeftMouseDown: 60 case NSOtherMouseDown: 61 case NSRightMouseDown: 62 case NSLeftMouseUp: 63 case NSOtherMouseUp: 64 case NSRightMouseUp: 65 case NSLeftMouseDragged: 66 case NSRightMouseDragged: 67 case NSOtherMouseDragged: /* usually middle mouse dragged */ 68 case NSMouseMoved: 69 case NSScrollWheel: 70 #else 58 71 case NSEventTypeLeftMouseDown: 59 72 case NSEventTypeOtherMouseDown: 60 73 case NSEventTypeRightMouseDown: … … 66 79 case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */ 67 80 case NSEventTypeMouseMoved: 68 81 case NSEventTypeScrollWheel: 82 #endif 69 83 Cocoa_HandleMouseEvent(_this, theEvent); 70 84 break; 85 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 86 case NSKeyDown: 87 case NSKeyUp: 88 case NSFlagsChanged: 89 #else 71 90 case NSEventTypeKeyDown: 72 91 case NSEventTypeKeyUp: 73 92 case NSEventTypeFlagsChanged: 93 #endif 74 94 Cocoa_HandleKeyEvent(_this, theEvent); 75 95 break; 76 96 default: … … 97 117 - (void)setAppleMenu:(NSMenu *)menu; 98 118 @end 99 119 120 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 100 121 @interface SDLAppDelegate : NSObject <NSApplicationDelegate> { 122 #else 123 @interface SDLAppDelegate : NSObject { 124 #endif 101 125 @public 102 126 BOOL seenFirstActivate; 103 127 } … … 157 181 */ 158 182 for (NSWindow *window in [NSApp orderedWindows]) { 159 183 if (window != win && [window canBecomeKeyWindow]) { 160 if (![window isOnActiveSpace]) { 161 continue; 184 if ([window respondsToSelector:@selector(isOnActiveSpace)]) { 185 if (![window isOnActiveSpace]) { 186 continue; 187 } 162 188 } 163 189 [window makeKeyAndOrderFront:self]; 164 190 return; … … 340 366 [windowMenu release]; 341 367 342 368 369 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 343 370 /* Add the fullscreen view toggle menu option, if supported */ 344 371 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { 345 372 /* Create the view menu */ … … 357 384 358 385 [viewMenu release]; 359 386 } 387 #endif 360 388 } 361 389 362 390 void 363 391 Cocoa_RegisterApp(void) 392 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 364 393 { @autoreleasepool 365 394 { 395 #else 396 { 397 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 398 #endif 366 399 /* This can get called more than once! Be careful what you initialize! */ 367 400 368 401 if (NSApp == nil) { … … 372 405 s_bShouldHandleEventsInSDLApplication = SDL_TRUE; 373 406 374 407 if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { 408 #if defined(MAC_OS_X_VERSION_10_6) 375 409 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; 410 #endif 376 411 } 377 412 378 413 if ([NSApp mainMenu] == nil) { … … 399 434 appDelegate->seenFirstActivate = YES; 400 435 } 401 436 } 437 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 402 438 }} 439 #else 440 [pool release]; 441 } 442 #endif 403 443 404 444 void 405 445 Cocoa_PumpEvents(_THIS) 446 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 406 447 { @autoreleasepool 407 448 { 449 #else 450 { 451 NSAutoreleasePool *pool; 452 #endif 408 453 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 409 454 /* Update activity every 30 seconds to prevent screensaver */ 410 455 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 418 463 } 419 464 #endif 420 465 466 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 467 pool = [[NSAutoreleasePool alloc] init]; 468 #endif 421 469 for ( ; ; ) { 470 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 471 NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 472 #else 422 473 NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; 474 #endif 423 475 if ( event == nil ) { 424 476 break; 425 477 } … … 431 483 // Pass events down to SDLApplication to be handled in sendEvent: 432 484 [NSApp sendEvent:event]; 433 485 } 486 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 434 487 }} 488 #else 489 [pool release]; 490 } 491 #endif 435 492 436 493 void 437 494 Cocoa_SuspendScreenSaver(_THIS) 495 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 438 496 { @autoreleasepool 439 497 { 440 498 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; … … 461 519 &data->screensaver_assertion); 462 520 } 463 521 }} 522 #else 523 { 524 } 525 #endif 464 526 465 527 #endif /* SDL_VIDEO_DRIVER_COCOA */ 466 528 -
src/video/cocoa/SDL_cocoakeyboard.m
Only in SDL2-2.0.7/src/video/cocoa: SDL_cocoaevents.m.orig Only in SDL2-2.0.7/src/video/cocoa: SDL_cocoaevents.m.rej diff -ru SDL2-2.0.7-orig/src/video/cocoa/SDL_cocoakeyboard.m SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoamessagebox.m SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoamodes.h SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.7/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, CFArrayRef modelist, CVDisplayLinkRef link, SDL_DisplayMode *mode) 105 #else 106 GetDisplayMode(_THIS, const void *moderef, CFArrayRef modelist, 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 = (int) CGDisplayModeGetWidth(vidmode); 107 112 int height = (int) CGDisplayModeGetHeight(vidmode); 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 /* Ignore this mode if it's low-dpi (@1x) and we have a high-dpi mode in the 113 124 * list with the same size in points. … … 145 156 if (!data) { 146 157 return SDL_FALSE; 147 158 } 159 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 148 160 data->moderef = vidmode; 161 #else 162 data->moderef = moderef; 163 #endif 149 164 165 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 150 166 fmt = CGDisplayModeCopyPixelEncoding(vidmode); 151 167 refreshRate = (int) (CGDisplayModeGetRefreshRate(vidmode) + 0.5); 152 168 … … 164 180 } 165 181 166 182 CFRelease(fmt); 183 #else 184 { 185 CFNumberRef number; 186 double refresh; 187 CFDictionaryRef vidmode = (CFDictionaryRef) moderef; 188 number = CFDictionaryGetValue(vidmode, kCGDisplayWidth); 189 CFNumberGetValue(number, kCFNumberLongType, &width); 190 number = CFDictionaryGetValue(vidmode, kCGDisplayHeight); 191 CFNumberGetValue(number, kCFNumberLongType, &height); 192 number = CFDictionaryGetValue(vidmode, kCGDisplayBitsPerPixel); 193 CFNumberGetValue(number, kCFNumberLongType, &bpp); 194 number = CFDictionaryGetValue(vidmode, kCGDisplayRefreshRate); 195 CFNumberGetValue(number, kCFNumberDoubleType, &refresh); 196 refreshRate = (long) (refresh + 0.5); 197 } 198 #endif 167 199 168 200 /* CGDisplayModeGetRefreshRate returns 0 for many non-CRT displays. */ 169 201 if (refreshRate == 0 && link != NULL) { … … 212 244 213 245 void 214 246 Cocoa_InitModes(_THIS) 247 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 215 248 { @autoreleasepool 216 249 { 250 #else 251 { 252 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 253 #endif 217 254 CGDisplayErr result; 218 255 CGDirectDisplayID *displays; 219 256 CGDisplayCount numDisplays; … … 222 259 result = CGGetOnlineDisplayList(0, NULL, &numDisplays); 223 260 if (result != kCGErrorSuccess) { 224 261 CG_SetError("CGGetOnlineDisplayList()", result); 262 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 263 [pool release]; 264 #endif 225 265 return; 226 266 } 227 267 displays = SDL_stack_alloc(CGDirectDisplayID, numDisplays); … … 229 269 if (result != kCGErrorSuccess) { 230 270 CG_SetError("CGGetOnlineDisplayList()", result); 231 271 SDL_stack_free(displays); 272 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 273 [pool release]; 274 #endif 232 275 return; 233 276 } 234 277 … … 238 281 SDL_VideoDisplay display; 239 282 SDL_DisplayData *displaydata; 240 283 SDL_DisplayMode mode; 284 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 241 285 CGDisplayModeRef moderef = NULL; 286 #else 287 const void *moderef = NULL; 288 #endif 242 289 CVDisplayLinkRef link = NULL; 243 290 244 291 if (pass == 0) { … … 255 302 continue; 256 303 } 257 304 305 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 258 306 moderef = CGDisplayCopyDisplayMode(displays[i]); 307 #else 308 moderef = CGDisplayCurrentMode(displays[i]); 309 #endif 259 310 260 311 if (!moderef) { 261 312 continue; … … 263 314 264 315 displaydata = (SDL_DisplayData *) SDL_malloc(sizeof(*displaydata)); 265 316 if (!displaydata) { 317 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 266 318 CGDisplayModeRelease(moderef); 319 #endif 267 320 continue; 268 321 } 269 322 displaydata->display = displays[i]; … … 275 328 display.name = (char *)Cocoa_GetDisplayName(displays[i]); 276 329 if (!GetDisplayMode(_this, moderef, NULL, link, &mode)) { 277 330 CVDisplayLinkRelease(link); 331 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 278 332 CGDisplayModeRelease(moderef); 333 #endif 279 334 SDL_free(display.name); 280 335 SDL_free(displaydata); 281 336 continue; … … 291 346 } 292 347 } 293 348 SDL_stack_free(displays); 349 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 350 [pool release]; 351 } 352 #else 294 353 }} 354 #endif 295 355 296 356 int 297 357 Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) … … 391 451 } 392 452 #endif 393 453 454 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 394 455 modes = CGDisplayCopyAllDisplayModes(data->display, dict); 456 #else 457 modes = CGDisplayAvailableModes(data->display); 458 #endif 395 459 396 460 if (dict != NULL) { 397 461 CFRelease(dict); … … 405 469 CVDisplayLinkCreateWithCGDisplay(data->display, &link); 406 470 407 471 for (i = 0; i < count; i++) { 472 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 408 473 CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); 474 #else 475 const void *moderef = CFArrayGetValueAtIndex(modes, i); 476 #endif 409 477 SDL_DisplayMode mode; 410 478 if (GetDisplayMode(_this, moderef, modes, link, &mode)) { 479 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 411 480 CGDisplayModeRetain(moderef); 481 #endif 412 482 SDL_AddDisplayMode(display, &mode); 413 483 } 414 484 } … … 433 503 434 504 if (data == display->desktop_mode.driverdata) { 435 505 /* Restoring desktop mode */ 506 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 436 507 CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 508 #else 509 CGDisplaySwitchToMode(displaydata->display, data->moderef); 510 #endif 437 511 438 512 if (CGDisplayIsMain(displaydata->display)) { 439 513 CGReleaseAllDisplays(); … … 458 532 } 459 533 460 534 /* Do the physical switch */ 535 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 461 536 result = CGDisplaySetDisplayMode(displaydata->display, data->moderef, NULL); 537 #else 538 result = CGDisplaySwitchToMode(displaydata->display, data->moderef); 539 #endif 462 540 if (result != kCGErrorSuccess) { 463 541 CG_SetError("CGDisplaySwitchToMode()", result); 464 542 goto ERR_NO_SWITCH; … … 503 581 } 504 582 505 583 mode = (SDL_DisplayModeData *) display->desktop_mode.driverdata; 584 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 506 585 CGDisplayModeRelease(mode->moderef); 586 #endif 507 587 508 588 for (j = 0; j < display->num_display_modes; j++) { 509 589 mode = (SDL_DisplayModeData*) display->display_modes[j].driverdata; 590 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 510 591 CGDisplayModeRelease(mode->moderef); 592 #endif 511 593 } 512 594 513 595 } -
src/video/cocoa/SDL_cocoamouse.m
diff -ru SDL2-2.0.7-orig/src/video/cocoa/SDL_cocoamouse.m SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.7/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 int 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 479 [pool release]; 480 #endif 393 481 return 0; 482 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 394 483 }} 484 #else 485 } 486 #endif 395 487 396 488 void 397 489 Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context) 490 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 398 491 { @autoreleasepool 399 492 { 493 #else 494 { 495 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 496 #endif 400 497 SDLOpenGLContext *nscontext = (SDLOpenGLContext *)context; 401 498 402 499 [nscontext setWindow:NULL]; 403 500 [nscontext release]; 501 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 404 502 }} 503 #else 504 [pool release]; 505 } 506 #endif 405 507 406 508 #endif /* SDL_VIDEO_OPENGL_CGL */ 407 509 -
src/video/cocoa/SDL_cocoashape.m
diff -ru SDL2-2.0.7-orig/src/video/cocoa/SDL_cocoashape.m SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoavideo.h SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoavideo.m SDL2-2.0.7/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" … … 159 166 Cocoa_InitKeyboard(_this); 160 167 Cocoa_InitMouse(_this); 161 168 169 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 162 170 data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); 163 171 164 172 /* The IOPM assertion API can disable the screensaver as of 10.7. */ 165 173 data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; 174 #else 175 data->allow_spaces = 0; 176 data->screensaver_use_iopm = 0; 177 #endif 166 178 167 179 return 0; 168 180 } -
src/video/cocoa/SDL_cocoawindow.h
diff -ru SDL2-2.0.7-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.7/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.7-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.7/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" … … 54 56 #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) 55 57 56 58 59 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 60 @interface SDLWindow : NSWindow 61 #else 57 62 @interface SDLWindow : NSWindow <NSDraggingDestination> 63 #endif 58 64 /* These are needed for borderless/fullscreen windows */ 59 65 - (BOOL)canBecomeKeyWindow; 60 66 - (BOOL)canBecomeMainWindow; … … 136 142 } 137 143 138 144 - (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 145 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 139 146 { @autoreleasepool 140 147 { 148 #else 149 { 150 NSAutoreleasePool *pool; 151 #endif 141 152 NSPasteboard *pasteboard = [sender draggingPasteboard]; 142 153 NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; 143 154 NSString *desiredType = [pasteboard availableTypeFromArray:types]; … … 152 163 return NO; 153 164 } 154 165 166 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 167 pool = [[NSAutoreleasePool alloc] init]; 168 #endif 169 155 170 SDL_assert([desiredType isEqualToString:NSFilenamesPboardType]); 156 171 NSArray *array = [pasteboard propertyListForType:@"NSFilenamesPboardType"]; 157 172 158 173 for (NSString *path in array) { 159 174 NSURL *fileURL = [NSURL fileURLWithPath:path]; 175 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 160 176 NSNumber *isAlias = nil; 161 177 162 178 [fileURL getResourceValue:&isAlias forKey:NSURLIsAliasFileKey error:nil]; … … 177 193 } 178 194 } 179 195 } 196 #endif 180 197 181 198 if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { 199 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 200 [pool release]; 201 #endif 182 202 return NO; 183 203 } 184 204 } 185 205 206 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 207 [pool release]; 208 #endif 186 209 SDL_SendDropComplete(sdlwindow); 187 210 return YES; 211 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 212 } 213 #else 188 214 }} 215 #endif 189 216 190 217 - (BOOL)wantsPeriodicDraggingUpdates 191 218 { … … 313 340 [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window]; 314 341 [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window]; 315 342 [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window]; 343 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 316 344 [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; 317 345 [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; 318 346 [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; 319 347 [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; 320 348 [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; 349 #endif 321 350 [center addObserver:self selector:@selector(windowDidFailToEnterFullScreen:) name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 322 351 [center addObserver:self selector:@selector(windowDidFailToExitFullScreen:) name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 323 352 } else { … … 408 437 inFullscreenTransition = YES; 409 438 410 439 /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */ 440 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 411 441 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 442 #endif 412 443 [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO]; 413 444 return YES; 414 445 } … … 444 475 [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window]; 445 476 [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window]; 446 477 [center removeObserver:self name:NSWindowDidResignKeyNotification object:window]; 478 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 447 479 [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; 448 480 [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; 449 481 [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; 450 482 [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; 451 483 [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; 484 #endif 452 485 [center removeObserver:self name:@"NSWindowDidFailToEnterFullScreenNotification" object:window]; 453 486 [center removeObserver:self name:@"NSWindowDidFailToExitFullScreenNotification" object:window]; 454 487 } else { … … 628 661 [NSMenu setMenuBarVisible:NO]; 629 662 } 630 663 664 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 631 665 const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; 632 666 _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; 633 667 SDL_ToggleModState(KMOD_CAPS, newflags != 0); 668 #endif 634 669 } 635 670 636 671 - (void)windowDidResignKey:(NSNotification *)aNotification … … 657 692 658 693 - (void)windowDidChangeBackingProperties:(NSNotification *)aNotification 659 694 { 695 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 660 696 NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; 661 697 662 698 if (inFullscreenTransition) { … … 669 705 _data->window->h = 0; 670 706 [self windowDidResize:aNotification]; 671 707 } 708 #endif 672 709 } 673 710 674 711 - (void)windowWillEnterFullScreen:(NSNotification *)aNotification … … 777 814 [nswindow miniaturize:nil]; 778 815 } else { 779 816 /* Adjust the fullscreen toggle button and readd menu now that we're here. */ 817 #if MAC_OS_X_VERSION_MIN_REQUIRED > 1070 780 818 if (window->flags & SDL_WINDOW_RESIZABLE) { 781 819 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 782 820 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 783 821 } else { 784 822 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged]; 785 823 } 824 #endif 786 825 [NSMenu setMenuBarVisible:YES]; 787 826 788 827 pendingWindowOperation = PENDING_OPERATION_NONE; … … 825 864 } 826 865 } 827 866 867 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 828 868 -(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions 829 869 { 830 870 if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { … … 833 873 return proposedOptions; 834 874 } 835 875 } 876 #endif 836 877 837 878 838 879 /* We'll respond to key events by doing nothing so we don't beep. … … 1059 1100 1060 1101 - (void)touchesBeganWithEvent:(NSEvent *) theEvent 1061 1102 { 1103 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1062 1104 NSSet *touches = [theEvent touchesMatchingPhase:NSTouchPhaseAny inView:nil]; 1063 1105 int existingTouchCount = 0; 1064 1106 … … 1079 1121 1080 1122 DLog("Began Fingers: %lu .. existing: %d", (unsigned long)[touches count], existingTouchCount); 1081 1123 [self handleTouches:NSTouchPhaseBegan withEvent:theEvent]; 1124 #endif 1082 1125 } 1083 1126 1084 1127 - (void)touchesMovedWithEvent:(NSEvent *) theEvent 1085 1128 { 1129 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1086 1130 [self handleTouches:NSTouchPhaseMoved withEvent:theEvent]; 1131 #endif 1087 1132 } 1088 1133 1089 1134 - (void)touchesEndedWithEvent:(NSEvent *) theEvent 1090 1135 { 1136 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1091 1137 [self handleTouches:NSTouchPhaseEnded withEvent:theEvent]; 1138 #endif 1092 1139 } 1093 1140 1094 1141 - (void)touchesCancelledWithEvent:(NSEvent *) theEvent 1095 1142 { 1143 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1096 1144 [self handleTouches:NSTouchPhaseCancelled withEvent:theEvent]; 1145 #endif 1097 1146 } 1098 1147 1148 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1149 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1099 1150 - (void)handleTouches:(NSTouchPhase) phase withEvent:(NSEvent *) theEvent 1151 #else 1152 - (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event 1153 #endif 1100 1154 { 1155 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1156 NSSet *touches = 0; 1157 NSEnumerator *enumerator; 1158 NSTouch *touch; 1159 1160 switch (type) { 1161 case COCOA_TOUCH_DOWN: 1162 touches = [event touchesMatchingPhase:NSTouchPhaseBegan inView:nil]; 1163 break; 1164 case COCOA_TOUCH_UP: 1165 touches = [event touchesMatchingPhase:NSTouchPhaseEnded inView:nil]; 1166 break; 1167 case COCOA_TOUCH_CANCELLED: 1168 touches = [event touchesMatchingPhase:NSTouchPhaseCancelled inView:nil]; 1169 break; 1170 case COCOA_TOUCH_MOVE: 1171 touches = [event touchesMatchingPhase:NSTouchPhaseMoved inView:nil]; 1172 break; 1173 } 1174 1175 enumerator = [touches objectEnumerator]; 1176 touch = (NSTouch*)[enumerator nextObject]; 1177 while (touch) { 1178 const SDL_TouchID touchId = (SDL_TouchID)(intptr_t)[touch device]; 1179 if (!SDL_GetTouch(touchId)) { 1180 if (SDL_AddTouch(touchId, "") < 0) { 1181 return; 1182 } 1183 } 1184 1185 const SDL_FingerID fingerId = (SDL_FingerID)(intptr_t)[touch identity]; 1186 float x = [touch normalizedPosition].x; 1187 float y = [touch normalizedPosition].y; 1188 /* Make the origin the upper left instead of the lower left */ 1189 y = 1.0f - y; 1190 1191 switch (type) { 1192 case COCOA_TOUCH_DOWN: 1193 SDL_SendTouch(touchId, fingerId, SDL_TRUE, x, y, 1.0f); 1194 break; 1195 case COCOA_TOUCH_UP: 1196 case COCOA_TOUCH_CANCELLED: 1197 SDL_SendTouch(touchId, fingerId, SDL_FALSE, x, y, 1.0f); 1198 break; 1199 case COCOA_TOUCH_MOVE: 1200 SDL_SendTouchMotion(touchId, fingerId, x, y, 1.0f); 1201 break; 1202 } 1203 1204 touch = (NSTouch*)[enumerator nextObject]; 1205 } 1206 #else 1101 1207 NSSet *touches = [theEvent touchesMatchingPhase:phase inView:nil]; 1102 1208 1103 1209 for (NSTouch *touch in touches) { … … 1127 1233 break; 1128 1234 } 1129 1235 } 1236 #endif 1130 1237 } 1238 #endif 1131 1239 1132 1240 @end 1133 1241 … … 1194 1302 1195 1303 static int 1196 1304 SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created) 1305 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1197 1306 { @autoreleasepool 1198 1307 { 1308 #else 1309 { 1310 NSAutoreleasePool *pool; 1311 #endif 1199 1312 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1200 1313 SDL_WindowData *data; 1201 1314 … … 1210 1323 data->videodata = videodata; 1211 1324 data->nscontexts = [[NSMutableArray alloc] init]; 1212 1325 1326 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1327 pool = [[NSAutoreleasePool alloc] init]; 1328 #endif 1213 1329 /* Create an event listener for the window */ 1214 1330 data->listener = [[Cocoa_WindowListener alloc] init]; 1215 1331 … … 1270 1386 */ 1271 1387 [nswindow setOneShot:NO]; 1272 1388 1389 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1390 [pool release]; 1391 #endif 1273 1392 /* All done! */ 1274 1393 window->driverdata = data; 1275 1394 return 0; 1395 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1396 } 1397 #else 1276 1398 }} 1399 #endif 1277 1400 1278 1401 int 1279 1402 Cocoa_CreateWindow(_THIS, SDL_Window * window) 1403 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1280 1404 { @autoreleasepool 1281 1405 { 1406 #else 1407 { 1408 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1409 #endif 1282 1410 SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; 1283 1411 NSWindow *nswindow; 1284 1412 SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); … … 1319 1447 [nswindow setBackgroundColor:[NSColor blackColor]]; 1320 1448 1321 1449 if (videodata->allow_spaces) { 1450 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 1322 1451 SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); 1323 1452 SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]); 1324 1453 /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */ … … 1326 1455 /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */ 1327 1456 [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; 1328 1457 } 1458 #endif 1329 1459 } 1330 1460 1331 1461 /* Create a default view for this window */ … … 1344 1474 1345 1475 /* Allow files and folders to be dragged onto the window by users */ 1346 1476 [nswindow registerForDraggedTypes:[NSArray arrayWithObject:(NSString *)kUTTypeFileURL]]; 1477 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 1478 [pool release]; 1479 #endif 1347 1480 1348 1481 if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) { 1349 1482 [nswindow release]; 1350 1483 return -1; 1351 1484 } 1352 1485 return 0; 1486 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1353 1487 }} 1488 #else 1489 } 1490 #endif 1354 1491 1355 1492 int 1356 1493 Cocoa_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 1494 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1357 1495 { @autoreleasepool 1358 1496 { 1497 #else 1498 { 1499 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1500 #endif 1359 1501 NSWindow *nswindow = (NSWindow *) data; 1360 1502 NSString *title; 1361 1503 … … 1366 1508 } 1367 1509 1368 1510 return SetupWindowData(_this, window, nswindow, SDL_FALSE); 1511 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1369 1512 }} 1513 #else 1514 [pool release]; 1515 } 1516 #endif 1370 1517 1371 1518 void 1372 1519 Cocoa_SetWindowTitle(_THIS, SDL_Window * window) 1520 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1373 1521 { @autoreleasepool 1374 1522 { 1523 #else 1524 { 1525 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1526 #endif 1375 1527 const char *title = window->title ? window->title : ""; 1376 1528 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1377 1529 NSString *string = [[NSString alloc] initWithUTF8String:title]; 1378 1530 [nswindow setTitle:string]; 1379 1531 [string release]; 1532 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1380 1533 }} 1534 #else 1535 [pool release]; 1536 } 1537 #endif 1381 1538 1382 1539 void 1383 1540 Cocoa_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 1541 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1384 1542 { @autoreleasepool 1385 1543 { 1544 #else 1545 { 1546 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1547 #endif 1386 1548 NSImage *nsimage = Cocoa_CreateImage(icon); 1387 1549 1388 1550 if (nsimage) { 1389 1551 [NSApp setApplicationIconImage:nsimage]; 1390 1552 } 1553 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1391 1554 }} 1555 #else 1556 [pool release]; 1557 } 1558 #endif 1392 1559 1393 1560 void 1394 1561 Cocoa_SetWindowPosition(_THIS, SDL_Window * window) 1562 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1395 1563 { @autoreleasepool 1396 1564 { 1565 #else 1566 { 1567 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1568 #endif 1397 1569 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1398 1570 NSWindow *nswindow = windata->nswindow; 1399 1571 NSRect rect; … … 1411 1583 s_moveHack = moveHack; 1412 1584 1413 1585 ScheduleContextUpdates(windata); 1586 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1414 1587 }} 1588 #else 1589 [pool release]; 1590 } 1591 #endif 1415 1592 1416 1593 void 1417 1594 Cocoa_SetWindowSize(_THIS, SDL_Window * window) 1595 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1418 1596 { @autoreleasepool 1419 1597 { 1598 #else 1599 { 1600 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1601 #endif 1420 1602 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1421 1603 NSWindow *nswindow = windata->nswindow; 1422 1604 NSRect rect; … … 1438 1620 s_moveHack = moveHack; 1439 1621 1440 1622 ScheduleContextUpdates(windata); 1623 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1441 1624 }} 1625 #else 1626 [pool release]; 1627 } 1628 #endif 1442 1629 1443 1630 void 1444 1631 Cocoa_SetWindowMinimumSize(_THIS, SDL_Window * window) 1632 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1445 1633 { @autoreleasepool 1446 1634 { 1635 #else 1636 { 1637 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1638 #endif 1447 1639 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1448 1640 1449 1641 NSSize minSize; … … 1451 1643 minSize.height = window->min_h; 1452 1644 1453 1645 [windata->nswindow setContentMinSize:minSize]; 1646 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1454 1647 }} 1648 #else 1649 [pool release]; 1650 } 1651 #endif 1455 1652 1456 1653 void 1457 1654 Cocoa_SetWindowMaximumSize(_THIS, SDL_Window * window) 1655 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1458 1656 { @autoreleasepool 1459 1657 { 1658 #else 1659 { 1660 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1661 #endif 1460 1662 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1461 1663 1462 1664 NSSize maxSize; … … 1464 1666 maxSize.height = window->max_h; 1465 1667 1466 1668 [windata->nswindow setContentMaxSize:maxSize]; 1669 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1467 1670 }} 1671 #else 1672 [pool release]; 1673 } 1674 #endif 1468 1675 1469 1676 void 1470 1677 Cocoa_ShowWindow(_THIS, SDL_Window * window) 1678 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1471 1679 { @autoreleasepool 1472 1680 { 1681 #else 1682 { 1683 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1684 #endif 1473 1685 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1474 1686 NSWindow *nswindow = windowData->nswindow; 1475 1687 … … 1478 1690 [nswindow makeKeyAndOrderFront:nil]; 1479 1691 [windowData->listener resumeVisibleObservation]; 1480 1692 } 1693 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1481 1694 }} 1695 #else 1696 [pool release]; 1697 } 1698 #endif 1482 1699 1483 1700 void 1484 1701 Cocoa_HideWindow(_THIS, SDL_Window * window) 1702 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1485 1703 { @autoreleasepool 1486 1704 { 1705 #else 1706 { 1707 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1708 #endif 1487 1709 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1488 1710 1489 1711 [nswindow orderOut:nil]; 1712 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1490 1713 }} 1714 #else 1715 [pool release]; 1716 } 1717 #endif 1491 1718 1492 1719 void 1493 1720 Cocoa_RaiseWindow(_THIS, SDL_Window * window) 1721 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1494 1722 { @autoreleasepool 1495 1723 { 1724 #else 1725 { 1726 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1727 #endif 1496 1728 SDL_WindowData *windowData = ((SDL_WindowData *) window->driverdata); 1497 1729 NSWindow *nswindow = windowData->nswindow; 1498 1730 … … 1505 1737 [nswindow makeKeyAndOrderFront:nil]; 1506 1738 } 1507 1739 [windowData->listener resumeVisibleObservation]; 1740 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1508 1741 }} 1742 #else 1743 [pool release]; 1744 } 1745 #endif 1509 1746 1510 1747 void 1511 1748 Cocoa_MaximizeWindow(_THIS, SDL_Window * window) 1749 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1512 1750 { @autoreleasepool 1513 1751 { 1752 #else 1753 { 1754 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1755 #endif 1514 1756 SDL_WindowData *windata = (SDL_WindowData *) window->driverdata; 1515 1757 NSWindow *nswindow = windata->nswindow; 1516 1758 1517 1759 [nswindow zoom:nil]; 1518 1760 1519 1761 ScheduleContextUpdates(windata); 1762 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1520 1763 }} 1764 #else 1765 [pool release]; 1766 } 1767 #endif 1521 1768 1522 1769 void 1523 1770 Cocoa_MinimizeWindow(_THIS, SDL_Window * window) 1771 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1524 1772 { @autoreleasepool 1525 1773 { 1774 #else 1775 { 1776 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1777 #endif 1526 1778 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1527 1779 NSWindow *nswindow = data->nswindow; 1528 1780 … … 1531 1783 } else { 1532 1784 [nswindow miniaturize:nil]; 1533 1785 } 1786 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1534 1787 }} 1788 #else 1789 [pool release]; 1790 } 1791 #endif 1535 1792 1536 1793 void 1537 1794 Cocoa_RestoreWindow(_THIS, SDL_Window * window) 1795 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1538 1796 { @autoreleasepool 1539 1797 { 1798 #else 1799 { 1800 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1801 #endif 1540 1802 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow; 1541 1803 1542 1804 if ([nswindow isMiniaturized]) { … … 1544 1806 } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) { 1545 1807 [nswindow zoom:nil]; 1546 1808 } 1809 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1547 1810 }} 1811 #else 1812 [pool release]; 1813 } 1814 #endif 1548 1815 1549 1816 void 1550 1817 Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) 1818 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1551 1819 { @autoreleasepool 1552 1820 { 1821 #else 1822 { 1823 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1824 #endif 1553 1825 if (SetWindowStyle(window, GetWindowStyle(window))) { 1554 1826 if (bordered) { 1555 1827 Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */ 1556 1828 } 1557 1829 } 1830 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1558 1831 }} 1832 #else 1833 [pool release]; 1834 } 1835 #endif 1836 1559 1837 1560 1838 void 1561 1839 Cocoa_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) 1840 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1562 1841 { @autoreleasepool 1563 1842 { 1843 #else 1844 { 1845 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1846 #endif 1564 1847 /* Don't set this if we're in a space! 1565 1848 * The window will get permanently stuck if resizable is false. 1566 1849 * -flibit … … 1570 1853 if (![listener isInFullscreenSpace]) { 1571 1854 SetWindowStyle(window, GetWindowStyle(window)); 1572 1855 } 1856 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1573 1857 }} 1858 #else 1859 [pool release]; 1860 } 1861 #endif 1862 1574 1863 1575 1864 void 1576 1865 Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) 1866 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1577 1867 { @autoreleasepool 1578 1868 { 1869 #else 1870 { 1871 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 1872 #endif 1579 1873 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1580 1874 NSWindow *nswindow = data->nswindow; 1581 1875 NSRect rect; … … 1646 1940 } 1647 1941 1648 1942 ScheduleContextUpdates(data); 1943 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1649 1944 }} 1945 #else 1946 [pool release]; 1947 } 1948 #endif 1650 1949 1651 1950 int 1652 1951 Cocoa_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) … … 1736 2035 1737 2036 void 1738 2037 Cocoa_DestroyWindow(_THIS, SDL_Window * window) 2038 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1739 2039 { @autoreleasepool 1740 2040 { 2041 #else 2042 { 2043 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2044 #endif 1741 2045 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1742 2046 1743 2047 if (data) { … … 1760 2064 SDL_free(data); 1761 2065 } 1762 2066 window->driverdata = NULL; 2067 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1763 2068 }} 2069 #else 2070 [pool release]; 2071 } 2072 #endif 1764 2073 1765 2074 SDL_bool 1766 2075 Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) … … 1792 2101 1793 2102 SDL_bool 1794 2103 Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state) 2104 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1795 2105 { @autoreleasepool 1796 2106 { 2107 #else 2108 { 2109 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 2110 #endif 1797 2111 SDL_bool succeeded = SDL_FALSE; 1798 2112 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 1799 2113 … … 1824 2138 succeeded = SDL_TRUE; 1825 2139 } 1826 2140 2141 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 2142 [pool release]; 2143 #endif 1827 2144 return succeeded; 2145 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 1828 2146 }} 2147 #else 2148 } 2149 #endif 1829 2150 1830 2151 int 1831 2152 Cocoa_SetWindowHitTest(SDL_Window * window, SDL_bool enabled)