Index: code/trunk/src/core/input/Button.cc
===================================================================
--- code/trunk/src/core/input/Button.cc	(revision 3196)
+++ code/trunk/src/core/input/Button.cc	(revision 3280)
@@ -37,5 +37,5 @@
 #include "util/Convert.h"
 #include "util/SubString.h"
-#include "util/String.h"
+#include "util/StringUtils.h"
 #include "util/Debug.h"
 #include "core/ConsoleCommand.h"
@@ -127,5 +127,5 @@
                     '\\', false, '"', false, '(', ')', false, '\0');
 
-                KeybindMode::Enum mode = KeybindMode::None;
+                KeybindMode::Value mode = KeybindMode::None;
                 float paramModifier = 1.0f;
                 std::string commandStr = "";
Index: code/trunk/src/core/input/Button.h
===================================================================
--- code/trunk/src/core/input/Button.h	(revision 3196)
+++ code/trunk/src/core/input/Button.h	(revision 3280)
@@ -54,5 +54,5 @@
         void parse();
         void readConfigValue(ConfigFileType configFile);
-        bool execute(KeybindMode::Enum mode, float abs = 1.0f, float rel = 1.0f);
+        bool execute(KeybindMode::Value mode, float abs = 1.0f, float rel = 1.0f);
 
         //! Container to allow for better configValue support
@@ -79,5 +79,5 @@
     };
 
-    inline bool Button::execute(KeybindMode::Enum mode, float abs, float rel)
+    inline bool Button::execute(KeybindMode::Value mode, float abs, float rel)
     {
         // execute all the parsed commands in the string
Index: code/trunk/src/core/input/InputManager.cc
===================================================================
--- code/trunk/src/core/input/InputManager.cc	(revision 3196)
+++ code/trunk/src/core/input/InputManager.cc	(revision 3280)
@@ -43,5 +43,5 @@
 #include "util/Convert.h"
 #include "util/Exception.h"
-#include "util/Debug.h"
+#include "util/ScopeGuard.h"
 #include "core/Clock.h"
 #include "core/CoreIncludes.h"
@@ -70,5 +70,5 @@
     SetConsoleCommand(InputManager, ungrabMouse, true);
 #endif
-    SetCommandLineSwitch(keyboard_no_grab);
+    SetCommandLineSwitch(keyboard_no_grab).information("Whether not to exclusively grab the keyboard");
 
     EmptyHandler InputManager::EMPTY_HANDLER;
@@ -177,7 +177,10 @@
             windowHndStr << (unsigned int)windowHnd_;
             paramList.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
+#if defined(ORXONOX_PLATFORM_WINDOWS)
             //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_NONEXCLUSIVE")));
             //paramList.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
-#if defined ORXONOX_PLATFORM_LINUX
+            //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_NONEXCLUSIVE")));
+            //paramList.insert(std::make_pair(std::string("w32_keyboard"), std::string("DISCL_FOREGROUND")));
+#elif defined(ORXONOX_PLATFORM_LINUX)
             paramList.insert(std::make_pair(std::string("XAutoRepeatOn"), std::string("true")));
             paramList.insert(std::make_pair(std::string("x11_mouse_grab"), "true"));
@@ -191,8 +194,20 @@
 #endif
 
-            inputSystem_ = OIS::InputManager::createInputSystem(paramList);
-            CCOUT(ORX_DEBUG) << "Created OIS input system" << std::endl;
-
-            _initialiseKeyboard();
+            try
+            {
+                inputSystem_ = OIS::InputManager::createInputSystem(paramList);
+                // Exception-safety
+                Loki::ScopeGuard guard = Loki::MakeGuard(OIS::InputManager::destroyInputSystem, inputSystem_);
+                CCOUT(ORX_DEBUG) << "Created OIS input system" << std::endl;
+
+                _initialiseKeyboard();
+
+                // Nothing below should throw anymore, dismiss the guard
+                guard.Dismiss();
+            }
+            catch (OIS::Exception& ex)
+            {
+                ThrowException(InitialisationFailed, "Could not initialise the input system: " << ex.what());
+            }
 
             _initialiseMouse();
@@ -200,5 +215,5 @@
             if (joyStickSupport)
                 _initialiseJoySticks();
-            // Do this anyway to also inform everything when a joystick was detached.
+            // Do this anyway to also inform when a joystick was detached.
             _configureJoySticks();
 
@@ -273,5 +288,5 @@
         else
         {
-            ThrowException(InitialisationFailed, "No keyboard found!");
+            ThrowException(InitialisationFailed, "InputManager: No keyboard found, cannot proceed!");
         }
     }
@@ -301,5 +316,5 @@
             else
             {
-                CCOUT(ORX_WARNING) << "Warning: No mouse found!" << std::endl;
+                CCOUT(ORX_WARNING) << "Warning: No mouse found! Proceeding without mouse support." << std::endl;
             }
         }
@@ -307,5 +322,5 @@
         {
             CCOUT(ORX_WARNING) << "Warning: Failed to create an OIS mouse\n"
-                << "OIS error message: \"" << ex.eText << "\"" << std::endl;
+                << "OIS error message: \"" << ex.eText << "\"\n Proceeding without mouse support." << std::endl;
             mouse_ = 0;
         }
@@ -345,8 +360,4 @@
             }
         }
-        else
-        {
-            //CCOUT(ORX_WARNING) << "Warning: Joy stick support requested, but no joy stick was found" << std::endl;
-        }
     }
 
