Fixed: MacOS 10.6 and below distinction

This commit is contained in:
rti 2010-11-03 19:07:36 +01:00
parent ea9a34a6f3
commit 6b1069ae0f
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
// to pop up if the mouse hits the top screen border.
// 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:
[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<GfxMode> &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<GfxMode> &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<GfxMode> &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

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
/* TODO remove this file */

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
/* TODO remove this file */

View file

@ -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;

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h>
namespace NL3D {
namespace NL3D
{
class CDriverGL;
void viewDidResize(NSView*, CDriverGL*);
}

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
#include "../driver_opengl.h"
@ -22,7 +20,8 @@
#include <stdio.h>
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
}

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
#import <Cocoa/Cocoa.h>
#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
<NSWindowDelegate>
#endif
{

View file

@ -1,4 +1,3 @@
/*
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
*/
#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