From c3d9bc31bbcdee7418eb888ccb175e9dd9a6b599 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 5 Nov 2013 03:02:28 +0100 Subject: [PATCH] Fix exiting OpenMW via the window close button (regression) --- apps/openmw/mwinput/inputmanagerimp.cpp | 5 +++++ apps/openmw/mwinput/inputmanagerimp.hpp | 1 + extern/sdl4ogre/events.h | 2 ++ extern/sdl4ogre/sdlinputwrapper.cpp | 3 ++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index c4a360cd4..f9ea3dfc3 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -641,6 +641,11 @@ namespace MWInput mOgre.windowResized(x,y); } + void InputManager::windowClosed() + { + MWBase::Environment::setRequestExit(); + } + void InputManager::toggleMainMenu() { if (MyGUI::InputManager::getInstance ().isModalAny()) diff --git a/apps/openmw/mwinput/inputmanagerimp.hpp b/apps/openmw/mwinput/inputmanagerimp.hpp index b38c80e0e..e7b7d6c7f 100644 --- a/apps/openmw/mwinput/inputmanagerimp.hpp +++ b/apps/openmw/mwinput/inputmanagerimp.hpp @@ -97,6 +97,7 @@ namespace MWInput virtual void windowVisibilityChange( bool visible ); virtual void windowFocusChange( bool have_focus ); virtual void windowResized (int x, int y); + virtual void windowClosed (); virtual void channelChanged(ICS::Channel* channel, float currentValue, float previousValue); diff --git a/extern/sdl4ogre/events.h b/extern/sdl4ogre/events.h index e6e8434cb..48adb4545 100644 --- a/extern/sdl4ogre/events.h +++ b/extern/sdl4ogre/events.h @@ -70,6 +70,8 @@ public: /** @remarks The window got / lost input focus */ virtual void windowFocusChange( bool have_focus ) {} + virtual void windowClosed () {} + virtual void windowResized (int x, int y) {} }; diff --git a/extern/sdl4ogre/sdlinputwrapper.cpp b/extern/sdl4ogre/sdlinputwrapper.cpp index df74bba3b..e7cbd549c 100644 --- a/extern/sdl4ogre/sdlinputwrapper.cpp +++ b/extern/sdl4ogre/sdlinputwrapper.cpp @@ -103,7 +103,8 @@ namespace SFO handleWindowEvent(evt); break; case SDL_QUIT: - Ogre::Root::getSingleton().queueEndRendering(); + if (mWindowListener) + mWindowListener->windowClosed(); break; default: std::cerr << "Unhandled SDL event of type " << evt.type << std::endl;