From a49723178d25dbabe76f05440d18fcd706b60896 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 8 Nov 2015 13:35:16 +0100 Subject: [PATCH] Changed: Centralize OS X 10.6 check in NL_MAC_VERSION_10_6_UP --HG-- branch : develop --- .../3d/driver/opengl/driver_opengl_window.cpp | 17 ++++++++++------- .../opengl/mac/cocoa_application_delegate.h | 2 +- .../driver/opengl/mac/cocoa_event_emitter.cpp | 3 ++- .../3d/driver/opengl/mac/cocoa_opengl_view.m | 2 +- .../driver/opengl/mac/cocoa_window_delegate.h | 2 +- code/nel/src/3d/driver/opengl/stdopengl.h | 6 ++++++ 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index e45d031a6..8cfd26228 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1793,7 +1793,7 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle) // put the view in fullscreen mode, hiding the dock but enabling the menubar // to pop up if the mouse hits the top screen border. // NOTE: withOptions:nil disables + application switching! -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP [containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: @@ -1917,8 +1917,9 @@ bool CDriverGL::setMode(const GfxMode& mode) return true; } -#if defined(NL_OS_MAC) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_OS_MAC +#ifdef NL_MAC_VERSION_10_6_UP /// helper to extract bits per pixel value from screen mode, only 16 or 32 bits static int bppFromDisplayMode(CGDisplayModeRef mode) @@ -1936,7 +1937,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode) return 0; } -#elif defined(NL_OS_MAC) +#else long GetDictionaryLong(CFDictionaryRef theDict, const void* key) { @@ -1953,7 +1954,9 @@ long GetDictionaryLong(CFDictionaryRef theDict, const void* key) #define GetModeHeight(mode) GetDictionaryLong((mode), kCGDisplayHeight) #define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel) -#endif // defined(NL_OS_MAC) +#endif + +#endif // NL_OS_MAC // -------------------------------------------------- bool CDriverGL::getModes(std::vector &modes) @@ -2000,7 +2003,7 @@ bool CDriverGL::getModes(std::vector &modes) { CGDirectDisplayID dspy = display[i]; -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL); #else CFArrayRef modeList = CGDisplayAvailableModes(dspy); @@ -2014,7 +2017,7 @@ bool CDriverGL::getModes(std::vector &modes) for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j) { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j); uint8 bpp = bppFromDisplayMode(mode); #else @@ -2024,7 +2027,7 @@ bool CDriverGL::getModes(std::vector &modes) if (bpp >= 16) { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP uint16 w = CGDisplayModeGetWidth(mode); uint16 h = CGDisplayModeGetHeight(mode); #else diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h index da033c7c1..9577bda40 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_application_delegate.h @@ -27,7 +27,7 @@ using NL3D::CDriverGL; #endif @interface CocoaApplicationDelegate : NSObject -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP #endif { diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index 6206d94c3..e4a531b9b 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -14,6 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +#include "../stdopengl.h" #include "cocoa_event_emitter.h" namespace NLMISC @@ -380,7 +381,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) case NSOtherMouseDown:break; case NSOtherMouseUp:break; case NSOtherMouseDragged:break; -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP case NSEventTypeGesture:break; case NSEventTypeMagnify:break; case NSEventTypeSwipe:break; diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m index 17500389c..e989f94d5 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.m @@ -47,7 +47,7 @@ static void viewDidResize(NSView* view, CDriverGL* driver) -(void)keyDown:(NSEvent*)event { -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP [[self inputContext] handleEvent:event]; #endif } diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h index 53078e95a..3f13a7345 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.h @@ -28,7 +28,7 @@ using NL3D::CDriverGL; #endif @interface CocoaWindowDelegate : NSObject -#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#ifdef NL_MAC_VERSION_10_6_UP #endif { diff --git a/code/nel/src/3d/driver/opengl/stdopengl.h b/code/nel/src/3d/driver/opengl/stdopengl.h index ab4eb8316..0894b8f72 100644 --- a/code/nel/src/3d/driver/opengl/stdopengl.h +++ b/code/nel/src/3d/driver/opengl/stdopengl.h @@ -100,4 +100,10 @@ #include "nel/3d/light.h" #include "nel/3d/index_buffer.h" +#ifdef NL_OS_MAC +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 +#define NL_MAC_VERSION_10_6_UP +#else +#endif + #endif