title: Problems with single-tap and press-and-hold with LWJGL
body: <p>I've been researching a way to use LWJGL for my input system. I'm having problems detecting if it is a single-press or a press-and-hold. The event fires twice when I tap, instead of just once.</p>
  
  <pre><code>    while(Keyboard.next())
      {
          if(Keyboard.getEventKeyState())
          {
              if(Keyboard.isRepeatEvent())
              {
                  //Key held.
                  doAction(Keyboard.getEventKey(), true, false);
              }
              else
              {
                  //Key pressed
                  doAction(Keyboard.getEventKey(), false, false);
              }
          }
          else
          {
              //Fired when key is released.
              doAction(Keyboard.getEventKey(), false, true);
          }
      }
  </code></pre>
  
  <p>Edit: I've both resolved the issue and modified this. Here you go, a modified version. (Dammit, Teamviewer..)</p>
  
  <pre><code>/**
   * Updates all mouse info, keys bound, and performs actions.
   */
  public static void tick()
  {
      mouseButtons[0] = Mouse.isButtonDown(0);
      mouseButtons[1] = Mouse.isButtonDown(1);
  
      mousePos[0] = Mouse.getX();
      mousePos[1] = Mouse.getY();
  
      while(Keyboard.next())
      {
          doAction(0, false);
          if(Keyboard.getEventKeyState())
          {
              if(!Keyboard.isRepeatEvent())
              {
                  doAction(Keyboard.getEventKey(), false);
              }
          }
          else
          {
              doAction(Keyboard.getEventKey(), true);
          }
      }
  
      while(Mouse.next())
      {
      }
  }
  
  /**
   * Does the associated action for each key. Called automatically from tick.
   * @param key The key to check &amp; perform associated action
   */
  public static void doAction(int key, boolean ifReleased)
  {
      if(mouseButtons[0])
      {
  
      }
      if(mouseButtons[1])
      {
  
      }
      if(key == 2 &amp; !ifReleased)
      {
          System.out.println("a");
      }
      if(Keyboard.isKeyDown(3))
      {
          System.out.println("b");            
      }
  }
  </code></pre>