From 66608d5c92dd3c555b4ea14e8925a0b9409c7326 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 31 Jul 2013 22:30:52 +0400 Subject: [PATCH 1/2] Fixed compilation os OS X after moving SDL windowing code to extern/sdl4ogre --- CMakeLists.txt | 4 ---- extern/sdl4ogre/CMakeLists.txt | 4 ++++ extern/sdl4ogre/osx_utils.h | 12 ++++++++++++ .../ogre => extern/sdl4ogre}/osx_utils.mm | 4 +--- extern/sdl4ogre/sdlwindowhelper.cpp | 4 ++++ libs/openengine/ogre/osx_utils.h | 14 -------------- libs/openengine/ogre/renderer.cpp | 4 ---- 7 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 extern/sdl4ogre/osx_utils.h rename {libs/openengine/ogre => extern/sdl4ogre}/osx_utils.mm (84%) delete mode 100644 libs/openengine/ogre/osx_utils.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1db852090c..c2cb5b06af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,10 +83,6 @@ set(OENGINE_OGRE ${LIBDIR}/openengine/ogre/imagerotate.cpp ) -if (APPLE) - set(OENGINE_OGRE ${OENGINE_OGRE} ${LIBDIR}/openengine/ogre/osx_utils.mm) -endif () - set(OENGINE_GUI ${LIBDIR}/openengine/gui/manager.cpp ) diff --git a/extern/sdl4ogre/CMakeLists.txt b/extern/sdl4ogre/CMakeLists.txt index 5b31974e5f..fb0832f712 100644 --- a/extern/sdl4ogre/CMakeLists.txt +++ b/extern/sdl4ogre/CMakeLists.txt @@ -8,6 +8,10 @@ set(SDL4OGRE_SOURCE_FILES sdlwindowhelper.cpp ) +if (APPLE) + set(SDL4OGRE_SOURCE_FILES ${SDL4OGRE_SOURCE_FILES} osx_utils.mm) +endif () + set(SDL4OGRE_HEADER_FILES OISCompat.h cursormanager.hpp diff --git a/extern/sdl4ogre/osx_utils.h b/extern/sdl4ogre/osx_utils.h new file mode 100644 index 0000000000..48149827ab --- /dev/null +++ b/extern/sdl4ogre/osx_utils.h @@ -0,0 +1,12 @@ +#ifndef SDL4OGRE_OSX_UTILS_H +#define SDL4OGRE_OSX_UTILS_H + +#include + +namespace SFO { + +extern unsigned long WindowContentViewHandle(SDL_SysWMinfo &info); + +} + +#endif // SDL4OGRE_OSX_UTILS_H diff --git a/libs/openengine/ogre/osx_utils.mm b/extern/sdl4ogre/osx_utils.mm similarity index 84% rename from libs/openengine/ogre/osx_utils.mm rename to extern/sdl4ogre/osx_utils.mm index 7e56601461..0ba17b30c1 100644 --- a/libs/openengine/ogre/osx_utils.mm +++ b/extern/sdl4ogre/osx_utils.mm @@ -2,8 +2,7 @@ #import -namespace OEngine { -namespace Render { +namespace SFO { unsigned long WindowContentViewHandle(SDL_SysWMinfo &info) { @@ -13,4 +12,3 @@ unsigned long WindowContentViewHandle(SDL_SysWMinfo &info) } } -} diff --git a/extern/sdl4ogre/sdlwindowhelper.cpp b/extern/sdl4ogre/sdlwindowhelper.cpp index 14371c947d..79a214753a 100644 --- a/extern/sdl4ogre/sdlwindowhelper.cpp +++ b/extern/sdl4ogre/sdlwindowhelper.cpp @@ -6,6 +6,10 @@ #include #include +#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE +#include "osx_utils.h" +#endif + namespace SFO { diff --git a/libs/openengine/ogre/osx_utils.h b/libs/openengine/ogre/osx_utils.h deleted file mode 100644 index f651db6046..0000000000 --- a/libs/openengine/ogre/osx_utils.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OENGINE_OGRE_OSX_UTILS_H -#define OENGINE_OGRE_OSX_UTILS_H - -#include - -namespace OEngine { -namespace Render { - -extern unsigned long WindowContentViewHandle(SDL_SysWMinfo &info); - -} -} - -#endif diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index cda35b16c4..b87f0aa718 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -24,10 +24,6 @@ #include #include -#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE -#include "osx_utils.h" -#endif - using namespace Ogre; using namespace OEngine::Render; From e552eccaa45df83ea8f1d3876ac33cfd8b852939 Mon Sep 17 00:00:00 2001 From: Nikolay Kasyanov Date: Wed, 31 Jul 2013 23:26:46 +0400 Subject: [PATCH 2/2] Fixed endless message loop after trying to resize window on OS X --- extern/sdl4ogre/sdlinputwrapper.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extern/sdl4ogre/sdlinputwrapper.cpp b/extern/sdl4ogre/sdlinputwrapper.cpp index a30f10d6a3..a6c0e1ccf5 100644 --- a/extern/sdl4ogre/sdlinputwrapper.cpp +++ b/extern/sdl4ogre/sdlinputwrapper.cpp @@ -119,21 +119,21 @@ namespace SFO int w,h; SDL_GetWindowSize(mSDLWindow, &w, &h); // TODO: Fix Ogre to handle this more consistently -#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - mOgreWindow->windowMovedOrResized(); -#else +#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX mOgreWindow->resize(w, h); +#else + mOgreWindow->windowMovedOrResized(); #endif if (mWindowListener) mWindowListener->windowResized(evt.window.data1, evt.window.data2); case SDL_WINDOWEVENT_RESIZED: // TODO: Fix Ogre to handle this more consistently - #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 - mOgreWindow->windowMovedOrResized(); - #else +#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX mOgreWindow->resize(evt.window.data1, evt.window.data2); - #endif +#else + mOgreWindow->windowMovedOrResized(); +#endif if (mWindowListener) mWindowListener->windowResized(evt.window.data1, evt.window.data2); break;