Index: code/branches/presentation/src/core/input/InputManager.cc
===================================================================
--- code/branches/presentation/src/core/input/InputManager.cc	(revision 2370)
+++ code/branches/presentation/src/core/input/InputManager.cc	(revision 2543)
@@ -65,5 +65,4 @@
     SetCommandLineSwitch(keyboard_no_grab);
 
-    std::string InputManager::bindingCommmandString_s = "";
     EmptyHandler InputManager::EMPTY_HANDLER;
     InputManager* InputManager::singletonRef_s = 0;
@@ -174,5 +173,5 @@
             if (joyStickSupport)
                 _initialiseJoySticks();
-            // Do this anyway to also inform everyone if a joystick was detached.
+            // Do this anyway to also inform everything when a joystick was detached.
             _configureNumberOfJoySticks();
 
@@ -492,5 +491,6 @@
             }
         }
-	singletonRef_s = 0;
+
+        singletonRef_s = 0;
     }
 
@@ -660,5 +660,5 @@
     /**
     @brief
-        Updates the InputManager. Tick is called by the Core class.
+        Updates the states and the InputState situation.
     @param dt
         Delta time
@@ -676,36 +676,45 @@
 
         // check for states to leave
-        for (std::set<InputState*>::reverse_iterator rit = stateLeaveRequests_.rbegin();
-            rit != stateLeaveRequests_.rend(); ++rit)
-        {
-            (*rit)->onLeave();
-            // just to be sure that the state actually is registered
-            assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
-
-            activeStates_.erase((*rit)->getPriority());
-            _updateActiveStates();
-        }
-        stateLeaveRequests_.clear();
+        if (!stateLeaveRequests_.empty())
+        {
+            for (std::set<InputState*>::reverse_iterator rit = stateLeaveRequests_.rbegin();
+                rit != stateLeaveRequests_.rend(); ++rit)
+            {
+                (*rit)->onLeave();
+                // just to be sure that the state actually is registered
+                assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
+
+                activeStates_.erase((*rit)->getPriority());
+                _updateActiveStates();
+            }
+            stateLeaveRequests_.clear();
+        }
 
         // check for states to enter
-        for (std::set<InputState*>::reverse_iterator rit = stateEnterRequests_.rbegin();
-            rit != stateEnterRequests_.rend(); ++rit)
-        {
-            // just to be sure that the state actually is registered
-            assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
-
-            activeStates_[(*rit)->getPriority()] = (*rit);
-            _updateActiveStates();
-            (*rit)->onEnter();
-        }
-        stateEnterRequests_.clear();
+        if (!stateEnterRequests_.empty())
+        {
+            for (std::set<InputState*>::reverse_iterator rit = stateEnterRequests_.rbegin();
+                rit != stateEnterRequests_.rend(); ++rit)
+            {
+                // just to be sure that the state actually is registered
+                assert(inputStatesByName_.find((*rit)->getName()) != inputStatesByName_.end());
+
+                activeStates_[(*rit)->getPriority()] = (*rit);
+                _updateActiveStates();
+                (*rit)->onEnter();
+            }
+            stateEnterRequests_.clear();
+        }
 
         // check for states to destroy
-        for (std::set<InputState*>::reverse_iterator rit = stateDestroyRequests_.rbegin();
-            rit != stateDestroyRequests_.rend(); ++rit)
-        {
-            _destroyState((*rit));
-        }
-        stateDestroyRequests_.clear();
+        if (!stateDestroyRequests_.empty())
+        {
+            for (std::set<InputState*>::reverse_iterator rit = stateDestroyRequests_.rbegin();
+                rit != stateDestroyRequests_.rend(); ++rit)
+            {
+                _destroyState((*rit));
+            }
+            stateDestroyRequests_.clear();
+        }
 
         // check whether a state has changed its EMPTY_HANDLER situation
@@ -1124,5 +1133,5 @@
 
         // keep in mind that the first 8 axes are reserved for the sliders
-        _fireAxis(iJoyStick, axis + 8, arg.state.mAxes[axis].abs);
+        _fireAxis(iJoyStick, axis + sliderAxes, arg.state.mAxes[axis].abs);
 
         return true;
