Ticket #52210: patch-SDL2-2.0.3_OSX_105.diff

File patch-SDL2-2.0.3_OSX_105.diff, 22.5 KB (added by kencu (Ken), 7 years ago)
  • include/SDL_config.h

    Only in SDL2-2.0.3: Makefile
    Only in SDL2-2.0.3: Makefile.rules
    Only in SDL2-2.0.3: build
    Only in SDL2-2.0.3: config.log
    Only in SDL2-2.0.3: config.status
    diff -ru SDL2-2.0.3-orig/include/SDL_config.h SDL2-2.0.3/include/SDL_config.h
    old new  
     1/* include/SDL_config.h.  Generated from SDL_config.h.in by configure.  */
    12/*
    23  Simple DirectMedia Layer
    34  Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
     
    2223#ifndef _SDL_config_h
    2324#define _SDL_config_h
    2425
    25 #include "SDL_platform.h"
    26 
    2726/**
    28  *  \file SDL_config.h
     27 *  \file SDL_config.h.in
     28 *
     29 *  This is a set of defines to configure the SDL features
    2930 */
    3031
    31 /* Add any platform that doesn't build using the configure system. */
    32 #ifdef USING_PREMAKE_CONFIG_H
    33 #include "SDL_config_premake.h"
    34 #elif defined(__WIN32__)
    35 #include "SDL_config_windows.h"
    36 #elif defined(__WINRT__)
    37 #include "SDL_config_winrt.h"
    38 #elif defined(__MACOSX__)
    39 #include "SDL_config_macosx.h"
    40 #elif defined(__IPHONEOS__)
    41 #include "SDL_config_iphoneos.h"
    42 #elif defined(__ANDROID__)
    43 #include "SDL_config_android.h"
    44 #elif defined(__PSP__)
    45 #include "SDL_config_psp.h"
     32/* General platform specific identifiers */
     33#include "SDL_platform.h"
     34
     35/* Make sure that this isn't included by Visual C++ */
     36#ifdef _MSC_VER
     37#error You should run hg revert SDL_config.h
     38#endif
     39
     40/* C language features */
     41/* #undef const */
     42/* #undef inline */
     43/* #undef volatile */
     44
     45/* C datatypes */
     46#ifdef __LP64__
     47#define SIZEOF_VOIDP 8
    4648#else
    47 /* This is a minimal configuration just to get SDL running on new platforms */
    48 #include "SDL_config_minimal.h"
    49 #endif /* platform config */
     49#define SIZEOF_VOIDP 4
     50#endif
     51/* #undef HAVE_GCC_ATOMICS */
     52/* #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET */
     53/* #undef HAVE_PTHREAD_SPINLOCK */
     54
     55/* Comment this if you want to build without any C library requirements */
     56#define HAVE_LIBC 1
     57#if HAVE_LIBC
     58
     59/* Useful headers */
     60#define HAVE_ALLOCA_H 1
     61#define HAVE_SYS_TYPES_H 1
     62#define HAVE_STDIO_H 1
     63#define STDC_HEADERS 1
     64#define HAVE_STDLIB_H 1
     65#define HAVE_STDARG_H 1
     66/* #undef HAVE_MALLOC_H */
     67#define HAVE_MEMORY_H 1
     68#define HAVE_STRING_H 1
     69#define HAVE_STRINGS_H 1
     70#define HAVE_INTTYPES_H 1
     71#define HAVE_STDINT_H 1
     72#define HAVE_CTYPE_H 1
     73#define HAVE_MATH_H 1
     74#define HAVE_ICONV_H 1
     75#define HAVE_SIGNAL_H 1
     76#define HAVE_ALTIVEC_H 1
     77/* #undef HAVE_PTHREAD_NP_H */
     78/* #undef HAVE_LIBUDEV_H */
     79/* #undef HAVE_DBUS_DBUS_H */
    5080
    51 #ifdef USING_GENERATED_CONFIG_H
    52 #error Wrong SDL_config.h, check your include path?
     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
    5392#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_STRLEN 1
     101#define HAVE_STRLCPY 1
     102#define HAVE_STRLCAT 1
     103#define HAVE_STRDUP 1
     104/* #undef HAVE__STRREV */
     105/* #undef HAVE__STRUPR */
     106/* #undef HAVE__STRLWR */
     107/* #undef HAVE_INDEX */
     108/* #undef HAVE_RINDEX */
     109#define HAVE_STRCHR 1
     110#define HAVE_STRRCHR 1
     111#define HAVE_STRSTR 1
     112/* #undef HAVE_ITOA */
     113/* #undef HAVE__LTOA */
     114/* #undef HAVE__UITOA */
     115/* #undef HAVE__ULTOA */
     116#define HAVE_STRTOL 1
     117#define HAVE_STRTOUL 1
     118/* #undef HAVE__I64TOA */
     119/* #undef HAVE__UI64TOA */
     120#define HAVE_STRTOLL 1
     121#define HAVE_STRTOULL 1
     122#define HAVE_STRTOD 1
     123#define HAVE_ATOI 1
     124#define HAVE_ATOF 1
     125#define HAVE_STRCMP 1
     126#define HAVE_STRNCMP 1
     127/* #undef HAVE__STRICMP */
     128#define HAVE_STRCASECMP 1
     129/* #undef HAVE__STRNICMP */
     130#define HAVE_STRNCASECMP 1
     131/* #undef HAVE_SSCANF */
     132#define HAVE_VSSCANF 1
     133/* #undef HAVE_SNPRINTF */
     134#define HAVE_VSNPRINTF 1
     135#define HAVE_M_PI /**/
     136#define HAVE_ATAN 1
     137#define HAVE_ATAN2 1
     138#define HAVE_ACOS 1
     139#define HAVE_ASIN 1
     140#define HAVE_CEIL 1
     141#define HAVE_COPYSIGN 1
     142#define HAVE_COS 1
     143#define HAVE_COSF 1
     144#define HAVE_FABS 1
     145#define HAVE_FLOOR 1
     146#define HAVE_LOG 1
     147#define HAVE_POW 1
     148#define HAVE_SCALBN 1
     149#define HAVE_SIN 1
     150#define HAVE_SINF 1
     151#define HAVE_SQRT 1
     152#define HAVE_FSEEKO 1
     153/* #undef HAVE_FSEEKO64 */
     154#define HAVE_SIGACTION 1
     155#define HAVE_SA_SIGACTION 1
     156#define HAVE_SETJMP 1
     157#define HAVE_NANOSLEEP 1
     158#define HAVE_SYSCONF 1
     159#define HAVE_SYSCTLBYNAME 1
     160/* #undef HAVE_CLOCK_GETTIME */
     161/* #undef HAVE_GETPAGESIZE */
     162#define HAVE_MPROTECT 1
     163#define HAVE_ICONV 1
     164/* #undef HAVE_PTHREAD_SETNAME_NP */
     165/* #undef HAVE_PTHREAD_SET_NAME_NP */
     166/* #undef HAVE_SEM_TIMEDWAIT */
     167
     168#else
     169#define HAVE_STDARG_H 1
     170#define HAVE_STDDEF_H 1
     171#define HAVE_STDINT_H 1
     172#endif /* HAVE_LIBC */
     173
     174/* SDL internal assertion support */
     175/* #undef SDL_DEFAULT_ASSERT_LEVEL */
     176
     177/* Allow disabling of core subsystems */
     178/* #undef SDL_ATOMIC_DISABLED */
     179/* #undef SDL_AUDIO_DISABLED */
     180/* #undef SDL_CPUINFO_DISABLED */
     181/* #undef SDL_EVENTS_DISABLED */
     182/* #undef SDL_FILE_DISABLED */
     183/* #undef SDL_JOYSTICK_DISABLED */
     184/* #undef SDL_HAPTIC_DISABLED */
     185/* #undef SDL_LOADSO_DISABLED */
     186/* #undef SDL_RENDER_DISABLED */
     187/* #undef SDL_THREADS_DISABLED */
     188/* #undef SDL_TIMERS_DISABLED */
     189/* #undef SDL_VIDEO_DISABLED */
     190/* #undef SDL_POWER_DISABLED */
     191/* #undef SDL_FILESYSTEM_DISABLED */
     192
     193/* Enable various audio drivers */
     194/* #undef SDL_AUDIO_DRIVER_ALSA */
     195/* #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC */
     196/* #undef SDL_AUDIO_DRIVER_ARTS */
     197/* #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC */
     198/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO */
     199/* #undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */
     200/* #undef SDL_AUDIO_DRIVER_HAIKU */
     201/* #undef SDL_AUDIO_DRIVER_BSD */
     202#define SDL_AUDIO_DRIVER_COREAUDIO 1
     203#define SDL_AUDIO_DRIVER_DISK 1
     204#define SDL_AUDIO_DRIVER_DUMMY 1
     205/* #undef SDL_AUDIO_DRIVER_XAUDIO2 */
     206/* #undef SDL_AUDIO_DRIVER_DSOUND */
     207/* #undef SDL_AUDIO_DRIVER_ESD */
     208/* #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC */
     209/* #undef SDL_AUDIO_DRIVER_NAS */
     210/* #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC */
     211/* #undef SDL_AUDIO_DRIVER_SNDIO */
     212/* #undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC */
     213/* #undef SDL_AUDIO_DRIVER_OSS */
     214/* #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H */
     215/* #undef SDL_AUDIO_DRIVER_PAUDIO */
     216/* #undef SDL_AUDIO_DRIVER_QSA */
     217/* #undef SDL_AUDIO_DRIVER_SUNAUDIO */
     218/* #undef SDL_AUDIO_DRIVER_WINMM */
     219/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND */
     220/* #undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC */
     221
     222/* Enable various input drivers */
     223/* #undef SDL_INPUT_LINUXEV */
     224/* #undef SDL_INPUT_LINUXKD */
     225/* #undef SDL_INPUT_TSLIB */
     226/* #undef SDL_JOYSTICK_HAIKU */
     227/* #undef SDL_JOYSTICK_DINPUT */
     228/* #undef SDL_JOYSTICK_DUMMY */
     229#define SDL_JOYSTICK_IOKIT 1
     230/* #undef SDL_JOYSTICK_LINUX */
     231/* #undef SDL_JOYSTICK_WINMM */
     232/* #undef SDL_JOYSTICK_USBHID */
     233/* #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H */
     234/* #undef SDL_HAPTIC_DUMMY */
     235/* #undef SDL_HAPTIC_LINUX */
     236#define SDL_HAPTIC_IOKIT 1
     237/* #undef SDL_HAPTIC_DINPUT */
     238
     239/* Enable various shared object loading systems */
     240/* #undef SDL_LOADSO_HAIKU */
     241#define SDL_LOADSO_DLOPEN 1
     242/* #undef SDL_LOADSO_DUMMY */
     243/* #undef SDL_LOADSO_LDG */
     244/* #undef SDL_LOADSO_WINDOWS */
     245
     246/* Enable various threading systems */
     247#define SDL_THREAD_PTHREAD 1
     248#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
     249/* #undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP */
     250/* #undef SDL_THREAD_WINDOWS */
     251
     252/* Enable various timer systems */
     253/* #undef SDL_TIMER_HAIKU */
     254/* #undef SDL_TIMER_DUMMY */
     255#define SDL_TIMER_UNIX 1
     256/* #undef SDL_TIMER_WINDOWS */
     257
     258/* Enable various video drivers */
     259/* #undef SDL_VIDEO_DRIVER_HAIKU */
     260#define SDL_VIDEO_DRIVER_COCOA 1
     261/* #undef SDL_VIDEO_DRIVER_DIRECTFB */
     262/* #undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC */
     263#define SDL_VIDEO_DRIVER_DUMMY 1
     264/* #undef SDL_VIDEO_DRIVER_WINDOWS */
     265/* #undef SDL_VIDEO_DRIVER_WAYLAND */
     266/* #undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
     267/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */
     268/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL */
     269/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR */
     270/* #undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON */
     271/* #undef SDL_VIDEO_DRIVER_MIR */
     272/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC */
     273/* #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON */
     274/* #undef SDL_VIDEO_DRIVER_X11 */
     275/* #undef SDL_VIDEO_DRIVER_RPI */
     276/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC */
     277/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT */
     278/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR */
     279/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA */
     280/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 */
     281/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR */
     282/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS */
     283/* #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE */
     284/* #undef SDL_VIDEO_DRIVER_X11_XCURSOR */
     285/* #undef SDL_VIDEO_DRIVER_X11_XINERAMA */
     286/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2 */
     287/* #undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */
     288/* #undef SDL_VIDEO_DRIVER_X11_XRANDR */
     289/* #undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER */
     290/* #undef SDL_VIDEO_DRIVER_X11_XSHAPE */
     291/* #undef SDL_VIDEO_DRIVER_X11_XVIDMODE */
     292/* #undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS */
     293/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32 */
     294/* #undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY */
     295/* #undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM */
     296
     297/* #undef SDL_VIDEO_RENDER_D3D */
     298/* #undef SDL_VIDEO_RENDER_D3D11 */
     299#define SDL_VIDEO_RENDER_OGL 1
     300/* #undef SDL_VIDEO_RENDER_OGL_ES */
     301/* #undef SDL_VIDEO_RENDER_OGL_ES2 */
     302/* #undef SDL_VIDEO_RENDER_DIRECTFB */
     303
     304/* Enable OpenGL support */
     305#define SDL_VIDEO_OPENGL 1
     306/* #undef SDL_VIDEO_OPENGL_ES */
     307/* #undef SDL_VIDEO_OPENGL_ES2 */
     308/* #undef SDL_VIDEO_OPENGL_BGL */
     309#define SDL_VIDEO_OPENGL_CGL 1
     310/* #undef SDL_VIDEO_OPENGL_EGL */
     311/* #undef SDL_VIDEO_OPENGL_GLX */
     312/* #undef SDL_VIDEO_OPENGL_WGL */
     313/* #undef SDL_VIDEO_OPENGL_OSMESA */
     314/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
     315
     316/* Enable system power support */
     317/* #undef SDL_POWER_LINUX */
     318/* #undef SDL_POWER_WINDOWS */
     319#define SDL_POWER_MACOSX 1
     320/* #undef SDL_POWER_HAIKU */
     321/* #undef SDL_POWER_HARDWIRED */
     322
     323/* Enable system filesystem support */
     324/* #undef SDL_FILESYSTEM_HAIKU */
     325#define SDL_FILESYSTEM_COCOA 1
     326/* #undef SDL_FILESYSTEM_DUMMY */
     327/* #undef SDL_FILESYSTEM_UNIX */
     328/* #undef SDL_FILESYSTEM_WINDOWS */
     329
     330/* Enable assembly routines */
     331#define SDL_ASSEMBLY_ROUTINES 1
     332#define SDL_ALTIVEC_BLITTERS 1
    54333
    55334#endif /* _SDL_config_h */
  • include/SDL_platform.h

    diff -ru SDL2-2.0.3-orig/include/SDL_platform.h SDL2-2.0.3/include/SDL_platform.h
    old new  
    7070/* lets us know what version of Mac OS X we're compiling on */
    7171#include "AvailabilityMacros.h"
    7272#include "TargetConditionals.h"
    73 #if TARGET_OS_IPHONE
     73#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
    7474/* if compiling for iPhone */
    7575#undef __IPHONEOS__
    7676#define __IPHONEOS__ 1
     
    8080#undef __MACOSX__
    8181#define __MACOSX__  1
    8282#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
     83#if 0
    8384# error SDL for Mac OS X only supports deploying on 10.5 and above.
     85#endif
    8486#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
    8587#endif /* TARGET_OS_IPHONE */
    8688#endif /* defined(__APPLE__) */
  • src/joystick/darwin/SDL_sysjoystick.c

    Only in SDL2-2.0.3: libtool
    Only in SDL2-2.0.3: sdl2-config
    Only in SDL2-2.0.3: sdl2.pc
    diff -ru SDL2-2.0.3-orig/src/joystick/darwin/SDL_sysjoystick.c SDL2-2.0.3/src/joystick/darwin/SDL_sysjoystick.c
    old new  
    384384    device->instance_id = ++s_joystick_instance_id;
    385385
    386386    /* We have to do some storage of the io_service_t for SDL_HapticOpenFromJoystick */
     387#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    387388    if (IOHIDDeviceGetService != NULL) {  /* weak reference: available in 10.6 and later. */
    388389        const io_service_t ioservice = IOHIDDeviceGetService(ioHIDDeviceObject);
    389390        if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) {
     
    393394#endif
    394395        }
    395396    }
     397#endif
    396398
    397399    device->send_open_event = 1;
    398400    s_bDeviceAdded = SDL_TRUE;
  • src/video/cocoa/SDL_cocoaclipboard.m

    diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaclipboard.m SDL2-2.0.3/src/video/cocoa/SDL_cocoaclipboard.m
    old new  
    3030{
    3131    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
    3232
     33#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    3334    if (data->osversion >= 0x1060) {
    3435        return NSPasteboardTypeString;
    3536    } else {
     37#endif
    3638        return NSStringPboardType;
     39#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    3740    }
     41#endif
    3842}
    3943
    4044int
  • src/video/cocoa/SDL_cocoamodes.m

    diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoamodes.m SDL2-2.0.3/src/video/cocoa/SDL_cocoamodes.m
    old new  
    127127    }
    128128    data->moderef = moderef;
    129129
     130    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    130131    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    131132        CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
    132133        CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
     
    146147
    147148        CFRelease(fmt);
    148149    }
     150    #endif
    149151
    150152    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
    151153    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
     
    184186static void
    185187Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
    186188{
     189    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    187190    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    188191        CGDisplayModeRelease((CGDisplayModeRef) moderef);  /* NULL is ok */
    189192    }
     193    #endif
    190194}
    191195
    192196static void
    193197Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
    194198{
     199    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    195200    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    196201        CFRelease(modelist);  /* NULL is ok */
    197202    }
     203    #endif
    198204}
    199205
    200206static const char *
     
    257263                continue;
    258264            }
    259265
     266            #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    260267            if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    261268                moderef = CGDisplayCopyDisplayMode(displays[i]);
    262269            }
     270            #endif
    263271
    264272            #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
    265273            if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
     
    319327    SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
    320328    CFArrayRef modes = NULL;
    321329
     330    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    322331    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    323332        modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
    324333    }
     334    #endif
    325335
    326336    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
    327337    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
     
    337347            const void *moderef = CFArrayGetValueAtIndex(modes, i);
    338348            SDL_DisplayMode mode;
    339349            if (GetDisplayMode(_this, moderef, &mode)) {
     350    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    340351                if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    341352                    CGDisplayModeRetain((CGDisplayModeRef) moderef);
    342353                }
     354    #endif
    343355                SDL_AddDisplayMode(display, &mode);
    344356            }
    345357        }
     
    351363static CGError
    352364Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
    353365{
     366    #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    354367    if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
    355368        return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
    356369    }
     370    #endif
    357371 
    358372    #if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
    359373    if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
  • src/video/cocoa/SDL_cocoaopengl.m

    diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoaopengl.m SDL2-2.0.3/src/video/cocoa/SDL_cocoaopengl.m
    old new  
    347347
    348348    /* This gives us the correct viewport for a Retina-enabled view, only
    349349     * supported on 10.7+. */
     350#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    350351    if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) {
    351352        viewport = [contentView convertRectToBacking:viewport];
    352353    }
     354#endif
    353355
    354356    if (w) {
    355357        *w = viewport.size.width;
  • src/video/cocoa/SDL_cocoawindow.h

    diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.h SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.h
    old new  
    3535    PENDING_OPERATION_MINIMIZE
    3636} PendingWindowOperation;
    3737
     38#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    3839@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
     40#else
     41@interface Cocoa_WindowListener : NSResponder {
     42#endif
    3943    SDL_WindowData *_data;
    4044    BOOL observingVisible;
    4145    BOOL wasCtrlLeft;
     
    7377-(void) windowDidEnterFullScreen:(NSNotification *) aNotification;
    7478-(void) windowWillExitFullScreen:(NSNotification *) aNotification;
    7579-(void) windowDidExitFullScreen:(NSNotification *) aNotification;
     80#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    7681-(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions;
     82#endif
    7783
    7884/* Window event handling */
    7985-(void) mouseDown:(NSEvent *) theEvent;
  • src/video/cocoa/SDL_cocoawindow.m

    diff -ru SDL2-2.0.3-orig/src/video/cocoa/SDL_cocoawindow.m SDL2-2.0.3/src/video/cocoa/SDL_cocoawindow.m
    old new  
    2323#if SDL_VIDEO_DRIVER_COCOA
    2424
    2525#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
     26#if 0
    2627# error SDL for Mac OS X must be built with a 10.7 SDK or above.
     28#endif
    2729#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
    2830
    2931#include "SDL_syswm.h"
     
    190192        [center addObserver:self selector:@selector(windowDidDeminiaturize:) name:NSWindowDidDeminiaturizeNotification object:window];
    191193        [center addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:window];
    192194        [center addObserver:self selector:@selector(windowDidResignKey:) name:NSWindowDidResignKeyNotification object:window];
     195#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    193196        [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window];
    194197        [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window];
    195198        [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window];
    196199        [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window];
     200#endif
    197201    } else {
    198202        [window setDelegate:self];
    199203    }
     
    212216
    213217    [view setNextResponder:self];
    214218
     219#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    215220    if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
    216221        [view setAcceptsTouchEvents:YES];
    217222    }
     223#endif
    218224}
    219225
    220226- (void)observeValueForKeyPath:(NSString *)keyPath
     
    282288    inFullscreenTransition = YES;
    283289
    284290    /* you need to be FullScreenPrimary, or toggleFullScreen doesn't work. Unset it again in windowDidExitFullScreen. */
     291#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    285292    [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
     293#endif
    286294    [nswindow performSelectorOnMainThread: @selector(toggleFullScreen:) withObject:nswindow waitUntilDone:NO];
    287295    return YES;
    288296}
     
    319327        [center removeObserver:self name:NSWindowDidDeminiaturizeNotification object:window];
    320328        [center removeObserver:self name:NSWindowDidBecomeKeyNotification object:window];
    321329        [center removeObserver:self name:NSWindowDidResignKeyNotification object:window];
     330#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    322331        [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window];
    323332        [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window];
    324333        [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window];
    325334        [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window];
     335#endif
    326336    } else {
    327337        [window setDelegate:nil];
    328338    }
     
    597607        [nswindow miniaturize:nil];
    598608    } else {
    599609        /* Adjust the fullscreen toggle button and readd menu now that we're here. */
     610#if MAC_OS_X_VERSION_MIN_REQUIRED > 1070
    600611        if (window->flags & SDL_WINDOW_RESIZABLE) {
    601612            /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
    602613            [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
    603614        } else {
    604615            [nswindow setCollectionBehavior:NSWindowCollectionBehaviorManaged];
    605616        }
     617#endif
    606618        [NSMenu setMenuBarVisible:YES];
    607619
    608620        pendingWindowOperation = PENDING_OPERATION_NONE;
     
    620632    }
    621633}
    622634
     635#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    623636-(NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
    624637{
    625638    if ((_data->window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) {
     
    628641        return proposedOptions;
    629642    }
    630643}
     644#endif
    631645
    632646
    633647/* We'll respond to key events by doing nothing so we don't beep.
     
    822836    [self handleTouches:COCOA_TOUCH_CANCELLED withEvent:theEvent];
    823837}
    824838
     839#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    825840- (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
    826841{
    827842    NSSet *touches = 0;
     
    875890        touch = (NSTouch*)[enumerator nextObject];
    876891    }
    877892}
     893#endif
    878894
    879895@end
    880896
     
    10401056    [nswindow setBackgroundColor:[NSColor blackColor]];
    10411057
    10421058    if (videodata->allow_spaces) {
     1059#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
    10431060        SDL_assert(videodata->osversion >= 0x1070);
    10441061        SDL_assert([nswindow respondsToSelector:@selector(toggleFullScreen:)]);
    10451062        /* we put FULLSCREEN_DESKTOP windows in their own Space, without a toggle button or menubar, later */
     
    10471064            /* resizable windows are Spaces-friendly: they get the "go fullscreen" toggle button on their titlebar. */
    10481065            [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
    10491066        }
     1067#endif
    10501068    }
    10511069
    10521070    /* Create a default view for this window */