mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-26 10:30:54 +00:00
Changed: Centralize OS X 10.6 check in NL_MAC_VERSION_10_6_UP
This commit is contained in:
parent
cccc2c47b8
commit
76436616ea
6 changed files with 21 additions and 11 deletions
|
@ -1793,7 +1793,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 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:
|
[containerView() enterFullScreenMode:[NSScreen mainScreen] withOptions:
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:
|
[NSDictionary dictionaryWithObjectsAndKeys:
|
||||||
[NSNumber numberWithInt:
|
[NSNumber numberWithInt:
|
||||||
|
@ -1917,8 +1917,9 @@ bool CDriverGL::setMode(const GfxMode& mode)
|
||||||
return true;
|
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
|
/// 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)
|
||||||
|
@ -1936,7 +1937,7 @@ static int bppFromDisplayMode(CGDisplayModeRef mode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(NL_OS_MAC)
|
#else
|
||||||
|
|
||||||
long GetDictionaryLong(CFDictionaryRef theDict, const void* key)
|
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 GetModeHeight(mode) GetDictionaryLong((mode), kCGDisplayHeight)
|
||||||
#define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel)
|
#define GetModeBitsPerPixel(mode) GetDictionaryLong((mode), kCGDisplayBitsPerPixel)
|
||||||
|
|
||||||
#endif // defined(NL_OS_MAC)
|
#endif
|
||||||
|
|
||||||
|
#endif // NL_OS_MAC
|
||||||
|
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
|
@ -2000,7 +2003,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
{
|
{
|
||||||
CGDirectDisplayID dspy = display[i];
|
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);
|
CFArrayRef modeList = CGDisplayCopyAllDisplayModes(dspy, NULL);
|
||||||
#else
|
#else
|
||||||
CFArrayRef modeList = CGDisplayAvailableModes(dspy);
|
CFArrayRef modeList = CGDisplayAvailableModes(dspy);
|
||||||
|
@ -2014,7 +2017,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 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);
|
CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modeList, j);
|
||||||
uint8 bpp = bppFromDisplayMode(mode);
|
uint8 bpp = bppFromDisplayMode(mode);
|
||||||
#else
|
#else
|
||||||
|
@ -2024,7 +2027,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
|
||||||
|
|
||||||
if (bpp >= 16)
|
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 w = CGDisplayModeGetWidth(mode);
|
||||||
uint16 h = CGDisplayModeGetHeight(mode);
|
uint16 h = CGDisplayModeGetHeight(mode);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -27,7 +27,7 @@ using NL3D::CDriverGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface CocoaApplicationDelegate : NSObject
|
@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
|
||||||
<NSApplicationDelegate>
|
<NSApplicationDelegate>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
// 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 "../stdopengl.h"
|
||||||
#include "cocoa_event_emitter.h"
|
#include "cocoa_event_emitter.h"
|
||||||
|
|
||||||
namespace NLMISC
|
namespace NLMISC
|
||||||
|
@ -380,7 +381,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 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 NSEventTypeGesture:break;
|
||||||
case NSEventTypeMagnify:break;
|
case NSEventTypeMagnify:break;
|
||||||
case NSEventTypeSwipe:break;
|
case NSEventTypeSwipe:break;
|
||||||
|
|
|
@ -47,7 +47,7 @@ static void viewDidResize(NSView* view, CDriverGL* driver)
|
||||||
|
|
||||||
-(void)keyDown:(NSEvent*)event
|
-(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];
|
[[self inputContext] handleEvent:event];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ using NL3D::CDriverGL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@interface CocoaWindowDelegate : NSObject
|
@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
|
||||||
<NSWindowDelegate>
|
<NSWindowDelegate>
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,4 +100,10 @@
|
||||||
#include "nel/3d/light.h"
|
#include "nel/3d/light.h"
|
||||||
#include "nel/3d/index_buffer.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
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue