From 4017e1897d141fee3668f22b725d2a05878265cf Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 4 Nov 2012 13:56:09 +0000 Subject: [PATCH] Backport to work on Leopard as well --- panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm | 5 +++++ panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 9 ++++++--- panda/src/cocoadisplay/cocoaPandaWindowDelegate.h | 4 ++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm b/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm index 8f9809acbd..01301c4847 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsStateGuardian.mm @@ -20,6 +20,11 @@ #import #import +#ifndef kCGLRendererIDMatchingMask +// For older versions of Mac OS X +#define kCGLRendererIDMatchingMask 0x00FE7F00 +#endif + TypeHandle CocoaGraphicsStateGuardian::_type_handle; //////////////////////////////////////////////////////////////////// diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index f061b486b0..8934a39da0 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -748,7 +748,9 @@ set_properties_now(WindowProperties &properties) { if (_window != nil) { // For some reason, setting the style mask // makes it give up its first-responder status. - [_window setStyleMask:NSBorderlessWindowMask]; + if ([_window respondsToSelector:@selector(setStyleMask:)]) { + [_window setStyleMask:NSBorderlessWindowMask]; + } [_window makeFirstResponder:_view]; [_window setLevel:NSMainMenuWindowLevel+1]; [_window makeKeyAndOrderFront:nil]; @@ -889,7 +891,8 @@ set_properties_now(WindowProperties &properties) { // However, if we're specifying the 'undecorated' property also, // then we'll be setting the style mask about 25 LOC further down, // so we won't need to bother setting it here. - if (!properties.has_undecorated() && !_properties.get_undecorated()) { + if (!properties.has_undecorated() && !_properties.get_undecorated() && + [_window respondsToSelector:@selector(setStyleMask:)]) { if (properties.get_fixed_size()) { [_window setStyleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask ]; @@ -904,7 +907,7 @@ set_properties_now(WindowProperties &properties) { properties.clear_fixed_size(); } - if (properties.has_undecorated() && _window != nil) { + if (properties.has_undecorated() && _window != nil && [_window respondsToSelector:@selector(setStyleMask:)]) { _properties.set_undecorated(properties.get_undecorated()); if (!_properties.get_fullscreen()) { diff --git a/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h b/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h index b7aee05e11..78c8c2eabe 100644 --- a/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h +++ b/panda/src/cocoadisplay/cocoaPandaWindowDelegate.h @@ -16,7 +16,11 @@ class CocoaGraphicsWindow; +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 @interface CocoaPandaWindowDelegate : NSObject { +#else +@interface CocoaPandaWindowDelegate : NSObject { +#endif @private CocoaGraphicsWindow *_graphicsWindow; }