void QQuickDragAttachedPrivate::deliverLeaveEvent() { if (window) { QDragLeaveEvent event; deliverEvent(window, &event); window = 0; } }
// Deliver CPG message. void Cluster::deliver( cpg_handle_t /*handle*/, const cpg_name* /*group*/, uint32_t nodeid, uint32_t pid, void* msg, int msg_len) { MemberId from(nodeid, pid); framing::Buffer buf(static_cast<char*>(msg), msg_len); Event e(Event::decodeCopy(from, buf)); deliverEvent(e); }
void TransformReactor::process(const EventPtr& e) { EventPtr new_e; // Create new event; either same type (if UNDEFINED) or defined type m_event_factory.create(new_e, m_event_type == Vocabulary::UNDEFINED_TERM_REF ? e->getType() : m_event_type); // Copy terms over from original switch (m_copy_original) { case COPY_ALL: // Copy all terms over from original event *new_e += *e; break; case COPY_UNCHANGED: // Copy ONLY terms, that are not defined in transformations... *new_e += *e; // First copy all terms... // Then remove all the ones with transformations... for (TransformChain::iterator i = m_transforms.begin(); i != m_transforms.end(); i++) (*i)->removeTerm(new_e); // TODO: Which is more efficient? Only copying the ones that are not transformed, or this? break; case COPY_NONE: // Do not copy terms from original event break; } try { for (TransformChain::iterator i = m_transforms.begin(); i != m_transforms.end(); i++) (*i)->transform(new_e, e); // transform d <- s } catch (std::exception& e) { // Likely Boost.regex throw PION_LOG_ERROR(m_logger, "reactor_id: " << getId() << " - " << e.what() << " - handled"); } deliverEvent(new_e); // Deliver the modified event // Transformation is done, deliver original event? if (m_deliver_original != DO_NEVER) deliverEvent(e); }
void QQuickDragAttachedPrivate::deliverMoveEvent() { Q_Q(QQuickDragAttached); itemMoved = false; if (window) { QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint(); QDragMoveEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier); QQuickDropEventEx::setProposedAction(&event, proposedAction); deliverEvent(window, &event); if (target != dragGrabber.target()) { target = dragGrabber.target(); emit q->targetChanged(); } } }
void FissionReactor::process(const EventPtr& e) { if (e->getType() == m_input_event_type.term_ref) { // used for generating new events EventFactory event_factory; EventPtr new_ptr; bool read_result; // iterate through each value defined for the input event term Event::ValuesRange range = e->equal_range(m_input_event_term.term_ref); for (Event::ConstIterator it = range.first; it != range.second; ++it) { // create an input stream based upon the term value const Event::BlobType& ss = boost::get<const Event::BlobType&>(it->value); boost::iostreams::stream<boost::iostreams::array_source> input_stream(ss.get(), ss.size()); // read Event(s) from the input stream while ( isRunning() && !input_stream.eof() ) { // only allow one thread to use the codec at a time boost::mutex::scoped_lock codec_lock(m_codec_mutex); event_factory.create(new_ptr, m_codec_ptr->getEventType()); read_result = m_codec_ptr->read(input_stream, *new_ptr); codec_lock.unlock(); if (! read_result) break; // copy terms from original event ? if (m_copy_all_terms) { // copy all terms from original event *new_ptr += *e; } else if (! m_copy_terms.empty() ) { // copy some terms from original event for (TermVector::const_iterator term_it = m_copy_terms.begin(); term_it != m_copy_terms.end(); ++term_it) { new_ptr->copyValues(*e, term_it->term_ref); } } // deliver the event deliverEvent(new_ptr); } } } }
void QQuickDragAttachedPrivate::deliverEnterEvent() { dragRestarted = false; itemMoved = false; window = attachedItem->window(); mimeData->m_source = source; if (!overrideActions) mimeData->m_supportedActions = supportedActions; mimeData->m_keys = keys; if (window) { QPoint scenePos = attachedItem->mapToScene(hotSpot).toPoint(); QDragEnterEvent event(scenePos, mimeData->m_supportedActions, mimeData, Qt::NoButton, Qt::NoModifier); QQuickDropEventEx::setProposedAction(&event, proposedAction); deliverEvent(window, &event); } }
// CPG config-change callback. void Cluster::configChange ( cpg_handle_t /*handle*/, const cpg_name */*group*/, const cpg_address *members, int nMembers, const cpg_address *left, int nLeft, const cpg_address *joined, int nJoined) { Mutex::ScopedLock l(lock); string membersStr, leftStr, joinedStr; // Encode members and enqueue as an event so the config change can // be executed in the correct thread. for (const cpg_address* p = members; p < members+nMembers; ++p) membersStr.append(MemberId(*p).str()); for (const cpg_address* p = left; p < left+nLeft; ++p) leftStr.append(MemberId(*p).str()); for (const cpg_address* p = joined; p < joined+nJoined; ++p) joinedStr.append(MemberId(*p).str()); deliverEvent(Event::control(ClusterConfigChangeBody( ProtocolVersion(), membersStr, leftStr, joinedStr), self)); }
void FilterReactor::process(const EventPtr& e) { if ( m_rules(e) ) deliverEvent(e); }