void
    PointingRelativeToScroll::add(unsigned int datatype, unsigned int newval)
    {
      switch (datatype) {
        case BRIDGE_DATATYPE_FLAGS:
        {
          switch (index_type_) {
            case INDEX_TYPE_DEFAULT:
              fromFlags_ = Flags(newval);
              break;
            case INDEX_TYPE_TOFLAGS:
              toFlags_ = Flags(newval);
              break;
            case INDEX_TYPE_TOKEYS:
              keytokey_.add(datatype, newval);
              break;
          }
          break;
        }

        case BRIDGE_DATATYPE_KEYCODE:
        case BRIDGE_DATATYPE_CONSUMERKEYCODE:
        case BRIDGE_DATATYPE_POINTINGBUTTON:
        {
          switch (index_type_) {
            case INDEX_TYPE_DEFAULT:
              fromEvent_ = FromEvent(datatype, newval);
              toEvent_ = ToEvent(datatype, newval);
              break;
            case INDEX_TYPE_TOKEYS:
              keytokey_.add(datatype, newval);
              break;
            default:
              IOLOG_ERROR("PointingRelativeToScroll::add invalid BRIDGE_DATATYPE_POINTINGBUTTON\n");
              break;
          }
          break;
        }

        case BRIDGE_DATATYPE_OPTION:
        {
          Option option(newval);
          if (Option::POINTINGRELATIVETOSCROLL_TOFLAGS == option) {
            index_type_ = INDEX_TYPE_TOFLAGS;
          }
          if (Option::POINTINGRELATIVETOSCROLL_TOKEYS == option) {
            index_type_ = INDEX_TYPE_TOKEYS;
            isToKeysDefined_ = true;
            keytokey_.add(KeyCode::VK_PSEUDO_KEY);
            keytokey_.add(fromFlags_);
          }
          break;
        }

        default:
          IOLOG_ERROR("PointingRelativeToScroll::add invalid datatype:%d\n", datatype);
          break;
      }
    }
    void
    PointingRelativeToScroll::add(AddDataType datatype, AddValue newval)
    {
      switch (datatype) {
        case BRIDGE_DATATYPE_MODIFIERFLAG:
        case BRIDGE_DATATYPE_MODIFIERFLAGS_END:
        {
          switch (index_type_) {
            case INDEX_TYPE_DEFAULT:
              fromModifierFlags_.push_back(ModifierFlag(datatype, newval));
              keytokey_.add(datatype, newval);
              break;
            case INDEX_TYPE_TOFLAGS:
              toModifierFlags_.push_back(ModifierFlag(datatype, newval));
              break;
            case INDEX_TYPE_TOKEYS:
              keytokey_.add(datatype, newval);
              break;
          }
          break;
        }

        case BRIDGE_DATATYPE_KEYCODE:
        case BRIDGE_DATATYPE_CONSUMERKEYCODE:
        case BRIDGE_DATATYPE_POINTINGBUTTON:
        {
          switch (index_type_) {
            case INDEX_TYPE_DEFAULT:
              fromEvent_ = FromEvent(datatype, newval);
              toEvent_ = ToEvent(datatype, newval);
              break;
            case INDEX_TYPE_TOKEYS:
              keytokey_.add(datatype, newval);
              break;
            default:
              IOLOG_ERROR("PointingRelativeToScroll::add invalid BRIDGE_DATATYPE_POINTINGBUTTON\n");
              break;
          }
          break;
        }

        case BRIDGE_DATATYPE_OPTION:
        {
          Option option(newval);
          if (Option::POINTINGRELATIVETOSCROLL_TOFLAGS == option) {
            index_type_ = INDEX_TYPE_TOFLAGS;
          }
          if (Option::POINTINGRELATIVETOSCROLL_TOKEYS == option) {
            index_type_ = INDEX_TYPE_TOKEYS;
            isToKeysDefined_ = true;
          }
          break;
        }

        default:
          IOLOG_ERROR("PointingRelativeToScroll::add invalid datatype:%u\n", static_cast<unsigned int>(datatype));
          break;
      }
    }
    void
    DropKeyAfterRemap::add(unsigned int datatype, unsigned int newval)
    {
      switch (datatype) {
        case BRIDGE_DATATYPE_KEYCODE:
        {
          fromEvent_ = FromEvent(datatype, newval);
          break;
        }

        case BRIDGE_DATATYPE_FLAGS:
        {
          fromFlags_ = Flags(newval);
          break;
        }

        default:
          IOLOG_ERROR("DropKeyAfterRemap::add invalid datatype:%d\n", datatype);
          break;
      }
    }
Esempio n. 4
0
    void
    DropKeyAfterRemap::add(AddDataType datatype, AddValue newval)
    {
      switch (datatype) {
        case BRIDGE_DATATYPE_KEYCODE:
        {
          fromEvent_ = FromEvent(datatype, newval);
          break;
        }

        case BRIDGE_DATATYPE_MODIFIERFLAG:
        case BRIDGE_DATATYPE_MODIFIERFLAGS_END:
        {
          fromModifierFlags_.push_back(ModifierFlag(datatype, newval));
          break;
        }

        default:
          IOLOG_ERROR("DropKeyAfterRemap::add invalid datatype:%u\n", static_cast<unsigned int>(datatype));
          break;
      }
    }
Esempio n. 5
0
 PressingEvent(const Params_Base& p) : p_(Params_Factory::copy(p)),
                                       ignore_(false) {
   fromEvent_ = FromEvent(Params_Base::safe_dereference(p_));
 }
