예제 #1
0
void DropAllKeys::cancelEventOutputQueueItems(void) {
  if (!doCancel_) {
    return;
  }

  for (EventOutputQueue::Item* p = static_cast<EventOutputQueue::Item*>(EventOutputQueue::getQueue().safe_front());
       p;
       p = static_cast<EventOutputQueue::Item*>(p->getnext())) {
    if (EventInputQueue::currentSerialNumber() != p->getEventInputQueueSerialNumber()) {
      continue;
    }
    // Do not cancel events which are pushed before this __DropAllKeys__.
    if (p->getAutogenId() < autogenId_) {
      continue;
    }

    auto& paramsBase = p->getParamsBase();

    // Do not drop any modifier flags.
    if (paramsBase.isModifier()) continue;

    {
      auto params = paramsBase.get_Params_KeyboardEventCallBack();
      if (params && dropKey_) {
        dropKey(*p);
      }
    }
    {
      auto params = paramsBase.get_Params_KeyboardSpecialEventCallback();
      if (params && dropConsumerKey_) {
        dropKey(*p);
      }
    }
    {
      auto params = paramsBase.get_Params_RelativePointerEventCallback();
      if (params && dropPointingButton_) {
        if (modifierMatched_ &&
            !(params->buttons).isNONE()) {
          p->cancel();
          return;
        }
      }
    }
  }
  doCancel_ = false;
}
예제 #2
0
void DropAllKeys::cancelEventOutputQueueItems(EventOutputQueue::Item& item) {
  if (!helper_.isTarget(item)) {
    return;
  }

  if (!doCancel_) {
    return;
  }

  // Do not cancel events which are pushed before this __DropAllKeys__.
  if (item.getAutogenId() < autogenId_) {
    return;
  }

  auto& paramsBase = item.getParamsBase();

  // Do not drop any modifier flags.
  if (paramsBase.isModifier()) return;

  {
    auto params = paramsBase.get_Params_KeyboardEventCallBack();
    if (params && dropKey_) {
      dropKey(item);
    }
  }
  {
    auto params = paramsBase.get_Params_KeyboardSpecialEventCallback();
    if (params && dropConsumerKey_) {
      dropKey(item);
    }
  }
  {
    auto params = paramsBase.get_Params_RelativePointerEventCallback();
    if (params && dropPointingButton_) {
      if (modifierMatched_ &&
          !(params->buttons).isNONE()) {
        item.cancel();
        return;
      }
    }
  }
}