Exemple #1
0
void DropAllKeys::dropKey(EventOutputQueue::Item& item) {
  bool iskeydown = false;
  if (item.getParamsBase().iskeydown(iskeydown)) {
    if (iskeydown) {
      if (modifierMatched_) {
        dropped_.push_back(new Item(item.getParamsBase()));
        item.cancel();
      }
    } else {
      bool found = false;
      Item* p = static_cast<Item*>(dropped_.safe_front());
      while (p) {
        if ((p->fromEvent).isTargetEvent(item.getParamsBase())) {
          found = true;
          p = static_cast<Item*>(dropped_.erase_and_delete(p));
        } else {
          p = static_cast<Item*>(p->getnext());
        }
      }
      if (found) {
        item.cancel();
      }
    }
  }
}
Exemple #2
0
void DropAllKeys::cancelEventOutputQueueItems(EventOutputQueue::Item& item) {
  if (!doCancel_) {
    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;
      }
    }
  }
}
Exemple #3
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;
}