Index: code/trunk/src/core/input/ExtendedInputState.cc
===================================================================
--- code/trunk/src/core/input/ExtendedInputState.cc	(revision 1877)
+++ code/trunk/src/core/input/ExtendedInputState.cc	(revision 1878)
@@ -366,5 +366,5 @@
     void ExtendedInputState::removeAndDestroyAllHandlers()
     {
-        for (std::vector<InputTickable*>::iterator it = allHandlers_.begin();
+        for (std::vector<InputHandler*>::iterator it = allHandlers_.begin();
             it != allHandlers_.end(); ++it)
             delete *it;
@@ -387,5 +387,5 @@
         True if added, false if handler already existed.
     */
-    bool ExtendedInputState::addHandler(InputTickable* handler)
+    bool ExtendedInputState::addHandler(InputHandler* handler)
     {
         bool success = false;
@@ -406,5 +406,5 @@
         True if removal was successful, false if handler was not found.
     */
-    bool ExtendedInputState::removeHandler(InputTickable* handler)
+    bool ExtendedInputState::removeHandler(InputHandler* handler)
     {
         bool success = false;
@@ -449,5 +449,5 @@
     {
         // we can use a set to have a list of unique pointers (an object can implement all 3 handlers)
-        std::set<InputTickable*> tempSet;
+        std::set<InputHandler*> tempSet;
         for (unsigned int iHandler = 0; iHandler < keyHandlers_.size(); iHandler++)
             tempSet.insert(keyHandlers_[iHandler]);
@@ -460,5 +460,5 @@
         // copy the content of the map back to the actual vector
         allHandlers_.clear();
-        for (std::set<InputTickable*>::const_iterator itHandler = tempSet.begin();
+        for (std::set<InputHandler*>::const_iterator itHandler = tempSet.begin();
             itHandler != tempSet.end(); itHandler++)
             allHandlers_.push_back(*itHandler);
@@ -469,4 +469,6 @@
         for (unsigned int i = 0; i < joyStickHandlers_.size(); ++i)
             setInputDeviceEnabled(2 + i, (joyStickHandlers_[i].size() != 0));
+
+        this->bHandlersChanged_ = true;
     }
 }
Index: code/trunk/src/core/input/ExtendedInputState.h
===================================================================
--- code/trunk/src/core/input/ExtendedInputState.h	(revision 1877)
+++ code/trunk/src/core/input/ExtendedInputState.h	(revision 1878)
@@ -61,6 +61,6 @@
         bool removeJoyStickHandler(JoyStickHandler* handler);
 
-        bool addHandler(InputTickable* handler);
-        bool removeHandler(InputTickable* handler);
+        bool addHandler(InputHandler* handler);
+        bool removeHandler(InputHandler* handler);
 
         void removeAndDestroyAllHandlers();
@@ -96,5 +96,5 @@
         std::vector<JoyStickHandler*>               joyStickHandlersAll_;
 
-        std::vector<InputTickable*> allHandlers_;
+        std::vector<InputHandler*> allHandlers_;
     };
 }
Index: code/trunk/src/core/input/InputInterfaces.h
===================================================================
--- code/trunk/src/core/input/InputInterfaces.h	(revision 1877)
+++ code/trunk/src/core/input/InputInterfaces.h	(revision 1878)
@@ -287,8 +287,8 @@
 
 
-    class _CoreExport InputTickable
-    {
-    public:
-        virtual ~InputTickable() { }
+    class _CoreExport InputHandler
+    {
+    public:
+        virtual ~InputHandler() { }
         virtual void tickInput(float dt) = 0;
     };
@@ -298,5 +298,5 @@
         Interface class used for key input listeners.
     */
-    class _CoreExport KeyHandler : virtual public InputTickable
+    class _CoreExport KeyHandler : virtual public InputHandler
     {
     public:
@@ -312,5 +312,5 @@
         Interface class used for mouse input listeners.
     */
-    class _CoreExport MouseHandler : virtual public InputTickable
+    class _CoreExport MouseHandler : virtual public InputHandler
     {
     public:
@@ -329,5 +329,5 @@
         Interface class used for joy stick input listeners.
     */
-    class _CoreExport JoyStickHandler : virtual public InputTickable
+    class _CoreExport JoyStickHandler : virtual public InputHandler
     {
     public:
@@ -342,5 +342,10 @@
     class _CoreExport EmptyHandler : public KeyHandler, public MouseHandler, public JoyStickHandler
     {
+        friend class InputManager;
     private:
+        EmptyHandler() { }
+        EmptyHandler(EmptyHandler&);
+        virtual ~EmptyHandler() { }
+
         void tickInput(float dt) { }
         void tickJoyStick(float dt, unsigned int joyStick) { }
Index: code/trunk/src/core/input/InputManager.cc
===================================================================
--- code/trunk/src/core/input/InputManager.cc	(revision 1877)
+++ code/trunk/src/core/input/InputManager.cc	(revision 1878)
@@ -65,4 +65,5 @@
 
     std::string InputManager::bindingCommmandString_s = "";
+    EmptyHandler InputManager::EMPTY_HANDLER;
     InputManager* InputManager::singletonRef_s = 0;
 
@@ -189,5 +190,5 @@
 
             stateEmpty_ = createInputState<SimpleInputState>("empty", -1);
-            stateEmpty_->setHandler(new EmptyHandler());
+            stateEmpty_->setHandler(&EMPTY_HANDLER);
             activeStates_[stateEmpty_->getPriority()] = stateEmpty_;
 
@@ -198,5 +199,5 @@
 
             stateCalibrator_ = createInputState<SimpleInputState>("calibrator", 100);
-            stateCalibrator_->setHandler(new EmptyHandler());
+            stateCalibrator_->setHandler(&EMPTY_HANDLER);
             InputBuffer* buffer = new InputBuffer();
             buffer->registerListener(this, &InputManager::_completeCalibration, '\r', true);
@@ -430,7 +431,8 @@
 
                 // clear our own states
-                stateEmpty_->removeAndDestroyAllHandlers();
-                stateCalibrator_->removeAndDestroyAllHandlers();
-                stateDetector_->removeAndDestroyAllHandlers();
+                //stateEmpty_->removeAndDestroyAllHandlers();
+                //stateCalibrator_->removeAndDestroyAllHandlers();
+                //stateDetector_->removeAndDestroyAllHandlers();
+                // TODO: Memory Leak when not deleting the handlers!!!
 
                 // kick all active states 'nicely'
@@ -680,4 +682,17 @@
         }
         stateDestroyRequests_.clear();
+
+        // check whether a state has changed its EMPTY_HANDLER situation
+        bool bUpdateRequired = false;
+        for (std::map<int, InputState*>::iterator it = activeStates_.begin(); it != activeStates_.end(); ++it)
+        {
+            if (it->second->handlersChanged())
+            {
+                it->second->resetHandlersChanged();
+                bUpdateRequired = true;
+            }
+        }
+        if (bUpdateRequired)
+            _updateActiveStates();
 
         // mark that we capture and distribute input
@@ -826,4 +841,12 @@
         requestLeaveState("calibrator");
         bCalibrating_ = false;
+    }
+
+    void InputManager::clearBuffers()
+    {
+        this->keysDown_.clear();
+        this->mouseButtonsDown_.clear();
+        for (unsigned int i = 0; i < this->joySticksSize_; ++i)
+            this->joyStickButtonsDown_[i].clear();
     }
 
Index: code/trunk/src/core/input/InputManager.h
===================================================================
--- code/trunk/src/core/input/InputManager.h	(revision 1877)
+++ code/trunk/src/core/input/InputManager.h	(revision 1878)
@@ -108,4 +108,6 @@
         void reloadInputSystem(bool joyStickSupport = true);
 
+        void clearBuffers();
+
         int  numberOfKeyboards() { return keyboard_ ? 1 : 0; }
         int  numberOfMice()      { return mouse_    ? 1 : 0; }
@@ -115,15 +117,5 @@
 
         template <class T>
-        T* createInputState(const std::string& name, int priority)
-        {
-            T* state = new T;
-            if (_configureInputState(state, name, priority))
-                return state;
-            else
-            {
-                delete state;
-                return 0;
-            }
-        }
+        T* createInputState(const std::string& name, int priority);
 
         InputState* getState       (const std::string& name);
@@ -139,9 +131,12 @@
         static InputManager* getInstancePtr() { return singletonRef_s; }
 
-    public: // console commands
+        // console commands
         static void storeKeyStroke(const std::string& name);
         static void keyBind(const std::string& command);
         static void calibrate();
         static void reload(bool joyStickSupport = true);
+
+    public: // variables
+        static EmptyHandler                 EMPTY_HANDLER;
 
     private: // functions
@@ -197,5 +192,5 @@
         InputManagerState                   internalState_;        //!< Current internal state
 
-        // some internally handled states
+        // some internally handled states and handlers
         SimpleInputState*                   stateDetector_;        //!< KeyDetector instance
         SimpleInputState*                   stateCalibrator_;
@@ -234,4 +229,32 @@
         static InputManager*                singletonRef_s;
     };
+
+    /**
+    @brief
+        Creates a new InputState by type, name and priority.
+        
+        You will have to use this method because the
+        c'tors and d'tors are private.
+    @remarks
+        The InputManager will take care of the state completely. That also
+        means it gets deleted when the InputManager is destroyed!
+    @param name
+        Name of the InputState when referenced as string
+    @param priority
+        Priority matters when multiple states are active. You can specify any
+        number, but 1 - 99 is preferred (99 means high).
+    */
+    template <class T>
+    T* InputManager::createInputState(const std::string& name, int priority)
+    {
+        T* state = new T;
+        if (_configureInputState(state, name, priority))
+            return state;
+        else
+        {
+            delete state;
+            return 0;
+        }
+    }
 }
 
Index: code/trunk/src/core/input/InputState.h
===================================================================
--- code/trunk/src/core/input/InputState.h	(revision 1877)
+++ code/trunk/src/core/input/InputState.h	(revision 1878)
@@ -60,4 +60,7 @@
         }
 
+        bool handlersChanged() { return this->bHandlersChanged_; }
+        void resetHandlersChanged() { bHandlersChanged_ = false; }
+
         virtual void onEnter() { if (executorOnEnter_) (*executorOnEnter_)(); }
         virtual void onLeave() { if (executorOnLeave_) (*executorOnLeave_)(); }
@@ -87,5 +90,5 @@
 
     protected:
-        InputState() : priority_(0), executorOnEnter_(0), executorOnLeave_(0) { }
+        InputState() : priority_(0), bHandlersChanged_(false), executorOnEnter_(0), executorOnLeave_(0) { }
         virtual ~InputState() { }
 
@@ -96,4 +99,6 @@
                 bInputDeviceEnabled_[device] = bEnabled;
         }
+
+        bool bHandlersChanged_;
 
     private:
Index: code/trunk/src/core/input/SimpleInputState.cc
===================================================================
--- code/trunk/src/core/input/SimpleInputState.cc	(revision 1877)
+++ code/trunk/src/core/input/SimpleInputState.cc	(revision 1878)
@@ -184,19 +184,19 @@
     }
 
