Fixed: #1059 Make cocoa the default subsystem on Mac OS X

This commit is contained in:
rti 2010-08-13 18:16:37 +02:00
parent 70d892c7ba
commit 13f3d267fe
15 changed files with 67 additions and 110 deletions

View file

@ -107,15 +107,12 @@ IF(WITH_3D)
IF(NOT WIN32) IF(NOT WIN32)
IF(APPLE) IF(APPLE)
FIND_LIBRARY(CARBON NAMES Carbon) FIND_LIBRARY(CARBON NAMES Carbon)
IF(WITH_COCOA)
FIND_LIBRARY(COCOA NAMES Cocoa) FIND_LIBRARY(COCOA NAMES Cocoa)
ENDIF(WITH_COCOA) ELSE(APPLE)
ENDIF(APPLE)
IF(NOT WITH_COCOA)
FIND_PACKAGE(X11) FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode) FIND_PACKAGE(XF86VidMode)
FIND_PACKAGE(XRandR) FIND_PACKAGE(XRandR)
ENDIF(NOT WITH_COCOA) ENDIF(APPLE)
ENDIF(NOT WIN32) ENDIF(NOT WIN32)
ENDIF(WITH_DRIVER_OPENGL) ENDIF(WITH_DRIVER_OPENGL)

View file

@ -196,7 +196,6 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
OPTION(WITH_TESTS "Build NeL Unit Tests" ON ) OPTION(WITH_TESTS "Build NeL Unit Tests" ON )
OPTION(WITH_GTK "With GTK Support" OFF) OPTION(WITH_GTK "With GTK Support" OFF)
OPTION(WITH_QT "With QT Support" OFF) OPTION(WITH_QT "With QT Support" OFF)
OPTION(WITH_COCOA "Build with native Mac OS X Cocoa support" OFF)
OPTION(WITH_STLPORT "With STLport support." OFF) OPTION(WITH_STLPORT "With STLport support." OFF)
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF) OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS) ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
@ -244,9 +243,6 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g")
SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ") SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ")
SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ") SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ")
IF(WITH_COCOA)
SET(PLATFORM_CFLAGS "-DNL_MAC_NATIVE")
ENDIF(WITH_COCOA)
ENDIF(WIN32) ENDIF(WIN32)
# Determine host CPU # Determine host CPU

View file

@ -45,7 +45,7 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
typedef HWND nlWindow; typedef HWND nlWindow;
#define EmptyWindow NULL #define EmptyWindow NULL
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
typedef void* nlWindow; typedef void* nlWindow;
#define EmptyWindow NULL #define EmptyWindow NULL
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)

View file

