Ejemplo n.º 1
0
void LastReleasedPhysicalKey::update(const Params_Base& newval) {
  {
    auto p = newval.get_Params_KeyboardEventCallBack();

    if (p && !p->ex_iskeydown) {
      datatype_ = BRIDGE_DATATYPE_KEYCODE;
      value_ = (p->key).get();
      ic_.begin();
    }
  }
  {
    auto p = newval.get_Params_KeyboardSpecialEventCallback();

    if (p && !p->ex_iskeydown) {
      datatype_ = BRIDGE_DATATYPE_CONSUMERKEYCODE;
      value_ = (p->key).get();
      ic_.begin();
    }
  }
  {
    auto p = newval.get_Params_RelativePointerEventCallback();

    if (p && p->ex_button != PointingButton::NONE && !p->ex_isbuttondown) {
      datatype_ = BRIDGE_DATATYPE_POINTINGBUTTON;
      value_ = (p->ex_button).get();
      ic_.begin();
    }
  }
}
Ejemplo n.º 2
0
  bool operator==(const Params_Base& paramsBase) const {
    switch (type_) {
    case Type::KEY: {
      auto p = paramsBase.get_Params_KeyboardEventCallBack();
      if (p) {
        return key_ == p->key;
      }
      break;
    }

    case Type::CONSUMER_KEY: {
      auto p = paramsBase.get_Params_KeyboardSpecialEventCallback();
      if (p) {
        return consumer_ == p->key;
      }
      break;
    }

    case Type::POINTING_BUTTON: {
      auto p = paramsBase.get_Params_RelativePointerEventCallback();
      if (p) {
        return button_ == p->ex_button;
      }
      break;
    }

    case Type::NONE:
      break;
    }
    return false;
  }
Ejemplo n.º 3
0
void remap_KeyboardSpecialEventCallback(const Params_Base& paramsBase) {
  auto params = paramsBase.get_Params_KeyboardSpecialEventCallback();
  if (!params) return;

  PhysicalEventType physicalEventType = PhysicalEventType::UP;
  if (params->ex_iskeydown) {
    physicalEventType = PhysicalEventType::DOWN;
  }
  RemapParams remapParams(*params, physicalEventType);
  RemapClassManager::prepare(remapParams);
  RemapClassManager::remap(remapParams);

  // ----------------------------------------
  if (!remapParams.isremapped) {
    Params_KeyboardSpecialEventCallback p(params->eventType,
                                          FlagStatus::globalFlagStatus().makeFlags(),
                                          params->key,
                                          params->flavor,
                                          params->guid,
                                          false);
    KeyboardRepeat::set(p, AutogenId::maxValue());
    EventOutputQueue::FireConsumer::fire(p, AutogenId::maxValue(), physicalEventType);
  }

  RemapFunc::PointingRelativeToScroll::cancelScroll();
}
Ejemplo n.º 4
0
bool FromEvent::isTargetEvent(bool& isDown, const Params_Base& paramsBase) const {
  switch (type_) {
  case Type::NONE: {
    return false;
  }

  case Type::KEY: {
    auto p = paramsBase.get_Params_KeyboardEventCallBack();
    if (!p) return false;

    if (p->key != key_) return false;

    isDown = p->ex_iskeydown;
    return true;
  }

  case Type::CONSUMER_KEY: {
    auto p = paramsBase.get_Params_KeyboardSpecialEventCallback();
    if (!p) return false;

    if (p->key != consumer_) return false;

    isDown = p->ex_iskeydown;
    return true;
  }

  case Type::POINTING_BUTTON: {
    auto p = paramsBase.get_Params_RelativePointerEventCallback();
    if (!p) return false;

    if (p->ex_button != button_) return false;

    isDown = p->ex_isbuttondown;
    return true;
  }
  }

  return false;
}
Ejemplo n.º 5
0
void remap_KeyboardSpecialEventCallback(const Params_Base& paramsBase) {
  auto params = paramsBase.get_Params_KeyboardSpecialEventCallback();
  if (!params) return;

  RemapParams remapParams(*params);
  RemapClassManager::prepare(remapParams);
  RemapClassManager::remap(remapParams);

  // ----------------------------------------
  if (!remapParams.isremapped) {
    Params_KeyboardSpecialEventCallback p(params->eventType,
                                          FlagStatus::globalFlagStatus().makeFlags(),
                                          params->key,
                                          params->flavor,
                                          params->guid,
                                          false);
    KeyboardRepeat::set(p);
    EventOutputQueue::FireConsumer::fire(p);
  }

  resetWhenPressingPhysicalKeysIsEmpty();

  RemapFunc::PointingRelativeToScroll::cancelScroll();
}