From 50a0d16f8f11fb08a54f944cb67a0f4a45854d83 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 7 Jul 2013 20:07:25 +0200 Subject: [PATCH] Pass only the X11 window to Ogre, otherwise it would treat it as parentWindowHandle instead of externalWindowHandle. parentWindowHandle does not seem to play nice with SDL and occasionally crashes with a GLXBadDrawable error on startup. --- extern/sdl4ogre/sdlinputwrapper.cpp | 6 ++++++ libs/openengine/ogre/renderer.cpp | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/extern/sdl4ogre/sdlinputwrapper.cpp b/extern/sdl4ogre/sdlinputwrapper.cpp index 5c1df52c60..89dc650650 100644 --- a/extern/sdl4ogre/sdlinputwrapper.cpp +++ b/extern/sdl4ogre/sdlinputwrapper.cpp @@ -105,6 +105,12 @@ namespace SFO case SDL_WINDOWEVENT_FOCUS_LOST: case SDL_WINDOWEVENT_CLOSE: break; + case SDL_WINDOWEVENT_SHOWN: + mOgreWindow->setVisible(true); + break; + case SDL_WINDOWEVENT_HIDDEN: + mOgreWindow->setVisible(false); + break; } } diff --git a/libs/openengine/ogre/renderer.cpp b/libs/openengine/ogre/renderer.cpp index 00d94a0041..dbfdfaaa56 100644 --- a/libs/openengine/ogre/renderer.cpp +++ b/libs/openengine/ogre/renderer.cpp @@ -315,9 +315,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& break; #else case SDL_SYSWM_X11: - winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.display); - winHandle += ":0:"; - winHandle += Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window); + winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window); break; #endif default: @@ -325,6 +323,8 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings& break; } + /// \todo externalWindowHandle is deprecated according to the source code. Figure out a way to get parentWindowHandle + /// to work properly. On Linux/X11 it causes an occasional GLXBadDrawable error. params.insert(std::make_pair("externalWindowHandle", winHandle)); mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, ¶ms);