From 5855e60d4c8d3a1432679511629bda2f20431f28 Mon Sep 17 00:00:00 2001 From: rti Date: Wed, 3 Nov 2010 19:07:36 +0100 Subject: [PATCH] Fixed: MacOS 10.6 and below distinction --- .../src/3d/driver/opengl/driver_opengl_window.cpp | 13 +++++++------ code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h | 2 -- code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm | 2 -- .../3d/driver/opengl/mac/cocoa_event_emitter.cpp | 2 +- .../src/3d/driver/opengl/mac/cocoa_opengl_view.h | 5 ++--- .../src/3d/driver/opengl/mac/cocoa_opengl_view.m | 7 +++---- .../3d/driver/opengl/mac/cocoa_window_delegate.h | 8 ++++---- .../3d/driver/opengl/mac/cocoa_window_delegate.mm | 5 ++--- 8 files changed, 19 insertions(+), 25 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 ac2dcef81..865cd221a 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1672,7 +1672,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 MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 [containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: @@ -1776,7 +1776,8 @@ bool CDriverGL::setMode(const GfxMode& mode) return true; } -#if defined(NL_OS_MAC) && (MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED) +#if defined(NL_OS_MAC) && defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 + /// helper to extract bits per pixel value from screen mode, only 16 or 32 bits static int bppFromDisplayMode(CGDisplayModeRef mode) @@ -1794,7 +1795,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode) return 0; } -#elif defined(NL_OS_MAC) && (MAC_OS_X_VERSION_10_6 < MAC_OS_X_VERSION_MAX_ALLOWED) +#elif defined(NL_OS_MAC) long GetDictionaryLong(CFDictionaryRef theDict, const void* key) { @@ -1858,7 +1859,7 @@ bool CDriverGL::getModes(std::vector &modes) { CGDirectDisplayID dspy = display[i]; -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL); #else CFArrayRef modeList = CGDisplayAvailableModes(dspy); @@ -1872,7 +1873,7 @@ bool CDriverGL::getModes(std::vector &modes) for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j) { -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j); uint8 bpp = bppFromDisplayMode(mode); #else @@ -1882,7 +1883,7 @@ bool CDriverGL::getModes(std::vector &modes) if (bpp >= 16) { -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 uint16 w = CGDisplayModeGetWidth(mode); uint16 h = CGDisplayModeGetHeight(mode); #else diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h index 3b389f043..d23a699ce 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.h @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,6 +13,5 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ /* TODO remove this file */ diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm index 3b389f043..d23a699ce 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_adapter.mm @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,6 +13,5 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ /* TODO remove this file */ 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 d746eaf43..734478d8a 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 @@ -391,7 +391,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server) case NSOtherMouseDown:break; case NSOtherMouseUp:break; case NSOtherMouseDragged:break; -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 case NSEventTypeGesture:break; case NSEventTypeMagnify:break; case NSEventTypeSwipe:break; diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h index f314d203f..8017433ec 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_opengl_view.h @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,11 +13,11 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ #import -namespace NL3D { +namespace NL3D +{ class CDriverGL; void viewDidResize(NSView*, CDriverGL*); } 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 40d429629..bb9a4ece4 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 @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,7 +13,6 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ #include "../driver_opengl.h" @@ -22,7 +20,8 @@ #include -namespace NL3D { +namespace NL3D +{ void viewDidResize(NSView* view, CDriverGL* driver) { NSRect rect = [[view superview] frame]; @@ -53,7 +52,7 @@ namespace NL3D { -(void)keyDown:(NSEvent*)event { -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 [[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 6aa8207d1..4d3710b34 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 @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,17 +13,18 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ #import +#include "AvailabilityMacros.h" -namespace NL3D { +namespace NL3D +{ class CDriverGL; void windowDidMove(NSWindow*, NL3D::CDriverGL*); } @interface CocoaWindowDelegate : NSObject -#if MAC_OS_X_VERSION_10_6 > MAC_OS_X_VERSION_MAX_ALLOWED +#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 #endif { diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm index 6a7ce4c4c..c90c4f25d 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_window_delegate.mm @@ -1,4 +1,3 @@ -/* // NeL - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // @@ -14,13 +13,13 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -*/ #include "../driver_opengl.h" #import "cocoa_window_delegate.h" -namespace NL3D { +namespace NL3D +{ void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver) { // get the rect (position, size) of the screen with menu bar