Fixed: MacOS 10.6 and below distinction

This commit is contained in:
rti 2010-11-03 19:07:36 +01:00
parent 746d3386ae
commit 2c12b088b4
8 changed files with 19 additions and 25 deletions

View file

@ -1672,7 +1672,7 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
// put the view in fullscreen mode, hiding the dock but enabling the menubar // put the view in fullscreen mode, hiding the dock but enabling the menubar
// to pop up if the mouse hits the top screen border. // to pop up if the mouse hits the top screen border.
// NOTE: withOptions:nil disables <CMD>+<Tab> application switching! // NOTE: withOptions:nil disables <CMD>+<Tab> 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: [containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions:
[NSDictionary dictionaryWithObjectsAndKeys: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt: [NSNumber numberWithInt:
@ -1776,7 +1776,8 @@ bool CDriverGL::setMode(const GfxMode& mode)
return true; 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 /// helper to extract bits per pixel value from screen mode, only 16 or 32 bits
static int bppFromDisplayMode(CGDisplayModeRef mode) static int bppFromDisplayMode(CGDisplayModeRef mode)
@ -1794,7 +1795,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode)
return 0; 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) long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
{ {
@ -1858,7 +1859,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
{ {
CGDirectDisplayID dspy = display[i]; 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); CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL);
#else #else
CFArrayRef modeList = CGDisplayAvailableModes(dspy); CFArrayRef modeList = CGDisplayAvailableModes(dspy);
@ -1872,7 +1873,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
for (CFIndex j = 0; j < CFArrayGetCount(modeList); ++j) 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); CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j);
uint8 bpp = bppFromDisplayMode(mode); uint8 bpp = bppFromDisplayMode(mode);
#else #else
@ -1882,7 +1883,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
if (bpp >= 16) 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 w = CGDisplayModeGetWidth(mode);
uint16 h = CGDisplayModeGetHeight(mode); uint16 h = CGDisplayModeGetHeight(mode);
#else #else

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,6 +13,5 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* TODO remove this file */ /* TODO remove this file */

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,6 +13,5 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* TODO remove this file */ /* TODO remove this file */

View file

@ -391,7 +391,7 @@ bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
case NSOtherMouseDown:break; case NSOtherMouseDown:break;
case NSOtherMouseUp:break; case NSOtherMouseUp:break;
case NSOtherMouseDragged: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 NSEventTypeGesture:break;
case NSEventTypeMagnify:break; case NSEventTypeMagnify:break;
case NSEventTypeSwipe:break; case NSEventTypeSwipe:break;

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,11 +13,11 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
namespace NL3D { namespace NL3D
{
class CDriverGL; class CDriverGL;
void viewDidResize(NSView*, CDriverGL*); void viewDidResize(NSView*, CDriverGL*);
} }

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,7 +13,6 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../driver_opengl.h" #include "../driver_opengl.h"
@ -22,7 +20,8 @@
#include <stdio.h> #include <stdio.h>
namespace NL3D { namespace NL3D
{
void viewDidResize(NSView* view, CDriverGL* driver) void viewDidResize(NSView* view, CDriverGL* driver)
{ {
NSRect rect = [[view superview] frame]; NSRect rect = [[view superview] frame];
@ -53,7 +52,7 @@ namespace NL3D {
-(void)keyDown:(NSEvent*)event -(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]; [[self inputContext] handleEvent:event];
#endif #endif
} }

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,17 +13,18 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include "AvailabilityMacros.h"
namespace NL3D { namespace NL3D
{
class CDriverGL; class CDriverGL;
void windowDidMove(NSWindow*, NL3D::CDriverGL*); void windowDidMove(NSWindow*, NL3D::CDriverGL*);
} }
@interface CocoaWindowDelegate : NSObject @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
<NSWindowDelegate> <NSWindowDelegate>
#endif #endif
{ {

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited // Copyright (C) 2010 Winch Gate Property Limited
// //
@ -14,13 +13,13 @@
// //
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../driver_opengl.h" #include "../driver_opengl.h"
#import "cocoa_window_delegate.h" #import "cocoa_window_delegate.h"
namespace NL3D { namespace NL3D
{
void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver) void windowDidMove(NSWindow* window, NL3D::CDriverGL* driver)
{ {
// get the rect (position, size) of the screen with menu bar // get the rect (position, size) of the screen with menu bar