Esempio n. 6
0
void HoldingKeyToKey::add(AddDataType datatype, AddValue newval) {
  switch (datatype) {
  case BRIDGE_DATATYPE_KEYCODE:
  case BRIDGE_DATATYPE_CONSUMERKEYCODE:
  case BRIDGE_DATATYPE_POINTINGBUTTON: {
    switch (index_) {
    case 0:
      fromEvent_ = FromEvent(datatype, newval);
      dppkeytokey_.setFromEvent(fromEvent_);
      break;

    default:
      if (!isUseSeparator_ &&
          datatype == BRIDGE_DATATYPE_KEYCODE &&
          KeyCode::VK_NONE == KeyCode(newval) &&
          indexType_ == INDEX_IS_NORMAL) {
        indexType_ = INDEX_IS_HOLDING;
      } else {
        addToDependingPressingPeriodKeyToKey(datatype, newval);
      }
      break;
    }
    ++index_;

    break;
  }

  case BRIDGE_DATATYPE_MODIFIERFLAG:
  case BRIDGE_DATATYPE_MODIFIERFLAGS_END:
  case BRIDGE_DATATYPE_OPTION:
  case BRIDGE_DATATYPE_DELAYUNTILREPEAT:
  case BRIDGE_DATATYPE_KEYREPEAT: {
    switch (index_) {
    case 0:
      if (datatype == BRIDGE_DATATYPE_OPTION && Option::USE_SEPARATOR == Option(newval)) {
        isUseSeparator_ = true;
      } else {
        IOLOG_ERROR("Invalid HoldingKeyToKey::add\n");
      }
      break;

    case 1: {
      if (datatype == BRIDGE_DATATYPE_MODIFIERFLAG ||
          datatype == BRIDGE_DATATYPE_MODIFIERFLAGS_END) {
        dppkeytokey_.addFromModifierFlags(datatype, newval);
      }
      break;
    }

    default:
      if (datatype == BRIDGE_DATATYPE_OPTION && Option::SEPARATOR == Option(newval)) {
        if (index_ >= 2 &&
            indexType_ == INDEX_IS_NORMAL) {
          indexType_ = INDEX_IS_HOLDING;
        }
      } else if (datatype == BRIDGE_DATATYPE_OPTION && Option::KEYTOKEY_BEFORE_KEYDOWN == Option(newval)) {
        indexType_ = INDEX_IS_KEYTOKEY_BEFORE_KEYDOWN;
        dppkeytokey_.addBeforeAfterKeys(datatype, newval);
      } else if (datatype == BRIDGE_DATATYPE_OPTION && Option::KEYTOKEY_AFTER_KEYUP == Option(newval)) {
        indexType_ = INDEX_IS_KEYTOKEY_AFTER_KEYUP;
        dppkeytokey_.addBeforeAfterKeys(datatype, newval);
      } else {
        addToDependingPressingPeriodKeyToKey(datatype, newval);
      }
      break;
    }
    break;
  }

  case BRIDGE_DATATYPE_THRESHOLDMILLISECOND:
    dppkeytokey_.overwritePeriodMS(DependingPressingPeriodKeyToKey::PeriodMS::Mode::HOLDING_KEY_TO_KEY,
                                   DependingPressingPeriodKeyToKey::PeriodMS::Type::SHORT_PERIOD,
                                   newval);
    break;

  default:
    IOLOG_ERROR("HoldingKeyToKey::add invalid datatype:%u\n", static_cast<unsigned int>(datatype));
    break;
  }
}
Esempio n. 7
0
    void
    KeyToKey::add(AddDataType datatype, AddValue newval)
    {
      switch (datatype) {
        case BRIDGE_DATATYPE_KEYCODE:
        case BRIDGE_DATATYPE_CONSUMERKEYCODE:
        case BRIDGE_DATATYPE_POINTINGBUTTON:
        {
          switch (index_) {
            case 0:
              fromEvent_ = FromEvent(datatype, newval);
              break;
            default:
              getCurrentToEvent().push_back(ToEvent(datatype, newval));
              break;
          }
          ++index_;

          break;
        }

        case BRIDGE_DATATYPE_MODIFIERFLAG:
        case BRIDGE_DATATYPE_MODIFIERFLAGS_END:
        {
          switch (index_) {
            case 0:
              IOLOG_ERROR("Invalid KeyToKey::add\n");
              break;
            case 1:
            {
              ModifierFlag modifierFlag(datatype, newval);
              fromModifierFlags_.push_back(modifierFlag);
              if (fromEvent_.getModifierFlag() != modifierFlag) {
                pureFromModifierFlags_.push_back(modifierFlag);
              }
              break;
            }
            default:
              if (! getCurrentToEvent().empty()) {
                getCurrentToEvent().back().addModifierFlag(datatype, newval);
              }
              break;
          }
          break;
        }

        case BRIDGE_DATATYPE_OPTION:
        {
          Option option(newval);
          if (Option::NOREPEAT == option) {
            isRepeatEnabled_ = false;
          } else if (Option::KEYTOKEY_BEFORE_KEYDOWN == option) {
            currentToEvent_ = CurrentToEvent::BEFOREKEYS;
          } else if (Option::KEYTOKEY_AFTER_KEYUP == option) {
            currentToEvent_ = CurrentToEvent::AFTERKEYS;
          } else if (Option::USE_SEPARATOR == option ||
                     Option::SEPARATOR == option) {
            // do nothing
          } else {
            IOLOG_ERROR("KeyToKey::add unknown option:%u\n", static_cast<unsigned int>(newval));
          }
          break;
        }

        case BRIDGE_DATATYPE_DELAYUNTILREPEAT:
        {
          delayUntilRepeat_ = newval;
          break;
        }

        case BRIDGE_DATATYPE_KEYREPEAT:
        {
          keyRepeat_ = newval;
          break;
        }

        default:
          IOLOG_ERROR("KeyToKey::add invalid datatype:%u\n", static_cast<unsigned int>(datatype));
          break;
      }
    }