diff --git a/cmake/Config.cmake b/cmake/Config.cmake index 29b25e84..de6efde9 100644 --- a/cmake/Config.cmake +++ b/cmake/Config.cmake @@ -23,7 +23,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") # detect OS X version. (use '/usr/bin/sw_vers -productVersion' to extract V from '10.V.x'.) EXEC_PROGRAM(/usr/bin/sw_vers ARGS -productVersion OUTPUT_VARIABLE MACOSX_VERSION_RAW) STRING(REGEX REPLACE "10\\.([0-9]).*" "\\1" MACOSX_VERSION "${MACOSX_VERSION_RAW}") - if(${MACOSX_VERSION} LESS 5) + if(${MACOSX_VERSION} LESS 7) message(FATAL_ERROR "Unsupported version of OS X : ${MACOSX_VERSION_RAW}") return() endif() diff --git a/examples/cocoa/CocoaAppDelegate.h b/examples/cocoa/CocoaAppDelegate.h index 2d4cd972..4ab0bbfd 100644 --- a/examples/cocoa/CocoaAppDelegate.h +++ b/examples/cocoa/CocoaAppDelegate.h @@ -36,11 +36,7 @@ struct SFMLmainWindow; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 @interface CocoaAppDelegate : NSObject { -#else -@interface CocoaAppDelegate : NSObject { -#endif @private NSWindow *m_window; NSView *m_sfmlView; diff --git a/src/SFML/Window/OSX/SFContext.mm b/src/SFML/Window/OSX/SFContext.mm index 00451e0d..e7c91181 100644 --- a/src/SFML/Window/OSX/SFContext.mm +++ b/src/SFML/Window/OSX/SFContext.mm @@ -129,11 +129,6 @@ void SFContext::display() //////////////////////////////////////////////////////////// void SFContext::setVerticalSyncEnabled(bool enabled) { - // Make compiler happy -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - typedef int GLint; -#endif - GLint swapInterval = enabled ? 1 : 0; [m_context setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; diff --git a/src/SFML/Window/OSX/SFWindowController.h b/src/SFML/Window/OSX/SFWindowController.h index c70a6590..1867ec36 100644 --- a/src/SFML/Window/OSX/SFWindowController.h +++ b/src/SFML/Window/OSX/SFWindowController.h @@ -53,12 +53,7 @@ namespace sf { /// m_fullscreenMode is bind to default video mode if we don't need to change screen size. /// //////////////////////////////////////////////////////////// - -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 // NSWindowDelegate is only define since 10.6 -@interface SFWindowController : NSResponder -#else @interface SFWindowController : NSResponder -#endif { NSWindow* m_window; ///< Underlying Cocoa window to be controlled SFOpenGLView* m_oglView; ///< OpenGL view for rendering diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index c8f8b6e3..65a5929d 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -431,9 +431,6 @@ bitsPerPixel:0]; // 0 == determine automatically // Load data pixels. -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1050 // We may need to define NSUInteger. -#define NSUInteger unsigned int -#endif for (unsigned int y = 0; y < height; ++y) { for (unsigned int x = 0; x < width; ++x, pixels+=4) diff --git a/src/SFML/Window/OSX/VideoModeImpl.cpp b/src/SFML/Window/OSX/VideoModeImpl.cpp index 73789228..18d550a3 100644 --- a/src/SFML/Window/OSX/VideoModeImpl.cpp +++ b/src/SFML/Window/OSX/VideoModeImpl.cpp @@ -35,44 +35,10 @@ namespace sf { namespace priv { -//////////////////////////////////////////////////////////// -/// Note : -/// Starting with 10.6, CGDisplayModeRef and CGDisplayCopyAllDisplayModes -/// should be used instead of CFDictionaryRef and CGDisplayAvailableModes. -/// + //////////////////////////////////////////////////////////// std::vector VideoModeImpl::getFullscreenModes() { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - - std::vector modes; - - // Retrieve array of dictionaries representing display modes. - CFArrayRef displayModes = CGDisplayAvailableModes(CGMainDisplayID()); - - if (displayModes == NULL) - { - sf::err() << "Couldn't get VideoMode for main display." << std::endl; - return modes; - } - - // Loop on each mode and convert it into a sf::VideoMode object. - const CFIndex modesCount = CFArrayGetCount(displayModes); - for (CFIndex i = 0; i < modesCount; i++) - { - CFDictionaryRef dictionary = (CFDictionaryRef)CFArrayGetValueAtIndex(displayModes, i); - - VideoMode mode = convertCGModeToSFMode(dictionary); - - // If not yet listed we add it to our modes array. - if (std::find(modes.begin(), modes.end(), mode) == modes.end()) - modes.push_back(mode); - } - - return modes; - -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - std::vector modes; // Retrieve all modes available for main screen only. @@ -101,8 +67,6 @@ std::vector VideoModeImpl::getFullscreenModes() CFRelease(cgmodes); return modes; - -#endif } diff --git a/src/SFML/Window/OSX/cg_sf_conversion.cpp b/src/SFML/Window/OSX/cg_sf_conversion.cpp index 079a1b61..b5adf4c9 100644 --- a/src/SFML/Window/OSX/cg_sf_conversion.cpp +++ b/src/SFML/Window/OSX/cg_sf_conversion.cpp @@ -35,7 +35,6 @@ namespace priv { //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 size_t modeBitsPerPixel(CGDisplayModeRef mode) { size_t bpp = 0; // no match @@ -54,19 +53,11 @@ size_t modeBitsPerPixel(CGDisplayModeRef mode) return bpp; } -#endif - //////////////////////////////////////////////////////////// size_t displayBitsPerPixel(CGDirectDisplayID displayId) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - - return CGDisplayBitsPerPixel(displayId); - -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - // Get the display mode. CGDisplayModeRef mode = CGDisplayCopyDisplayMode(displayId); @@ -77,32 +68,10 @@ size_t displayBitsPerPixel(CGDirectDisplayID displayId) CGDisplayModeRelease(mode); return bpp; - -#endif } //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - -VideoMode convertCGModeToSFMode(CFDictionaryRef dictionary) -{ - VideoMode sfmode; - - CFNumberRef cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayWidth); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.width)); - - cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayHeight); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.height)); - - cfnumber = (CFNumberRef)CFDictionaryGetValue(dictionary, kCGDisplayBitsPerPixel); - CFNumberGetValue(cfnumber, kCFNumberIntType, &(sfmode.bitsPerPixel)); - - return sfmode; -} - -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - VideoMode convertCGModeToSFMode(CGDisplayModeRef cgmode) { return VideoMode(CGDisplayModeGetWidth(cgmode), @@ -110,24 +79,8 @@ VideoMode convertCGModeToSFMode(CGDisplayModeRef cgmode) modeBitsPerPixel(cgmode)); } -#endif //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 - -CFDictionaryRef convertSFModeToCGMode(VideoMode sfmode) -{ - // If sfmode is in VideoMode::GetFullscreenModes - // then this should be an exact match (see NULL parameter doc). - return CGDisplayBestModeForParameters(CGMainDisplayID(), - sfmode.bitsPerPixel, - sfmode.width, - sfmode.height, - NULL); -} - -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - CGDisplayModeRef convertSFModeToCGMode(VideoMode sfmode) { // Starting with 10.6 we should query the display all the modes and @@ -167,7 +120,5 @@ CGDisplayModeRef convertSFModeToCGMode(VideoMode sfmode) return cgbestMode; } -#endif - } // namespace priv } // namespace sf diff --git a/src/SFML/Window/OSX/cg_sf_conversion.hpp b/src/SFML/Window/OSX/cg_sf_conversion.hpp index e849e49a..a60cce43 100644 --- a/src/SFML/Window/OSX/cg_sf_conversion.hpp +++ b/src/SFML/Window/OSX/cg_sf_conversion.hpp @@ -39,13 +39,11 @@ namespace priv //////////////////////////////////////////////////////////// /// \brief Get bpp of a video mode for OS 10.6 or later /// -/// With OS 10.6 and later, Quartz doesn't use anymore dictionaries +/// With OS 10.6 and later, Quartz doesn't use dictionaries any more /// to represent video mode. Instead it uses a CGDisplayMode opaque type. /// //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 size_t modeBitsPerPixel(CGDisplayModeRef mode); -#endif //////////////////////////////////////////////////////////// /// \brief Get bpp for all OS X version @@ -60,21 +58,13 @@ size_t displayBitsPerPixel(CGDirectDisplayID displayId); /// \brief Convert a Quartz video mode into a sf::VideoMode object /// //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 -VideoMode convertCGModeToSFMode(CFDictionaryRef dictionary); -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 VideoMode convertCGModeToSFMode(CGDisplayModeRef cgmode); -#endif //////////////////////////////////////////////////////////// /// \brief Convert a sf::VideoMode object into a Quartz video mode /// //////////////////////////////////////////////////////////// -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 -CFDictionaryRef convertSFModeToCGMode(VideoMode sfmode); -#else // MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 CGDisplayModeRef convertSFModeToCGMode(VideoMode sfmode); -#endif } // namespace priv } // namespace sf