Exemplo n.º 1
0
void
PressDownKeys::add(KeyCode key, KeyboardType keyboardType) {
  if (key == KeyCode::VK_NONE) return;

  list_.push_back(new Item(key, keyboardType));

  IOLOG_DEVEL("PressDownKeys::add key:%d, keyboardType:%d\n", key.get(), keyboardType.get());
}
Exemplo n.º 2
0
void
PressDownKeys::remove(KeyCode key, KeyboardType keyboardType) {
  Item* p = static_cast<Item*>(list_.safe_front());
  for (;;) {
    if (!p) break;

    if (p->key == key &&
        p->keyboardType == keyboardType) {
      p = static_cast<Item*>(list_.erase_and_delete(p));
    } else {
      p = static_cast<Item*>(p->getnext());
    }
  }

  IOLOG_DEVEL("PressDownKeys::remove key:%d, keyboardType:%d\n", key.get(), keyboardType.get());
}
Exemplo n.º 3
0
  void
  KeyboardRepeat::set(EventType eventType,
                      Flags flags,
                      KeyCode key,
                      KeyboardType keyboardType,
                      int delayUntilRepeat,
                      int keyRepeat)
  {
    if (! queue_) return;

    if (key == KeyCode::VK_NONE) return;

    if (eventType == EventType::MODIFY) {
      goto cancel;

    } else if (eventType == EventType::UP) {
      // The repetition of plural keys is controlled by manual operation.
      // So, we ignore it.
      if (queue_->size() != 1) return;

      // We stop key repeat only when the repeating key is up.
      KeyboardRepeat::Item* p = static_cast<KeyboardRepeat::Item*>(queue_->front());
      if (p && (p->params).type == ParamsUnion::KEYBOARD) {
        Params_KeyboardEventCallBack* params = (p->params).params.params_KeyboardEventCallBack;
        if (params && key == params->key) {
          goto cancel;
        }
      }

    } else if (eventType == EventType::DOWN) {
      cancel();

      primitive_add(eventType, flags, key, keyboardType, Item::TYPE_NORMAL);
      primitive_start(delayUntilRepeat, keyRepeat);

      IOLOG_DEVEL("KeyboardRepeat::set key:%d flags:0x%x\n", key.get(), flags.get());

    } else {
      goto cancel;
    }

    return;

  cancel:
    cancel();
  }
Exemplo n.º 4
0
void KeyboardRepeat::set(EventType eventType,
                         Flags flags,
                         KeyCode key,
                         KeyboardType keyboardType,
                         int delayUntilRepeat,
                         int keyRepeat) {
  if (key == KeyCode::VK_NONE) return;

  if (eventType == EventType::MODIFY) {
    goto cancel;

  } else if (eventType == EventType::UP) {
    // The repetition of multiple keys is controlled by manual operation.
    // So, we ignore it.
    if (queue_.size() != 1) return;

    // We stop key repeat only when the repeating key is up.
    KeyboardRepeat::Item* p = static_cast<KeyboardRepeat::Item*>(queue_.safe_front());
    if (p) {
      auto params = (p->getParamsBase()).get_Params_KeyboardEventCallBack();
      if (params && key == params->key) {
        goto cancel;
      }
    }

  } else if (eventType == EventType::DOWN) {
    cancel();

    primitive_add(eventType, flags, key, keyboardType);
    primitive_start(delayUntilRepeat, keyRepeat);

    IOLOG_DEVEL("KeyboardRepeat::set key:%d flags:0x%x\n", key.get(), flags.get());

  } else {
    goto cancel;
  }

  return;

cancel:
  cancel();
}
 // utility
 void add(KeyCode newval) { add(AddDataType(BRIDGE_DATATYPE_KEYCODE), AddValue(newval.get())); }
 // ----------------------------------------
 // utility functions
 void add(KeyCode newval)        { add(BRIDGE_DATATYPE_KEYCODE, newval.get()); }
Exemplo n.º 7
0
 // ----------------------------------------
 static void log(bool isCaught, EventType eventType, Flags flags, KeyCode key, KeyboardType keyboardType, bool repeat) {
   IOLOG_DEBUG("KeyboardEventCallback [%7s]: eventType %2d, flags 0x%08x, key 0x%04x, kbdType %3d, repeat = %d\n",
               isCaught ? "caught" : "sending",
               eventType.get(), flags.get(), key.get(), keyboardType.get(), repeat);
 }
Exemplo n.º 8
0
 bool operator>=(KeyCode other) const { return value_ >= other.get(); }
 void add(KeyToKeyType::Value type, KeyCode newval) { add(type, BRIDGE_DATATYPE_KEYCODE, newval.get()); }
 void add(KeyToKeyType::Value type, KeyCode newval) {
   add(type, AddDataType(BRIDGE_DATATYPE_KEYCODE), AddValue(newval.get()));
 }