diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f063e261b..2ab7fd8000 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,10 @@ configure_file(${OpenMW_SOURCE_DIR}/files/plugins.cfg.linux "${OpenMW_BINARY_DIR}/plugins.cfg" COPYONLY) endif (WIN32) +if (APPLE) + find_library(CARBON_FRAMEWORK Carbon) +endif (APPLE) + configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg "${OpenMW_BINARY_DIR}/openmw.cfg" COPYONLY) @@ -103,3 +107,8 @@ target_link_libraries(openmw ${OGRE_LIBRARIES} ${OIS_LIBRARIES} ${Boost_LIBRARIES}) + +if (APPLE) + target_link_libraries(openmw + ${CARBON_FRAMEWORK}) +endif (APPLE) diff --git a/input/oismanager.cpp b/input/oismanager.cpp index a0174e8349..07714da3f5 100644 --- a/input/oismanager.cpp +++ b/input/oismanager.cpp @@ -6,6 +6,10 @@ #include "OgreRenderWindow.h" +#ifdef __APPLE_CC__ +#include +#endif + using namespace Input; using namespace Ogre; using namespace OIS; @@ -50,6 +54,13 @@ OISManager::OISManager(Render::OgreRenderer &rend) #endif } +#ifdef __APPLE_CC__ + // Give the application window focus to receive input events + ProcessSerialNumber psn = { 0, kCurrentProcess }; + TransformProcessType(&psn, kProcessTransformToForegroundApplication); + SetFrontProcess(&psn); +#endif + inputMgr = InputManager::createInputSystem( pl ); // Create all devices