@ -1,8 +1,8 @@
FILE(GLOB SRC *.cpp *.h *.def) FILE(GLOB SRC *.cpp *.h *.def)
IF(WITH_COCOA) IF(APPLE)
FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp) FILE(GLOB MAC_SRC mac/*.h mac/*.m mac/*.mm mac/*.cpp)
SET(SRC ${SRC} ${MAC_SRC}) SET(SRC ${SRC} ${MAC_SRC})
ENDIF(WITH_COCOA) ENDIF(APPLE)
IF(WIN32) IF(WIN32)
SET(NLDRV_OGL_LIB "nel_drv_opengl_win") SET(NLDRV_OGL_LIB "nel_drv_opengl_win")
@ -25,15 +25,7 @@ IF(WIN32)
ELSE(WIN32) ELSE(WIN32)
IF(APPLE) IF(APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${CARBON})
IF(WITH_COCOA)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${COCOA})
ELSE(WITH_COCOA)
# NOTE: I know, those hardcoded things are evil. But FindOpenGL on Mac
# simply does not look for X11's OpenGL, just for the native one.
INCLUDE_DIRECTORIES("/usr/X11/include")
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB}
"-L/usr/X11/lib" "-lGL" ${X11_LIBRARIES})
ENDIF(WITH_COCOA)
ELSE(APPLE) ELSE(APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_LIBRARIES}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_LIBRARIES})
IF(XF86VidMode_FOUND) IF(XF86VidMode_FOUND)
@ -51,9 +43,9 @@ ENDIF(WIN32)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})
IF(NOT WITH_COCOA AND WITH_PCH) IF(NOT APPLE AND WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp) ADD_NATIVE_PRECOMPILED_HEADER(${NLDRV_OGL_LIB} ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.h ${CMAKE_CURRENT_SOURCE_DIR}/stdopengl.cpp)
ENDIF(NOT WITH_COCOA AND WITH_PCH) ENDIF(NOT APPLE AND WITH_PCH)
INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d) INSTALL(TARGETS ${NLDRV_OGL_LIB} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin COMPONENT drivers3d)
IF(WITH_MAXPLUGIN) IF(WITH_MAXPLUGIN)

View file

@ -28,7 +28,7 @@
# include <windowsx.h> # include <windowsx.h>
# include <string> # include <string>
# include <GL/gl.h> # include <GL/gl.h>
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# include "mac/glext.h" # include "mac/glext.h"
@ -187,7 +187,7 @@ CDriverGL::CDriverGL()
_NeedToRestaureGammaRamp = false; _NeedToRestaureGammaRamp = false;
_Interval = 1; _Interval = 1;
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::ctor(); NL3D::MAC::ctor();
@ -330,7 +330,7 @@ CDriverGL::~CDriverGL()
H_AUTO_OGL(CDriverGL_CDriverGLDtor) H_AUTO_OGL(CDriverGL_CDriverGLDtor)
release(); release();
#if defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #if defined(NL_OS_MAC)
NL3D::MAC::dtor(); NL3D::MAC::dtor();
#endif #endif
} }
@ -858,7 +858,7 @@ bool CDriverGL::swapBuffers()
SwapBuffers(_hDC); SwapBuffers(_hDC);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::swapBuffers(_win); NL3D::MAC::swapBuffers(_win);
@ -2306,7 +2306,7 @@ void CDriverGL::retrieveATIDriverVersion()
} }
RegCloseKey(parentKey); RegCloseKey(parentKey);
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");

View file

@ -31,7 +31,7 @@
# define NOMINMAX # define NOMINMAX
# include <windows.h> # include <windows.h>
# include <GL/gl.h> # include <GL/gl.h>
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
@ -70,7 +70,7 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
#include "nel/misc/win_event_emitter.h" #include "nel/misc/win_event_emitter.h"
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
#include "mac/cocoa_event_emitter.h" #include "mac/cocoa_event_emitter.h"
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
#include "unix_event_emitter.h" #include "unix_event_emitter.h"
@ -111,7 +111,7 @@ class COcclusionQueryGL;
bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); bool GlWndProc(CDriverGL *driver, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#elif defined (NL_MAC_NATIVE) #elif defined (NL_OS_MAC)
// TODO: change that // TODO: change that
bool GlWndProc(CDriverGL *driver); bool GlWndProc(CDriverGL *driver);
@ -698,7 +698,7 @@ private:
// Off-screen rendering in Dib section // Off-screen rendering in Dib section
HPBUFFERARB _PBuffer; HPBUFFERARB _PBuffer;
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NLMISC::CCocoaEventEmitter _EventEmitter; NLMISC::CCocoaEventEmitter _EventEmitter;

View file

@ -26,7 +26,7 @@
# include <windows.h> # include <windows.h>
# include <GL/gl.h> # include <GL/gl.h>
# include <GL/glext.h> // Please download it from http://www.opengl.org/registry/ # include <GL/glext.h> // Please download it from http://www.opengl.org/registry/
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# include "mac/glext.h" # include "mac/glext.h"

View file

@ -20,7 +20,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#ifdef NL_MAC_NATIVE #ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# include "mac/glext.h" # include "mac/glext.h"

View file

@ -20,7 +20,7 @@
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/3d/vertex_buffer.h" #include "nel/3d/vertex_buffer.h"
#ifdef NL_MAC_NATIVE #ifdef NL_OS_MAC
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
#else #else

View file

@ -24,7 +24,7 @@
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
# include <windowsx.h> # include <windowsx.h>
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# define GL_GLEXT_LEGACY # define GL_GLEXT_LEGACY
# include <OpenGL/gl.h> # include <OpenGL/gl.h>
# include "mac/glext.h" # include "mac/glext.h"
@ -139,7 +139,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam); return trapMessage ? 0 : DefWindowProcW(hWnd, message, wParam, lParam);
} }
#elif defined (NL_MAC_NATIVE) #elif defined (NL_OS_MAC)
bool GlWndProc(CDriverGL *driver) bool GlWndProc(CDriverGL *driver)
{ {
@ -284,7 +284,7 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc)
// ati specific : try to retrieve driver version // ati specific : try to retrieve driver version
retrieveATIDriverVersion(); retrieveATIDriverVersion();
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
if(!NL3D::MAC::init(windowIcon, exitFunc)) if(!NL3D::MAC::init(windowIcon, exitFunc))
{ {
@ -379,7 +379,7 @@ bool CDriverGL::unInit()
} }
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
if(!NL3D::MAC::unInit()) if(!NL3D::MAC::unInit())
{ {
@ -887,7 +887,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
nlinfo(e.what()); nlinfo(e.what());
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
_win = NL3D::MAC::setDisplay(wnd, mode, show, resizeable); _win = NL3D::MAC::setDisplay(wnd, mode, show, resizeable);
@ -994,7 +994,7 @@ bool CDriverGL::saveScreenMode()
// don't need to save it because Windows will use default desktop resolution // don't need to save it because Windows will use default desktop resolution
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
// no need to store because the screen mode is never really changed // no need to store because the screen mode is never really changed
@ -1058,7 +1058,7 @@ bool CDriverGL::restoreScreenMode()
res = (ChangeDisplaySettings(NULL, 0) == DISP_CHANGE_SUCCESSFUL); res = (ChangeDisplaySettings(NULL, 0) == DISP_CHANGE_SUCCESSFUL);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
// no need to restore because the screen mode was never really changed // no need to restore because the screen mode was never really changed
res = true; res = true;
@ -1196,7 +1196,7 @@ bool CDriverGL::setScreenMode(const GfxMode &mode)
return false; return false;
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
// no need to do anything here, on mac os, the screen mode is never changed // no need to do anything here, on mac os, the screen mode is never changed
@ -1310,7 +1310,7 @@ bool CDriverGL::createWindow(const GfxMode &mode)
return false; return false;
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
window = NL3D::MAC::createWindow(mode); window = NL3D::MAC::createWindow(mode);
@ -1388,7 +1388,7 @@ bool CDriverGL::destroyWindow()
DestroyWindow(_win); DestroyWindow(_win);
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
if(_DestroyWindow) if(_DestroyWindow)
{ {
@ -1483,7 +1483,7 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
// else if (isMaximized && isVisible) // else if (isMaximized && isVisible)
// ShowWindow(_hWnd, SW_RESTORE); // ShowWindow(_hWnd, SW_RESTORE);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
if(!NL3D::MAC::setWindowStyle(_win, windowStyle == EWSFullscreen)) if(!NL3D::MAC::setWindowStyle(_win, windowStyle == EWSFullscreen))
{ {
@ -1493,10 +1493,6 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
#elif defined(NL_OS_UNIX) #elif defined(NL_OS_UNIX)
// x11 fullscreen is not working on mac os x
#if !defined(NL_OS_MAC)
// Toggle fullscreen // Toggle fullscreen
XEvent xev; XEvent xev;
xev.xclient.type = ClientMessage; xev.xclient.type = ClientMessage;
@ -1521,8 +1517,6 @@ bool CDriverGL::setWindowStyle(EWindowStyle windowStyle)
if (_WindowVisible) if (_WindowVisible)
XMapRaised(_dpy, _win); XMapRaised(_dpy, _win);
#endif
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
return true; return true;
@ -1542,12 +1536,7 @@ bool CDriverGL::setMode(const GfxMode& mode)
if (!mode.Windowed) if (!mode.Windowed)
_Depth = mode.Depth; _Depth = mode.Depth;
#if defined(NL_OS_MAC) && !defined(NL_MAC_NATIVE)
// X11 under Mac OS can't use fullscreen
_FullScreen = false;
#else
_FullScreen = !mode.Windowed; _FullScreen = !mode.Windowed;
#endif // NL_MAC_NATIVE
setWindowSize(mode.Width, mode.Height); setWindowSize(mode.Width, mode.Height);
setWindowPos(_WindowX, _WindowY); setWindowPos(_WindowX, _WindowY);
@ -1581,7 +1570,7 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
modeIndex++; modeIndex++;
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::getModes(modes); NL3D::MAC::getModes(modes);
@ -1692,7 +1681,7 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
mode.Height = (uint16)devmode.dmPelsHeight; mode.Height = (uint16)devmode.dmPelsHeight;
mode.AntiAlias = _AntiAliasing; mode.AntiAlias = _AntiAliasing;
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::getCurrentScreenMode(_win, mode); NL3D::MAC::getCurrentScreenMode(_win, mode);
@ -1783,11 +1772,6 @@ bool CDriverGL::getCurrentScreenMode(GfxMode &mode)
nldebug("Current mode: %dx%d, %d Hz, %dbit", mode.Width, mode.Height, mode.Frequency, mode.Depth); nldebug("Current mode: %dx%d, %d Hz, %dbit", mode.Width, mode.Height, mode.Frequency, mode.Depth);
} }
#if defined(NL_OS_MAC)
// x11 fullscreen is not working on mac os x
mode.Windowed = true;
#endif // NL_OS_MAC
#endif // NL_OS_UNIX #endif // NL_OS_UNIX
return true; return true;
@ -1805,7 +1789,7 @@ void CDriverGL::setWindowTitle(const ucstring &title)
SetWindowTextW(_win, (WCHAR*)title.c_str()); SetWindowTextW(_win, (WCHAR*)title.c_str());
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::setWindowTitle(_win, title); NL3D::MAC::setWindowTitle(_win, title);
@ -1837,7 +1821,7 @@ void CDriverGL::setWindowPos(sint32 x, sint32 y)
SetWindowPos(_win, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE); SetWindowPos(_win, NULL, x, y, 0, 0, SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::setWindowPos(_win, x, y); NL3D::MAC::setWindowPos(_win, x, y);
@ -1867,8 +1851,10 @@ void CDriverGL::showWindow(bool show)
_WindowVisible = show; _WindowVisible = show;
#ifdef NL_OS_WINDOWS #ifdef NL_OS_WINDOWS
ShowWindow (_win, show ? SW_SHOW:SW_HIDE); ShowWindow (_win, show ? SW_SHOW:SW_HIDE);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE)
#elif defined(NL_OS_MAC)
MAC::showWindow(show); MAC::showWindow(show);
@ -1913,7 +1899,7 @@ bool CDriverGL::activate()
if (hglrc != _hRC) if (hglrc != _hRC)
wglMakeCurrent(_hDC, _hRC); wglMakeCurrent(_hDC, _hRC);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
if(!MAC::activate(_win)) if(!MAC::activate(_win))
{ {
@ -1997,7 +1983,7 @@ void CDriverGL::showCursor(bool b)
; ;
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::showCursor(b); NL3D::MAC::showCursor(b);
@ -2050,7 +2036,7 @@ void CDriverGL::setMousePos(float x, float y)
ClientToScreen (_win, &pt); ClientToScreen (_win, &pt);
SetCursorPos(pt.x, pt.y); SetCursorPos(pt.x, pt.y);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::setMousePos(_win, x, y); NL3D::MAC::setMousePos(_win, x, y);
@ -2065,11 +2051,11 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height)
{ {
H_AUTO_OGL(CDriverGL_getWindowSize) H_AUTO_OGL(CDriverGL_getWindowSize)
#ifdef NL_MAC_NATIVE #ifdef NL_OS_MAC
NL3D::MAC::getWindowSize(_win, width, height); NL3D::MAC::getWindowSize(_win, width, height);
#else #else // NL_OS_MAC
// Off-screen rendering ? // Off-screen rendering ?
if (_OffScreen) if (_OffScreen)
@ -2088,7 +2074,7 @@ void CDriverGL::getWindowSize(uint32 &width, uint32 &height)
height = _WindowHeight; height = _WindowHeight;
} }
#endif // NL_MAC_NATIVE #endif // NL_OS_MAC
} }
void CDriverGL::setWindowSize(uint32 width, uint32 height) void CDriverGL::setWindowSize(uint32 width, uint32 height)
@ -2119,7 +2105,7 @@ void CDriverGL::setWindowSize(uint32 width, uint32 height)
_WindowX = clientRect.left; _WindowX = clientRect.left;
_WindowY = clientRect.top; _WindowY = clientRect.top;
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::setWindowSize(_win, width, height); NL3D::MAC::setWindowSize(_win, width, height);
@ -2156,11 +2142,11 @@ void CDriverGL::getWindowPos(sint32 &x, sint32 &y)
{ {
H_AUTO_OGL(CDriverGL_getWindowPos) H_AUTO_OGL(CDriverGL_getWindowPos)
#ifdef NL_MAC_NATIVE #ifdef NL_OS_MAC
NL3D::MAC::getWindowPos(_win, x, y); NL3D::MAC::getWindowPos(_win, x, y);
#else #else // NL_OS_MAC
// Off-screen rendering ? // Off-screen rendering ?
if (_OffScreen) if (_OffScreen)
@ -2176,7 +2162,7 @@ void CDriverGL::getWindowPos(sint32 &x, sint32 &y)
} }
} }
#endif // NL_MAC_NATIVE #endif // NL_OS_MAC
} }
// -------------------------------------------------- // --------------------------------------------------
@ -2193,7 +2179,7 @@ bool CDriverGL::isActive()
res = (IsWindow(_win) != FALSE); res = (IsWindow(_win) != FALSE);
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
// nlwarning("OpenGL Driver: Missing Mac Implementation"); // nlwarning("OpenGL Driver: Missing Mac Implementation");
@ -2237,7 +2223,7 @@ void CDriverGL::setCapture (bool b)
ReleaseCapture (); ReleaseCapture ();
*/ */
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
NL3D::MAC::setCapture(b); NL3D::MAC::setCapture(b);
@ -2290,7 +2276,7 @@ NLMISC::IMouseDevice* CDriverGL::enableLowLevelMouse(bool enable, bool exclusive
diee->releaseMouse(); diee->releaseMouse();
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");
@ -2332,7 +2318,7 @@ NLMISC::IKeyboardDevice* CDriverGL::enableLowLevelKeyboard(bool enable)
diee->releaseKeyboard(); diee->releaseKeyboard();
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");
@ -2355,7 +2341,7 @@ NLMISC::IInputDeviceManager* CDriverGL::getLowLevelInputDeviceManager()
if (_EventEmitter.getNumEmitters() > 1) if (_EventEmitter.getNumEmitters() > 1)
res = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1)); res = NLMISC::safe_cast<NLMISC::CDIEventEmitter *>(_EventEmitter.getEmitter(1));
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");
@ -2403,7 +2389,7 @@ uint CDriverGL::getDoubleClickDelay(bool hardwareMouse)
res = ::GetDoubleClickTime(); res = ::GetDoubleClickTime();
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");
@ -2466,7 +2452,7 @@ bool CDriverGL::setMonitorColorProperties (const CMonitorColorProperties &proper
nlwarning ("(CDriverGL::setMonitorColorProperties): can't create DC"); nlwarning ("(CDriverGL::setMonitorColorProperties): can't create DC");
} }
#elif defined(NL_OS_MAC) && defined(NL_MAC_NATIVE) #elif defined(NL_OS_MAC)
# warning "OpenGL Driver: Missing Mac Implementation" # warning "OpenGL Driver: Missing Mac Implementation"
nlwarning("OpenGL Driver: Missing Mac Implementation"); nlwarning("OpenGL Driver: Missing Mac Implementation");

