qstmgesturelib/recognisers/qstmlongpressgesturerecogniser.cpp
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
    49     if (numOfActiveStreams == 1) {
    49     if (numOfActiveStreams == 1) {
    50         // Then look at the event stream, it has to be EHold
    50         // Then look at the event stream, it has to be EHold
    51         const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
    51         const qstmUiEventEngine::QStm_UiEventIf* puie = pge->getUiEvents(0);
    52         int countOfEvents = puie->countOfEvents();
    52         int countOfEvents = puie->countOfEvents();
    53         qstmUiEventEngine::QStm_UiEventCode eventCode = puie->code();
    53         qstmUiEventEngine::QStm_UiEventCode eventCode = puie->code();
    54 
    54         const qstmUiEventEngine::QStm_UiEventIf* puieprev = puie->previousEvent() ;
       
    55         
    55         if (m_loggingenabled) {
    56         if (m_loggingenabled) {
    56             LOGARG("QStm_LongPressGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
    57             LOGARG("QStm_LongPressGestureRecogniser: %d num %d code %d", eventCode, countOfEvents, eventCode);
    57         }
    58         }
    58         if (puie->target() == m_powner && eventCode == qstmUiEventEngine::EHold) { 
    59         
       
    60         bool dontIgnore = (puieprev == NULL) || (puieprev->code() != qstmUiEventEngine::EMove);
       
    61         if (puie->target() == m_powner && eventCode == qstmUiEventEngine::EHold && dontIgnore) {
    59         	// The last one is EHold, look if it is near our borders
    62         	// The last one is EHold, look if it is near our borders
    60             const QPoint& p = puie->currentXY() ;
    63             const QPoint& p = puie->currentXY() ;
    61             if (m_loggingenabled) {
    64             if (m_loggingenabled) {
    62                 LOGARG("QStm_LongPressGestureRecogniser: (%d, %d) in (%d,%d)(%d,%d)", p.x(), p.y(),
    65                 LOGARG("QStm_LongPressGestureRecogniser: (%d, %d) in (%d,%d)(%d,%d)", p.x(), p.y(),
    63                         m_area.x(), m_area.y(), m_area.x() + m_area.width(), m_area.y() + m_area.height());
    66                         m_area.x(), m_area.y(), m_area.x() + m_area.width(), m_area.y() + m_area.height());
    64             }
    67             }
    65             // check where the point is inside the area defined
    68             // check where the point is inside the area defined
    66             if (m_area.contains(p)) {
    69             if (m_area.contains(p)) {
    67                 state = EGestureActive ;
    70                 state = EGestureActive ;
    68                 // issue the long press gesture
    71                 // issue the long press gesture
    69                 qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, 0, puie) ; // TODO: speed is 0?
    72                 qstmGesture::QStm_GenericSimpleGesture pgest(KUid, p, puie->timestamp(), 0, puie) ; // TODO: speed is 0?
    70                 pgest.setTarget(puie->target());
    73                 pgest.setTarget(puie->target());
    71                 // Call the listener to inform that the gesture has occurred...
    74                 // Call the listener to inform that the gesture has occurred...
    72                 m_listener->gestureEnter(pgest) ;
    75                 m_listener->gestureEnter(pgest) ;
    73             }
    76             }
    74         }
    77         }