Index: /orxonox/trunk/src/lib/gui/gui/gui_keys.cc
===================================================================
--- /orxonox/trunk/src/lib/gui/gui/gui_keys.cc	(revision 4085)
+++ /orxonox/trunk/src/lib/gui/gui/gui_keys.cc	(revision 4086)
@@ -43,4 +43,14 @@
 
   this->keysFrame->fill(this->keysBox);
+
+
+  this->inputWindow = new Window("inputWindow");
+  this->inputButton = new Button("test");
+#ifdef HAVE_GTK2
+  this->inputWindow->connectSignal("destroy",  Widget::doNothingSignal);
+  this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal);
+#endif /* HAVE_GTK2 */
+  this->inputWindow->fill(inputButton);
+
   this->setMainWidget(keysFrame);
 }
@@ -53,4 +63,10 @@
   // nothing to do here.
 }
+
+
+Window* GuiKeys::inputWindow = NULL;
+Button* GuiKeys::inputButton = NULL;
+long GuiKeys::keySignal = 0;
+
 
 /* PLAYER */
@@ -93,14 +109,21 @@
   this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen);
 #endif /* HAVE_GTK2 */
-
-  this->inputWindow = new Window("inputWindow");
-
-  this->inputButton = new Button("test");
-  this->inputWindow->fill(inputButton);
-#ifdef HAVE_GTK2
-  this->inputWindow->connectSignal("destroy",  Widget::doNothingSignal);
-  this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal);
-#endif /* HAVE_GTK2 */
-
+}
+
+/**
+   \returns the OpenButton of a Player
+*/
+Button* Player::getOpenButton(void)
+{
+  return this->openButton;
+}
+
+/**
+   \brief sets a new Key(only output)
+   \param key the new Key.
+*/
+void Player::setkey(KEYS key)
+{
+  PRINT(4)("setting up Key: %d\n", key);
 }
 
@@ -111,48 +134,28 @@
    \returns A widget that has the Key-Box
 */
-Widget* Player::addKey(KEYS key, char* name)
-{
-  this->inputKey[key] = new InputKey;
-  this->inputKey[key]->pKeyBox = new Box();
-  this->inputKey[key]->pKeyButton = new Button(name);
-  this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name);
-  this->inputKey[key]->pKeyOLabel->saveability();
-
-#ifdef HAVE_GTK2
-  //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb);
-  this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent);
-#endif /* HAVE_GTK2 */
-  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton);
-  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel);
-  return this->inputKey[key]->pKeyBox;
-}
-
-/**
-   \returns the OpenButton of a Player
-*/
-Button* Player::getOpenButton(void)
-{
-  return this->openButton;
-}
-
-/**
-   \brief sets a new Key(only output)
-   \param key the new Key.
-*/
-void Player::setkey(KEYS key)
-{
-  PRINT(4)("setting up Key: %d\n", key);
-}
-
-Window* Player::inputWindow = NULL;
-Button* Player::inputButton = NULL;
-long Player::keySignal = 0;
-
-#ifdef HAVE_GTK2
-gint Player::inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* inputKey)
-{
-  inputButton->setTitle("press a Key");
-  keySignal = inputButton->connectSignal("key_press_event", inputKey, key_cb);
-  inputWindow->open();
+Widget* addKey(KEYS key, char* name)
+{
+  InputKey* inputKey = new InputKey;
+  inputKey->pKeyBox = new Box();
+  inputKey->pKeyButton = new Button(name);
+  inputKey->pKeyOLabel = new OptionLabel(name, name);
+  inputKey->pKeyOLabel->saveability();
+
+#ifdef HAVE_GTK2
+  //inputKey->pKeyButton->connectSignal("key_press_event", inputKey->pKeyButton, key_cb);
+  inputKey->pKeyButton->connectSignal("button_press_event", inputKey, inputWindowEvent);
+#endif /* HAVE_GTK2 */
+  inputKey->pKeyBox->fill(inputKey->pKeyButton);
+  inputKey->pKeyBox->fill(inputKey->pKeyOLabel);
+  return inputKey->pKeyBox;
+}
+
+
+#ifdef HAVE_GTK2
+gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* inputKey)
+{
+  GuiKeys::inputButton->setTitle("press a Key");
+  GuiKeys::keySignal = GuiKeys::inputButton->connectSignal("key_press_event", inputKey, key_cb);
+  GuiKeys::inputWindow->open();
 }
   
@@ -164,5 +167,5 @@
    \returns Nothing
 */
-gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey)
+gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey)
 {
   InputKey* inputkey =(InputKey*) inputKey;
@@ -336,6 +339,6 @@
 
   inputkey->pKeyOLabel->setValue(title);
-  inputButton->disconnectSignal(keySignal);
-  inputWindow->close();
-}
-#endif /* HAVE_GTK2 */
+  GuiKeys::inputButton->disconnectSignal(GuiKeys::keySignal);
+  GuiKeys::inputWindow->close();
+}
+#endif /* HAVE_GTK2 */
Index: /orxonox/trunk/src/lib/gui/gui/gui_keys.h
===================================================================
--- /orxonox/trunk/src/lib/gui/gui/gui_keys.h	(revision 4085)
+++ /orxonox/trunk/src/lib/gui/gui/gui_keys.h	(revision 4086)
@@ -20,4 +20,13 @@
 enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT};
 
+//! One KeyOption has one InputKey
+struct InputKey
+{
+  Box* pKeyBox;           //!< One Box that holds the Keys
+  Button* pKeyButton;     //!< The Button for changing the Key.
+  OptionLabel* pKeyOLabel;//!< The Label for displaying the Key-setting.
+};
+
+
 class Player;
 //! Class that creates the Keys-Options.
@@ -34,4 +43,9 @@
   GuiKeys(void);
   ~GuiKeys(void);
+
+  static Window* inputWindow; //!< A Window that gets keyboard clicks. Static, because only one needed.
+  static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed.
+  static long keySignal;      //!< A keySignal that handles keyboard clicks. Static, because only one needed.
+
 };
 
@@ -48,33 +62,22 @@
   Button* closeButton;    //!< The CloseButton for this key-settings.
   Box* pKeysBox;          //!< The Box that holds the Key-settings.
-  
-  //! One KeyOption has one InputKey
-  struct InputKey
-  {
-    Box* pKeyBox;           //!< One Box that holds the Keys
-    Button* pKeyButton;     //!< The Button for changing the Key.
-    OptionLabel* pKeyOLabel;//!< The Label for displaying the Key-setting.
-  };
 
-  InputKey* inputKey[10];     //!< Buttons-array. \todo make it dynamic.
+  //  InputKey* inputKey[10];     //!< Buttons-array. \todo make it dynamic.
 
-  static Window* inputWindow; //!< A Window that gets keyboard clicks. Static, because only one needed.
-  static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed.
-  static long keySignal;      //!< A keySignal that handles keyboard clicks. Static, because only one needed.
  public:
   Player(char* player);
 
-  Widget* addKey(KEYS key, char* name);
 
   Button* getOpenButton(void);
 
-#ifdef HAVE_GTK2
-  static gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget);
-  static gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey);
-#endif /* HAVE_GTK2 */
   void setkey(KEYS key);
   
 };
 
+Widget* addKey(KEYS key, char* name);
+#ifdef HAVE_GTK2
+gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget);
+gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey);
+#endif /* HAVE_GTK2 */
 
 
