Ejemplo n.º 1
0
void EventDispatcher::touchEvent(uint64_t pageID, const WebKit::WebTouchEvent& touchEvent)
{
    bool updateListWasEmpty;
    {
        LockHolder locker(&m_touchEventsLock);
        updateListWasEmpty = m_touchEvents.isEmpty();
        auto addResult = m_touchEvents.add(pageID, TouchEventQueue());
        if (addResult.isNewEntry)
            addResult.iterator->value.append(touchEvent);
        else {
            TouchEventQueue& queuedEvents = addResult.iterator->value;
            ASSERT(!queuedEvents.isEmpty());
            const WebTouchEvent& lastTouchEvent = queuedEvents.last();

            // Coalesce touch move events.
            WebEvent::Type type = lastTouchEvent.type();
            if (type == WebEvent::TouchMove)
                queuedEvents.last() = touchEvent;
            else
                queuedEvents.append(touchEvent);
        }
    }

    if (updateListWasEmpty) {
        RefPtr<EventDispatcher> eventDispatcher(this);
        RunLoop::main().dispatch([eventDispatcher] {
            eventDispatcher->dispatchTouchEvents();
        });
    }
}
void DialingSipConnectionState::handleStateEntry(StateEnum previousState, const StateTransitionMemory* pTransitionMemory)
{
   StateTransitionEventDispatcher eventDispatcher(m_rSipConnectionEventSink, pTransitionMemory);
   eventDispatcher.dispatchEvent(getCurrentState());

   notifyConnectionStateObservers();

   OsSysLog::add(FAC_CP, PRI_DEBUG, "Entry dialing connection state from state: %d, sip call-id: %s\r\n",
      (int)previousState, getCallId().data());
}
Ejemplo n.º 3
0
bool WorkerEventQueue::enqueueEvent(Ref<Event>&& event)
{
    if (m_isClosed)
        return false;

    EventDispatcher* eventDispatcherPtr = new EventDispatcher(event.copyRef(), *this);
    m_eventDispatcherMap.add(event.ptr(), eventDispatcherPtr);
    m_scriptExecutionContext.postTask([eventDispatcherPtr] (ScriptExecutionContext&) {
        std::unique_ptr<EventDispatcher> eventDispatcher(eventDispatcherPtr);
        eventDispatcher->dispatch();
    });

    return true;
}
Ejemplo n.º 4
0
    void AbstractScene::removeEventObservers(void* key)
    {
        auto& map = eventObserverMap();
        auto& dispatcher = eventDispatcher();

        auto it = map.find(key);
        if (it == map.end())
            return;

        EventObserverList observers = std::move(it->second);
        map.erase(it);

        for (const auto& observer : observers)
            dispatcher.removeObserver(observer.first, observer.second.get());
    }
Ejemplo n.º 5
0
void QXlibScreen::eventDispatcher()
{
        ulong marker = XNextRequest(mDisplay->nativeDisplay());
    //    int i = 0;
        while (XPending(mDisplay->nativeDisplay())) {
            XEvent event;
            XNextEvent(mDisplay->nativeDisplay(), &event);
            /* done = */
            handleEvent(&event);

            if (event.xany.serial >= marker) {
    #ifdef MYX11_DEBUG
                qDebug() << "potential livelock averted";
    #endif
    #if 0
                if (XEventsQueued(mDisplay->nativeDisplay(), QueuedAfterFlush)) {
                    qDebug() << "	with events queued";
                    QTimer::singleShot(0, this, SLOT(eventDispatcher()));
                }
    #endif
                break;
            }
        }
}
Ejemplo n.º 6
0
void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent, bool canRubberBandAtLeft, bool canRubberBandAtRight, bool canRubberBandAtTop, bool canRubberBandAtBottom)
{
    PlatformWheelEvent platformWheelEvent = platform(wheelEvent);

#if PLATFORM(COCOA)
    switch (wheelEvent.phase()) {
    case PlatformWheelEventPhaseBegan:
        m_recentWheelEventDeltaTracker->beginTrackingDeltas();
        break;
    case PlatformWheelEventPhaseEnded:
        m_recentWheelEventDeltaTracker->endTrackingDeltas();
        break;
    default:
        break;
    }

    if (m_recentWheelEventDeltaTracker->isTrackingDeltas()) {
        m_recentWheelEventDeltaTracker->recordWheelEventDelta(platformWheelEvent);

        DominantScrollGestureDirection dominantDirection = DominantScrollGestureDirection::None;
        dominantDirection = m_recentWheelEventDeltaTracker->dominantScrollGestureDirection();

        // Workaround for scrolling issues <rdar://problem/14758615>.
        if (dominantDirection == DominantScrollGestureDirection::Vertical && platformWheelEvent.deltaX())
            platformWheelEvent = platformWheelEvent.copyIgnoringHorizontalDelta();
        else if (dominantDirection == DominantScrollGestureDirection::Horizontal && platformWheelEvent.deltaY())
            platformWheelEvent = platformWheelEvent.copyIgnoringVerticalDelta();
    }
#endif

#if ENABLE(ASYNC_SCROLLING)
    MutexLocker locker(m_scrollingTreesMutex);
    if (RefPtr<ThreadedScrollingTree> scrollingTree = m_scrollingTrees.get(pageID)) {
        // FIXME: It's pretty horrible that we're updating the back/forward state here.
        // WebCore should always know the current state and know when it changes so the
        // scrolling tree can be notified.
        // We only need to do this at the beginning of the gesture.
        if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan) {
            ScrollingThread::dispatch([scrollingTree, canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom] {
                scrollingTree->setCanRubberBandState(canRubberBandAtLeft, canRubberBandAtRight, canRubberBandAtTop, canRubberBandAtBottom);
            });
        }

        ScrollingTree::EventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent);

#if ENABLE(CSS_SCROLL_SNAP) || ENABLE(RUBBER_BANDING)
        if (result == ScrollingTree::DidHandleEvent)
            updateWheelEventTestTriggersIfNeeded(pageID);
#endif

        if (result == ScrollingTree::DidHandleEvent || result == ScrollingTree::DidNotHandleEvent) {
            sendDidReceiveEvent(pageID, wheelEvent, result == ScrollingTree::DidHandleEvent);
            return;
        }
    }
#else
    UNUSED_PARAM(canRubberBandAtLeft);
    UNUSED_PARAM(canRubberBandAtRight);
    UNUSED_PARAM(canRubberBandAtTop);
    UNUSED_PARAM(canRubberBandAtBottom);
#endif

    RefPtr<EventDispatcher> eventDispatcher(this);
    RunLoop::main().dispatch([eventDispatcher, pageID, wheelEvent] {
        eventDispatcher->dispatchWheelEvent(pageID, wheelEvent);
    }); 
}
Ejemplo n.º 7
0
 void AbstractScene::onEvent(const IEvent* event)
 {
     eventDispatcher().sendEvent(event);
 }