Index: branches/gui/src/lib/event/event_handler.cc
===================================================================
--- branches/gui/src/lib/event/event_handler.cc	(revision 7896)
+++ branches/gui/src/lib/event/event_handler.cc	(revision 7897)
@@ -94,4 +94,22 @@
 void EventHandler::setState(elState state)
 {
+  /// When Changing the State, all the keys will be released.
+  /// This is done by sending each eventListener, that still
+  /// has an Event subscribed, a Release Event.
+  int keyCount;
+  Uint8 * pressedKeys = SDL_GetKeyState(&keyCount);
+  for (unsigned int i = 0; i < SDLK_LAST; i++)
+  {
+    if (pressedKeys[i])
+    {
+      Event ev;
+      ev.bPressed = false;
+      ev.type = i;
+      if (unlikely(this->bUNICODE[this->state]))
+        ev.x = i;
+      this->dispachEvent( ev );
+    }
+  }
+
   this->state = state;
   SDL_EnableUNICODE(this->bUNICODE[state]);
@@ -227,4 +245,10 @@
 }
 
+/**
+ * @brief returns true if at state and eventType there is something subscribed.
+ * @param state the state to check in.
+ * @param eventType the eventtype to check.
+ * @returns true if a event is subscibed.
+ */
 bool EventHandler::isSubscribed(elState state, int eventType)
 {
@@ -260,4 +284,9 @@
 
 
+/**
+ * @brief if the unicode characters should be recorded.
+ * @param state the State in whitch to set the new Value.
+ * @param enableUNICODE: enabled, or disabled.
+ */
 void EventHandler::withUNICODE(elState state, bool enableUNICODE)
 {
@@ -267,4 +296,8 @@
 }
 
+/**
+ * @brief grabs InputEvents.
+ * @param grabEvents if the Events should be grabbed(true) or released(false)
+ */
 void EventHandler::grabEvents(bool grabEvents)
 {
@@ -281,4 +314,5 @@
   }
 }
+
 
 /**
@@ -287,5 +321,5 @@
  * The event from the SDL framework are collected here and distributed to all listeners.
  */
-void EventHandler::process()
+void EventHandler::process() const
 {
   SDL_Event event;
@@ -355,25 +389,36 @@
         break;
     }
-
-    /* small debug routine: shows all events dispatched by the event handler */
-    PRINT(4)("\n==========================| EventHandler::process () |===\n");
-    PRINT(4)("=  Got Event nr %i, for state %i\n", ev.type, this->state);
-
-    /// setting a temporary state in case of an EventListener's process changes the state.
-    elState currentState = this->state;
-    for (unsigned int i = 0; i < this->listeners[currentState][ev.type].size(); i++)
-    {
-      PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
-      PRINT(4)("=  Got Event nr %i, for state %i %s::%s\n", ev.type, currentState, this->listeners[this->state][ev.type][i]->getClassName(), this->listeners[currentState][ev.type][i]->getName());
-      PRINT(4)("=======================================================\n");
-      this->listeners[currentState][ev.type][i]->process(ev);
-    }
-    /*    else
-        {
-          PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
-          PRINT(4)("=======================================================\n");
-        }*/
-  }
-}
+    this->dispachEvent(ev);
+  }
+}
+
+
+/**
+ * @brief dispaches an Event.
+ * @param event the Event to dispach.
+ */
+void EventHandler::dispachEvent(const Event& event) const
+{
+  /* small debug routine: shows all events dispatched by the event handler */
+  PRINT(4)("\n==========================| EventHandler::process () |===\n");
+  PRINT(4)("=  Got Event nr %i, for state %i\n", event.type, this->state);
+
+  /// setting a temporary state in case of an EventListener's process changes the state.
+  elState currentState = this->state;
+  for (unsigned int i = 0; i < this->listeners[currentState][event.type].size(); i++)
+  {
+    PRINT(4)("=  Event dispatcher msg: This event has been consumed\n");
+    PRINT(4)("=  Got Event nr %i, for state %i %s::%s\n", event.type, currentState, this->listeners[this->state][event.type][i]->getClassName(), this->listeners[currentState][event.type][i]->getName());
+    PRINT(4)("=======================================================\n");
+    this->listeners[currentState][event.type][i]->process(event);
+  }
+  /*    else
+  {
+        PRINT(4)("=  Event dispatcher msg: This event has NOT been consumed\n");
+        PRINT(4)("=======================================================\n");
+  }*/
+}
+
+
 
 /**
Index: branches/gui/src/lib/event/event_handler.h
===================================================================
--- branches/gui/src/lib/event/event_handler.h	(revision 7896)
+++ branches/gui/src/lib/event/event_handler.h	(revision 7897)
@@ -11,4 +11,5 @@
 #include "key_mapper.h"
 #include "event_def.h"
+#include "event.h"
 #include <stack>
 #include <vector>
@@ -45,5 +46,6 @@
   bool grabbedEvents() const { return this->eventsGrabbed; };
 
-  void process();
+  void process() const;
+  void dispachEvent(const Event& event) const;
 
   static int eventFilter(const SDL_Event *event);