-    void SimpleInputState::removeAndDestroyAllHandlers()
-    {
-        for (std::vector<InputTickable*>::iterator it = allHandlers_.begin();
-            it != allHandlers_.end(); ++it)
-            delete *it;
-
-        allHandlers_.clear();
-        keyHandler_ = 0;
-        mouseHandler_ = 0;
-        joyStickHandlerAll_ = 0;
-        for (unsigned int iJoyStick = 0; iJoyStick < joyStickHandler_.size(); ++iJoyStick)
-            joyStickHandler_[iJoyStick] = 0;
-
-        update();
-    }
+    //void SimpleInputState::removeAndDestroyAllHandlers()
+    //{
+    //    for (std::vector<InputHandler*>::iterator it = allHandlers_.begin();
+    //        it != allHandlers_.end(); ++it)
+    //        delete *it;
+
+    //    allHandlers_.clear();
+    //    keyHandler_ = 0;
+    //    mouseHandler_ = 0;
+    //    joyStickHandlerAll_ = 0;
+    //    for (unsigned int iJoyStick = 0; iJoyStick < joyStickHandler_.size(); ++iJoyStick)
+    //        joyStickHandler_[iJoyStick] = 0;
+
+    //    update();
+    //}
 
     /**
@@ -208,5 +208,5 @@
         True if added, false if handler already existed.
     */