@@ -528,41 +539,38 @@
         if (internalState_ != Uninitialised)
         {
+            CCOUT(3) << "Destroying ..." << std::endl;
+
+            // kick all active states 'nicely'
+            for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin();
+                rit != activeStates_.rend(); ++rit)
+            {
+                (*rit).second->onLeave();
+            }
+
+            // Destroy calibrator helper handler and state
+            delete keyDetector_;
+            requestDestroyState("calibrator");
+            // Destroy KeyDetector and state
+            delete calibratorCallbackBuffer_;
+            requestDestroyState("detector");
+            // destroy the empty InputState
+            _destroyState(this->stateEmpty_);
+
+            // destroy all user InputStates
+            while (inputStatesByName_.size() > 0)
+                _destroyState((*inputStatesByName_.rbegin()).second);
+
+            // destroy the devices
+            _destroyKeyboard();
+            _destroyMouse();
+            _destroyJoySticks();
+
             try
             {
-                CCOUT(3) << "Destroying ..." << std::endl;
-
-                // kick all active states 'nicely'
-                for (std::map<int, InputState*>::reverse_iterator rit = activeStates_.rbegin();
-                    rit != activeStates_.rend(); ++rit)
-                {
-                    (*rit).second->onLeave();
-                }
-
-                // Destroy calibrator helper handler and state
-                delete keyDetector_;
-                requestDestroyState("calibrator");
-                // Destroy KeyDetector and state
-                delete calibratorCallbackBuffer_;
-                requestDestroyState("detector");
-                // destroy the empty InputState
-                _destroyState(this->stateEmpty_);
-
-                // destroy all user InputStates
-                while (inputStatesByName_.size() > 0)
-                    _destroyState((*inputStatesByName_.rbegin()).second);
-
-                // destroy the devices
-                _destroyKeyboard();
-                _destroyMouse();
-                _destroyJoySticks();
-
                 OIS::InputManager::destroyInputSystem(inputSystem_);
-
-                CCOUT(3) << "Destroying done." << std::endl;
-            }
-            catch (OIS::Exception& ex)
-            {
-                CCOUT(1) << "An exception has occured while destroying:\n" << ex.what()
-                         << "This could lead to a possible memory/resource leak!" << std::endl;
+            }
+            catch (...)
+            {
+                CCOUT(1) << "OIS::InputManager destruction failed! Potential resource leak!" << std::endl;
             }
         }
@@ -578,8 +586,15 @@
     {
         assert(inputSystem_);
-        if (keyboard_)
-            inputSystem_->destroyInputObject(keyboard_);
-        keyboard_ = 0;
-        CCOUT(4) << "Keyboard destroyed." << std::endl;
+        try
+        {
+            if (keyboard_)
+                inputSystem_->destroyInputObject(keyboard_);
+            keyboard_ = 0;
+            CCOUT(4) << "Keyboard destroyed." << std::endl;
+        }
+        catch (...)
+        {
+            CCOUT(1) << "Keyboard destruction failed! Potential resource leak!" << std::endl;
+        }
     }
 
@@ -591,8 +606,15 @@
     {
         assert(inputSystem_);
-        if (mouse_)
-            inputSystem_->destroyInputObject(mouse_);
-        mouse_ = 0;
-        CCOUT(4) << "Mouse destroyed." << std::endl;
+        try
+        {
+            if (mouse_)
+                inputSystem_->destroyInputObject(mouse_);
+            mouse_ = 0;
+            CCOUT(4) << "Mouse destroyed." << std::endl;
+        }
+        catch (...)
+        {
+            CCOUT(1) << "Mouse destruction failed! Potential resource leak!" << std::endl;
+        }
     }
 
@@ -607,6 +629,15 @@
             assert(inputSystem_);
             for (unsigned int i = 0; i < joySticksSize_; i++)
-                if (joySticks_[i] != 0)
-                    inputSystem_->destroyInputObject(joySticks_[i]);
+            {
+                try
+                {
+                    if (joySticks_[i] != 0)
+                        inputSystem_->destroyInputObject(joySticks_[i]);
+                }
+                catch (...)
+                {
+                    CCOUT(1) << "Joy stick destruction failed! Potential resource leak!" << std::endl;
+                }
+            }
 
             joySticks_.clear();
Index: code/trunk/src/core/input/KeyBinder.cc
===================================================================
--- code/trunk/src/core/input/KeyBinder.cc	(revision 3196)
+++ code/trunk/src/core/input/KeyBinder.cc	(revision 3280)
@@ -96,6 +96,6 @@
         }
 
-        // Get a new ConfigFileType from the ConfigFileManager
-        this->configFile_ = ConfigFileManager::getInstance().getNewConfigFileType();
+        // We might not even load any bindings at all (KeyDetector for instance)
+        this->configFile_ = ConfigFileType::NoType;
 
         // initialise joy sticks separatly to allow for reloading
@@ -187,5 +187,5 @@
         for (unsigned int iDev = 0; iDev < numberOfJoySticks_; iDev++)
         {
-            std::string deviceNumber = convertToString(iDev);
+            std::string deviceNumber = multi_cast<std::string>(iDev);
             // joy stick buttons
             for (unsigned int i = 0; i < JoyStickButtonCode::numberOfButtons; i++)
@@ -249,4 +249,10 @@
         if (filename.empty())
             return;
+
+        if (this->configFile_ == ConfigFileType::NoType)
+        {
+            // Get a new ConfigFileType from the ConfigFileManager
+            this->configFile_ = ConfigFileManager::getInstance().getNewConfigFileType();
+        }
 
         ConfigFileManager::getInstance().setFilename(this->configFile_, filename);