View file

@ -15,17 +15,15 @@
// 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 "stdopengl.h"
#include "unix_event_emitter.h"
#ifdef NL_OS_UNIX #if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#ifndef NL_MAC_NATIVE
#include <X11/keysym.h> #include <X11/keysym.h>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
#include "nel/misc/debug.h" #include "nel/misc/debug.h"
#include "unix_event_emitter.h"
typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e); typedef bool (*x11Proc)(NL3D::IDriver *drv, XEvent *e);
@ -603,6 +601,4 @@ bool CUnixEventEmitter::processMessage (XEvent &event, CEventServer *server)
} // NLMISC } // NLMISC
#endif // NL_MAC_NATIVE #endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#endif // NL_OS_UNIX

View file

@ -17,14 +17,12 @@
#ifndef NL_UNIX_EVENT_EMITTER_H #ifndef NL_UNIX_EVENT_EMITTER_H
#define NL_UNIX_EVENT_EMITTER_H #define NL_UNIX_EVENT_EMITTER_H
#ifndef NL_MAC_NATIVE
#include "nel/misc/types_nl.h" #include "nel/misc/types_nl.h"
#include "nel/misc/event_emitter.h" #include "nel/misc/event_emitter.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
#include "nel/misc/game_device_events.h" #include "nel/misc/game_device_events.h"
#ifdef NL_OS_UNIX #if defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glx.h> #include <GL/glx.h>
@ -104,9 +102,7 @@ private:
} // NLMISC } // NLMISC
#endif // NL_OS_UNIX #endif // defined(NL_OS_UNIX) && !defined(NL_OS_MAC)
#endif // NL_MAC_NATIVE
#endif // NL_UNIX_EVENT_EMITTER_H #endif // NL_UNIX_EVENT_EMITTER_H

