/**
   * Handle a keyUp event.
   *
   * @param keyCode the keyCode of the keyUp event
   */
  public void keyUp(int keyCode, KeyEvent event) {
    boolean allowToggle = isEventFromToggleDevice(event);
    switch (keyCode) {
      case KeyEvent.KEYCODE_ALT_LEFT:
      case KeyEvent.KEYCODE_ALT_RIGHT:
        if (allowToggle) {
          mAltKey.onRelease();
          updateCursorMode();
        }
        break;
      case KeyEvent.KEYCODE_SHIFT_LEFT:
      case KeyEvent.KEYCODE_SHIFT_RIGHT:
        if (allowToggle) {
          mCapKey.onRelease();
          updateCursorMode();
        }
        break;

      case KEYCODE_CTRL_LEFT:
      case KEYCODE_CTRL_RIGHT:
        // ignore control keys.
        break;

      default:
        // Ignore other keyUps
        break;
    }
  }
 public void handleFnKey(boolean down) {
   if (down) {
     mFnKey.onPress();
   } else {
     mFnKey.onRelease();
   }
   updateCursorMode();
 }