Mac: Codify SDK and OS requirements, and clean up.
This #errors if you're using an SDK or deployment target that is less than 10.6 and 10.5, respectively, and cleans up uses of MAC_OS_X_VERSION_MIN_REQUIRED and MAC_OS_X_VERSION_MAX_ALLOWED according to those requirements.
This commit is contained in:
parent
defb16763d
commit
b01b128353
14 changed files with 30 additions and 159 deletions
|
@ -7,15 +7,13 @@
|
||||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.5 \
|
||||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
|
|
||||||
-I/usr/local/include"
|
-I/usr/local/include"
|
||||||
|
|
||||||
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
GCC_LINK_X86="-mmacosx-version-min=10.5"
|
||||||
|
|
||||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
||||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1050 \
|
|
||||||
-I/usr/local/include"
|
-I/usr/local/include"
|
||||||
|
|
||||||
GCC_LINK_X64="-mmacosx-version-min=10.6"
|
GCC_LINK_X64="-mmacosx-version-min=10.6"
|
||||||
|
|
|
@ -6,12 +6,11 @@
|
||||||
|
|
||||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
# Intel 32-bit compiler flags (10.5 runtime compatibility)
|
||||||
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X86="gcc -arch i386 -mmacosx-version-min=10.5 \
|
||||||
-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
|
|
||||||
-I/usr/local/include"
|
-I/usr/local/include"
|
||||||
|
|
||||||
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
GCC_LINK_X86="-mmacosx-version-min=10.5"
|
||||||
|
|
||||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
|
GCC_COMPILE_X64="gcc -arch x86_64 -mmacosx-version-min=10.6 \
|
||||||
|
|
|
@ -18,10 +18,10 @@ macro(CheckDLOPEN)
|
||||||
endif()
|
endif()
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
|
int main(int argc, char **argv) {
|
||||||
#error Use dlcompat for Mac OS X 10.2 compatibility
|
void *handle = dlopen("", RTLD_NOW);
|
||||||
#endif
|
const char *loaderror = (char *) dlerror();
|
||||||
int main(int argc, char **argv) {}" HAVE_DLOPEN)
|
}" HAVE_DLOPEN)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -2129,9 +2129,8 @@ AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[de
|
||||||
AC_TRY_COMPILE([
|
AC_TRY_COMPILE([
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
],[
|
],[
|
||||||
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED <= 1020
|
void *handle = dlopen("", RTLD_NOW);
|
||||||
#error Use dlcompat for Mac OS X 10.2 compatibility
|
const char *loaderror = (char *) dlerror();
|
||||||
#endif
|
|
||||||
],[
|
],[
|
||||||
have_dlopen=yes
|
have_dlopen=yes
|
||||||
])
|
])
|
||||||
|
|
|
@ -36,10 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Useful headers */
|
/* Useful headers */
|
||||||
/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
|
|
||||||
#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
|
|
||||||
#define HAVE_ALLOCA_H 1
|
#define HAVE_ALLOCA_H 1
|
||||||
#endif
|
|
||||||
#define HAVE_SYS_TYPES_H 1
|
#define HAVE_SYS_TYPES_H 1
|
||||||
#define HAVE_STDIO_H 1
|
#define HAVE_STDIO_H 1
|
||||||
#define STDC_HEADERS 1
|
#define STDC_HEADERS 1
|
||||||
|
|
|
@ -83,6 +83,12 @@
|
||||||
/* if not compiling for iPhone */
|
/* if not compiling for iPhone */
|
||||||
#undef __MACOSX__
|
#undef __MACOSX__
|
||||||
#define __MACOSX__ 1
|
#define __MACOSX__ 1
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||||
|
# error SDL for Mac OS X only supports deploying on 10.5 and above.
|
||||||
|
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060
|
||||||
|
# error SDL for Mac OS X must be built with a 10.6 SDK or above.
|
||||||
|
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1060 */
|
||||||
#endif /* TARGET_OS_IPHONE */
|
#endif /* TARGET_OS_IPHONE */
|
||||||
#endif /* defined(__APPLE__) */
|
#endif /* defined(__APPLE__) */
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,6 @@
|
||||||
#if MACOSX_COREAUDIO
|
#if MACOSX_COREAUDIO
|
||||||
#include <CoreAudio/CoreAudio.h>
|
#include <CoreAudio/CoreAudio.h>
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050
|
|
||||||
#include <AudioUnit/AUNTComponent.h>
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#include <AudioToolbox/AudioToolbox.h>
|
#include <AudioToolbox/AudioToolbox.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
static NSString *
|
static NSString *
|
||||||
GetTextFormat(_THIS)
|
GetTextFormat(_THIS)
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||||
|
|
||||||
if (data->osversion >= 0x1060) {
|
if (data->osversion >= 0x1060) {
|
||||||
|
@ -36,9 +35,6 @@ GetTextFormat(_THIS)
|
||||||
} else {
|
} else {
|
||||||
return NSStringPboardType;
|
return NSStringPboardType;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return NSStringPboardType;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -172,14 +172,9 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Needs long instead of NSInteger for compilation on Mac OS X 10.4 */
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
|
||||||
- (long) conversationIdentifier
|
|
||||||
#else
|
|
||||||
- (NSInteger) conversationIdentifier
|
- (NSInteger) conversationIdentifier
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return (long) self;
|
return (NSInteger) self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This method returns the index for character that is
|
/* This method returns the index for character that is
|
||||||
|
@ -486,22 +481,14 @@ HandleModifiers(_THIS, unsigned short scancode, unsigned int modifierFlags)
|
||||||
static void
|
static void
|
||||||
UpdateKeymap(SDL_VideoData *data)
|
UpdateKeymap(SDL_VideoData *data)
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
|
|
||||||
TISInputSourceRef key_layout;
|
TISInputSourceRef key_layout;
|
||||||
#else
|
|
||||||
KeyboardLayoutRef key_layout;
|
|
||||||
#endif
|
|
||||||
const void *chr_data;
|
const void *chr_data;
|
||||||
int i;
|
int i;
|
||||||
SDL_Scancode scancode;
|
SDL_Scancode scancode;
|
||||||
SDL_Keycode keymap[SDL_NUM_SCANCODES];
|
SDL_Keycode keymap[SDL_NUM_SCANCODES];
|
||||||
|
|
||||||
/* See if the keymap needs to be updated */
|
/* See if the keymap needs to be updated */
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
|
|
||||||
key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
key_layout = TISCopyCurrentKeyboardLayoutInputSource();
|
||||||
#else
|
|
||||||
KLGetCurrentKeyboardLayout(&key_layout);
|
|
||||||
#endif
|
|
||||||
if (key_layout == data->key_layout) {
|
if (key_layout == data->key_layout) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -509,16 +496,13 @@ UpdateKeymap(SDL_VideoData *data)
|
||||||
|
|
||||||
SDL_GetDefaultKeymap(keymap);
|
SDL_GetDefaultKeymap(keymap);
|
||||||
|
|
||||||
/* Try Unicode data first (preferred as of Mac OS X 10.5) */
|
/* Try Unicode data first */
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
|
|
||||||
CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData);
|
CFDataRef uchrDataRef = TISGetInputSourceProperty(key_layout, kTISPropertyUnicodeKeyLayoutData);
|
||||||
if (uchrDataRef)
|
if (uchrDataRef)
|
||||||
chr_data = CFDataGetBytePtr(uchrDataRef);
|
chr_data = CFDataGetBytePtr(uchrDataRef);
|
||||||
else
|
else
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#else
|
|
||||||
KLGetKeyboardLayoutProperty(key_layout, kKLuchrData, &chr_data);
|
|
||||||
#endif
|
|
||||||
if (chr_data) {
|
if (chr_data) {
|
||||||
UInt32 keyboard_type = LMGetKbdType();
|
UInt32 keyboard_type = LMGetKbdType();
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
@ -552,60 +536,8 @@ UpdateKeymap(SDL_VideoData *data)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1050
|
|
||||||
cleanup:
|
cleanup:
|
||||||
CFRelease(key_layout);
|
CFRelease(key_layout);
|
||||||
#else
|
|
||||||
/* Fall back to older style key map data */
|
|
||||||
KLGetKeyboardLayoutProperty(key_layout, kKLKCHRData, &chr_data);
|
|
||||||
if (chr_data) {
|
|
||||||
for (i = 0; i < 128; i++) {
|
|
||||||
UInt32 c, state = 0;
|
|
||||||
|
|
||||||
/* Make sure this scancode is a valid character scancode */
|
|
||||||
scancode = darwin_scancode_table[i];
|
|
||||||
if (scancode == SDL_SCANCODE_UNKNOWN ||
|
|
||||||
(keymap[scancode] & SDLK_SCANCODE_MASK)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
c = KeyTranslate (chr_data, i, &state) & 255;
|
|
||||||
if (state) {
|
|
||||||
/* Dead key, process key up */
|
|
||||||
c = KeyTranslate (chr_data, i | 128, &state) & 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c != 0 && c != 0x10) {
|
|
||||||
/* MacRoman to Unicode table, taken from X.org sources */
|
|
||||||
static const unsigned short macroman_table[128] = {
|
|
||||||
0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1,
|
|
||||||
0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8,
|
|
||||||
0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3,
|
|
||||||
0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb, 0xfc,
|
|
||||||
0x2020, 0xb0, 0xa2, 0xa3, 0xa7, 0x2022, 0xb6, 0xdf,
|
|
||||||
0xae, 0xa9, 0x2122, 0xb4, 0xa8, 0x2260, 0xc6, 0xd8,
|
|
||||||
0x221e, 0xb1, 0x2264, 0x2265, 0xa5, 0xb5, 0x2202, 0x2211,
|
|
||||||
0x220f, 0x3c0, 0x222b, 0xaa, 0xba, 0x3a9, 0xe6, 0xf8,
|
|
||||||
0xbf, 0xa1, 0xac, 0x221a, 0x192, 0x2248, 0x2206, 0xab,
|
|
||||||
0xbb, 0x2026, 0xa0, 0xc0, 0xc3, 0xd5, 0x152, 0x153,
|
|
||||||
0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0xf7, 0x25ca,
|
|
||||||
0xff, 0x178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02,
|
|
||||||
0x2021, 0xb7, 0x201a, 0x201e, 0x2030, 0xc2, 0xca, 0xc1,
|
|
||||||
0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3, 0xd4,
|
|
||||||
0xf8ff, 0xd2, 0xda, 0xdb, 0xd9, 0x131, 0x2c6, 0x2dc,
|
|
||||||
0xaf, 0x2d8, 0x2d9, 0x2da, 0xb8, 0x2dd, 0x2db, 0x2c7,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (c >= 128) {
|
|
||||||
c = macroman_table[c - 128];
|
|
||||||
}
|
|
||||||
keymap[scancode] = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
/* we need this for ShowMenuBar() and HideMenuBar(). */
|
/* we need this for ShowMenuBar() and HideMenuBar(). */
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
|
||||||
static inline void Cocoa_ToggleMenuBar(const BOOL show)
|
static inline void Cocoa_ToggleMenuBar(const BOOL show)
|
||||||
{
|
{
|
||||||
/* !!! FIXME: keep an eye on this.
|
/* !!! FIXME: keep an eye on this.
|
||||||
|
@ -47,33 +50,13 @@ static inline void Cocoa_ToggleMenuBar(const BOOL show)
|
||||||
|
|
||||||
|
|
||||||
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
|
/* !!! FIXME: clean out the pre-10.6 code when it makes sense to do so. */
|
||||||
#define FORCE_OLD_API 0 || (MAC_OS_X_VERSION_MAX_ALLOWED < 1060)
|
#define FORCE_OLD_API 0
|
||||||
|
|
||||||
#if FORCE_OLD_API
|
#if FORCE_OLD_API
|
||||||
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
||||||
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
|
#define MAC_OS_X_VERSION_MIN_REQUIRED 1050
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
|
|
||||||
/*
|
|
||||||
Add methods to get at private members of NSScreen.
|
|
||||||
Since there is a bug in Apple's screen switching code
|
|
||||||
that does not update this variable when switching
|
|
||||||
to fullscreen, we'll set it manually (but only for the
|
|
||||||
main screen).
|
|
||||||
*/
|
|
||||||
@interface NSScreen (NSScreenAccess)
|
|
||||||
- (void) setFrame:(NSRect)frame;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation NSScreen (NSScreenAccess)
|
|
||||||
- (void) setFrame:(NSRect)frame;
|
|
||||||
{
|
|
||||||
_frame = frame;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline BOOL
|
static inline BOOL
|
||||||
IS_SNOW_LEOPARD_OR_LATER(_THIS)
|
IS_SNOW_LEOPARD_OR_LATER(_THIS)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +125,6 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
|
||||||
}
|
}
|
||||||
data->moderef = moderef;
|
data->moderef = moderef;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
|
CGDisplayModeRef vidmode = (CGDisplayModeRef) moderef;
|
||||||
CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
|
CFStringRef fmt = CGDisplayModeCopyPixelEncoding(vidmode);
|
||||||
|
@ -162,7 +144,6 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
|
||||||
|
|
||||||
CFRelease(fmt);
|
CFRelease(fmt);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
|
@ -201,23 +182,17 @@ GetDisplayMode(_THIS, const void *moderef, SDL_DisplayMode *mode)
|
||||||
static inline void
|
static inline void
|
||||||
Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
|
Cocoa_ReleaseDisplayMode(_THIS, const void *moderef)
|
||||||
{
|
{
|
||||||
/* We don't own moderef unless we use the 10.6+ APIs. */
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
CGDisplayModeRelease((CGDisplayModeRef) moderef); /* NULL is ok */
|
CGDisplayModeRelease((CGDisplayModeRef) moderef); /* NULL is ok */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
|
Cocoa_ReleaseDisplayModeList(_THIS, CFArrayRef modelist)
|
||||||
{
|
{
|
||||||
/* We don't own modelis unless we use the 10.6+ APIs. */
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
CFRelease(modelist); /* NULL is ok */
|
CFRelease(modelist); /* NULL is ok */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
@ -280,11 +255,9 @@ Cocoa_InitModes(_THIS)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
moderef = CGDisplayCopyDisplayMode(displays[i]);
|
moderef = CGDisplayCopyDisplayMode(displays[i]);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
|
@ -344,11 +317,9 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata;
|
||||||
CFArrayRef modes = NULL;
|
CFArrayRef modes = NULL;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
|
modes = CGDisplayCopyAllDisplayModes(data->display, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
|
@ -364,11 +335,9 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
const void *moderef = CFArrayGetValueAtIndex(modes, i);
|
const void *moderef = CFArrayGetValueAtIndex(modes, i);
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
if (GetDisplayMode(_this, moderef, &mode)) {
|
if (GetDisplayMode(_this, moderef, &mode)) {
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
CGDisplayModeRetain((CGDisplayModeRef) moderef);
|
CGDisplayModeRetain((CGDisplayModeRef) moderef);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
SDL_AddDisplayMode(display, &mode);
|
SDL_AddDisplayMode(display, &mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,12 +349,10 @@ Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||||
static CGError
|
static CGError
|
||||||
Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
|
Cocoa_SwitchMode(_THIS, CGDirectDisplayID display, const void *mode)
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
|
return CGDisplaySetDisplayMode(display, (CGDisplayModeRef) mode, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||||
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
if (!IS_SNOW_LEOPARD_OR_LATER(_this)) {
|
||||||
return CGDisplaySwitchToMode(display, (CFDictionaryRef) mode);
|
return CGDisplaySwitchToMode(display, (CFDictionaryRef) mode);
|
||||||
|
|
|
@ -33,9 +33,11 @@ SDL_WindowShaper*
|
||||||
Cocoa_CreateShaper(SDL_Window* window) {
|
Cocoa_CreateShaper(SDL_Window* window) {
|
||||||
SDL_WindowData* windata = (SDL_WindowData*)window->driverdata;
|
SDL_WindowData* windata = (SDL_WindowData*)window->driverdata;
|
||||||
[windata->nswindow setOpaque:NO];
|
[windata->nswindow setOpaque:NO];
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
|
||||||
[windata->nswindow setStyleMask:NSBorderlessWindowMask];
|
if ([windata->nswindow respondsToSelector:@selector(setStyleMask:)]) {
|
||||||
#endif
|
[windata->nswindow setStyleMask:NSBorderlessWindowMask];
|
||||||
|
}
|
||||||
|
|
||||||
SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper));
|
SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper));
|
||||||
result->window = window;
|
result->window = window;
|
||||||
result->mode.mode = ShapeModeDefault;
|
result->mode.mode = ShapeModeDefault;
|
||||||
|
|
|
@ -39,16 +39,6 @@
|
||||||
#include "SDL_cocoaopengl.h"
|
#include "SDL_cocoaopengl.h"
|
||||||
#include "SDL_cocoawindow.h"
|
#include "SDL_cocoawindow.h"
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050
|
|
||||||
#if __LP64__
|
|
||||||
typedef long NSInteger;
|
|
||||||
typedef unsigned long NSUInteger;
|
|
||||||
#else
|
|
||||||
typedef int NSInteger;
|
|
||||||
typedef unsigned int NSUInteger;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Private display data */
|
/* Private display data */
|
||||||
|
|
||||||
@class SDLTranslatorResponder;
|
@class SDLTranslatorResponder;
|
||||||
|
|
|
@ -27,12 +27,7 @@
|
||||||
|
|
||||||
typedef struct SDL_WindowData SDL_WindowData;
|
typedef struct SDL_WindowData SDL_WindowData;
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
|
|
||||||
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
|
@interface Cocoa_WindowListener : NSResponder <NSWindowDelegate> {
|
||||||
#else
|
|
||||||
@interface Cocoa_WindowListener : NSResponder {
|
|
||||||
#endif
|
|
||||||
SDL_WindowData *_data;
|
SDL_WindowData *_data;
|
||||||
BOOL observingVisible;
|
BOOL observingVisible;
|
||||||
BOOL wasVisible;
|
BOOL wasVisible;
|
||||||
|
|
|
@ -81,11 +81,9 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
|
|
||||||
[view setNextResponder:self];
|
[view setNextResponder:self];
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
|
if ([view respondsToSelector:@selector(setAcceptsTouchEvents:)]) {
|
||||||
[view setAcceptsTouchEvents:YES];
|
[view setAcceptsTouchEvents:YES];
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||||
|
@ -450,7 +448,6 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
|
|
||||||
- (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
|
- (void)handleTouches:(cocoaTouchType)type withEvent:(NSEvent *)event
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
NSSet *touches = 0;
|
NSSet *touches = 0;
|
||||||
NSEnumerator *enumerator;
|
NSEnumerator *enumerator;
|
||||||
NSTouch *touch;
|
NSTouch *touch;
|
||||||
|
@ -499,7 +496,6 @@ static __inline__ void ConvertNSRect(NSRect *r)
|
||||||
|
|
||||||
touch = (NSTouch*)[enumerator nextObject];
|
touch = (NSTouch*)[enumerator nextObject];
|
||||||
}
|
}
|
||||||
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -939,8 +935,6 @@ Cocoa_RebuildWindow(SDL_WindowData * data, NSWindow * nswindow, unsigned style)
|
||||||
void
|
void
|
||||||
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
||||||
{
|
{
|
||||||
/* this message arrived in 10.6. You're out of luck on older OSes. */
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
if ([nswindow respondsToSelector:@selector(setStyleMask:)]) {
|
if ([nswindow respondsToSelector:@selector(setStyleMask:)]) {
|
||||||
|
@ -950,7 +944,6 @@ Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[pool release];
|
[pool release];
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue