Ejemplo n.º 1
0
  /**
   * The processCode method deciphers each key press or combination of key presses and converts them
   * into VT100 format bytes
   *
   * @param c Key/Char code
   */
  public void processCode(Code c) {
    int k = 0;
    boolean isCharCode = false;
    if (c.getCharCode() != 0) {
      k = c.getCharCode();
    } else if (c.getKeyCode() != 0) k = c.getKeyCode();

    if (c.isCtrlDown()) {
      k = ctrlPressed(k);
      if (k == -1) return;
    } else if (c.isFunctionKey() || c.isAltDown()) {
      k = fromKeyDownSwitch(k);
      if (k == -1) return;
    }
    if (buildCharacter(k, isCharCode) != null) {
      queue(buildCharacter(k, isCharCode));
    }
  }