-    bool SimpleInputState::setHandler(InputTickable* handler)
+    bool SimpleInputState::setHandler(InputHandler* handler)
     {
         setKeyHandler(dynamic_cast<KeyHandler*>(handler));
@@ -247,5 +247,5 @@
     {
         // we can use a set to have a list of unique pointers (an object can implement all 3 handlers)
-        std::set<InputTickable*> tempSet;
+        std::set<InputHandler*> tempSet;
         if (keyHandler_)
             tempSet.insert(keyHandler_);
@@ -258,5 +258,5 @@
         // copy the content of the map back to the actual vector
         allHandlers_.clear();
-        for (std::set<InputTickable*>::const_iterator itHandler = tempSet.begin();
+        for (std::set<InputHandler*>::const_iterator itHandler = tempSet.begin();
             itHandler != tempSet.end(); itHandler++)
             allHandlers_.push_back(*itHandler);
@@ -267,4 +267,7 @@
         for (unsigned int i = 0; i < joyStickHandler_.size(); ++i)
             setInputDeviceEnabled(2 + i, (joyStickHandler_[i] != 0));
+
+        // inform InputManager that there might be changes in EMPTY_HANDLER situation
+        bHandlersChanged_ = true;
     }
 }
Index: code/trunk/src/core/input/SimpleInputState.h
===================================================================
--- code/trunk/src/core/input/SimpleInputState.h	(revision 1877)
+++ code/trunk/src/core/input/SimpleInputState.h	(revision 1878)
@@ -52,6 +52,6 @@
         bool setJoyStickHandler   (JoyStickHandler* handler, unsigned int joyStickID);
         bool setJoyStickHandler   (JoyStickHandler* handler);
-        bool setHandler(InputTickable* handler);
-        void removeAndDestroyAllHandlers();
+        bool setHandler(InputHandler* handler);
+        //void removeAndDestroyAllHandlers();
 
     private:
@@ -84,5 +84,5 @@
         std::vector<JoyStickHandler*> joyStickHandler_;
         JoyStickHandler*              joyStickHandlerAll_;
-        std::vector<InputTickable*>   allHandlers_;
+        std::vector<InputHandler*>   allHandlers_;
     };
 }