View file

@ -85,11 +85,9 @@ ENDIF(WITH_LUA51)
FIND_PACKAGE(CURL REQUIRED) FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(Libwww) FIND_PACKAGE(Libwww)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
IF(NOT WIN32) IF(NOT WIN32 AND NOT APPLE)
IF(NOT WITH_COCOA)
FIND_PACKAGE(X11) FIND_PACKAGE(X11)
ENDIF(NOT WITH_COCOA) ENDIF(NOT WIN32 AND NOT APPLE)
ENDIF(NOT WIN32)
NL_SETUP_BUILD() NL_SETUP_BUILD()

View file

@ -40,7 +40,6 @@ MACRO(NL_SETUP_DEFAULT_OPTIONS)
### ###
OPTION(WITH_SOUND "Build Sound Support" OFF) OPTION(WITH_SOUND "Build Sound Support" OFF)
OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF) OPTION(BUILD_DASHBOARD "Build to the CDash dashboard" OFF)
OPTION(WITH_COCOA "Build with native Mac OS X Cocoa support" OFF)
ENDMACRO(NL_SETUP_DEFAULT_OPTIONS) ENDMACRO(NL_SETUP_DEFAULT_OPTIONS)
@ -84,9 +83,6 @@ MACRO(NL_SETUP_BUILD)
SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -O6 -g")
SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ") SET(NL_RELEASEDEBUG_CFLAGS "-DNL_RELEASE_DEBUG -g -finline-functions -O3 ")
SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ") SET(NL_NONE_CFLAGS "-DNL_RELEASE -g -finline-functions -O2 ")
IF(WITH_COCOA)
SET(PLATFORM_CFLAGS "-DNL_MAC_NATIVE")
ENDIF(WITH_COCOA)
ENDIF(WIN32) ENDIF(WIN32)
# Determine host CPU # Determine host CPU

View file

@ -89,9 +89,9 @@ TARGET_LINK_LIBRARIES(ryzom_client ${PLATFORM_LINKFLAGS}
luabind # TODO: find luabind and expat cleanly using a find script luabind # TODO: find luabind and expat cleanly using a find script
expat) expat)
IF(NOT WITH_COCOA) IF(NOT APPLE AND NOT WIN32)
TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES}) TARGET_LINK_LIBRARIES(ryzom_client ${X11_LIBRARIES})
ENDIF(NOT WITH_COCOA) ENDIF(NOT APPLE AND NOT WIN32)
ADD_DEFINITIONS(${LIBXML2_DEFINITIONS}) ADD_DEFINITIONS(${LIBXML2_DEFINITIONS})