Index: code/trunk/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 1877)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.cc	(revision 1878)
@@ -140,4 +140,7 @@
         using namespace Ogre;
 
+        // remove our WindowEventListener first to avoid bad calls in the procedures
+        Ogre::WindowEventUtilities::removeWindowEventListener(this->renderWindow_, this);
+
         delete this->guiManager_;
 
@@ -149,6 +152,4 @@
 
         // destroy render window
-        this->renderWindow_->removeAllViewports();
-        this->renderWindow_->removeAllListeners();
         RenderSystem* renderer = this->ogreRoot_->getRenderSystem();
         renderer->destroyRenderWindow("Orxonox");
@@ -360,8 +361,11 @@
         The render window it occured in
     */
-    void GSGraphics::windowFocusChanged(Ogre::RenderWindow *rw)
+    void GSGraphics::windowFocusChange(Ogre::RenderWindow *rw)
     {
         for (ObjectList<orxonox::WindowEventListener>::iterator it = ObjectList<orxonox::WindowEventListener>::begin(); it; ++it)
             it->windowFocusChanged();
+
+        // instruct InputManager to clear the buffers (core library so we cannot use the interface)
+        InputManager::getInstance().clearBuffers();
     }
 
Index: code/trunk/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 1877)
+++ code/trunk/src/orxonox/gamestates/GSGraphics.h	(revision 1878)
@@ -65,5 +65,5 @@
         void windowMoved       (Ogre::RenderWindow* rw);
         void windowResized     (Ogre::RenderWindow* rw);
-        void windowFocusChanged(Ogre::RenderWindow* rw);
+        void windowFocusChange (Ogre::RenderWindow* rw);
         void windowClosed      (Ogre::RenderWindow* rw);
 
Index: code/trunk/src/orxonox/gui/GUIManager.cc
===================================================================
--- code/trunk/src/orxonox/gui/GUIManager.cc	(revision 1877)
+++ code/trunk/src/orxonox/gui/GUIManager.cc	(revision 1878)
@@ -156,5 +156,5 @@
                 SimpleInputState* state = InputManager::getInstance().createInputState<SimpleInputState>("gui", 30);
                 state->setHandler(this);
-                state->setJoyStickHandler(new EmptyHandler());
+                state->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
 
                 // load the background scene
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.cc
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 1877)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.cc	(revision 1878)
@@ -70,4 +70,5 @@
         , consoleOverlayBorder_(0)
         , consoleOverlayTextAreas_(0)
+        , inputState_(0)
     {
         RegisterObject(InGameConsole);
@@ -143,4 +144,25 @@
         SetConfigValue(noiseSize_, 1.0f);
         SetConfigValue(cursorSymbol_, '|');
+        SetConfigValue(bHidesAllInput_, false).callback(this, &InGameConsole::bHidesAllInputChanged);
+    }
+
+    /**
+        @brief Called whenever bHidesAllInput_ changes.
+    */
+    void InGameConsole::bHidesAllInputChanged()
+    {
+        if (inputState_)
+        {
+            if (bHidesAllInput_)
+            {
+                inputState_->setMouseHandler(&InputManager::EMPTY_HANDLER);
+                inputState_->setJoyStickHandler(&InputManager::EMPTY_HANDLER);
+            }
+            else
+            {
+                inputState_->setMouseHandler(0);
+                inputState_->setJoyStickHandler(0);
+            }
+        }
     }
 
@@ -151,6 +173,7 @@
     {
         // create the corresponding input state
-        InputManager::getInstance().createInputState<SimpleInputState>("console", 40)
-            ->setKeyHandler(Shell::getInstance().getInputBuffer());
+        inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("console", 40);
+        inputState_->setKeyHandler(Shell::getInstance().getInputBuffer());
+        bHidesAllInputChanged();
 
         // create overlay and elements
Index: code/trunk/src/orxonox/overlays/console/InGameConsole.h
===================================================================
--- code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 1877)
+++ code/trunk/src/orxonox/overlays/console/InGameConsole.h	(revision 1878)
@@ -81,4 +81,7 @@
         void windowResized(int newWidth, int newHeight);
 
+        // config value related
+        void bHidesAllInputChanged();
+
         static Ogre::UTFString convert2UTF(std::string s);
 
@@ -102,4 +105,7 @@
         Ogre::TextAreaOverlayElement** consoleOverlayTextAreas_;
 
+        // input related
+        SimpleInputState* inputState_;
+
         // config values
         float relativeWidth;
@@ -109,4 +115,5 @@
         float noiseSize_;
         char cursorSymbol_;
+        bool bHidesAllInput_;
 
         static InGameConsole* singletonRef_s;
