qstmgesturelib/qstmgestureengine.cpp
changeset 16 3c88a81ff781
parent 3 0954f5dd2cd0
equal deleted inserted replaced
14:6aeb7a756187 16:3c88a81ff781
   127     return m_numOfActiveStreams ;
   127     return m_numOfActiveStreams ;
   128 }
   128 }
   129 
   129 
   130 const qstmUiEventEngine::QStm_UiEventIf* QStm_GestureEngine::getUiEvents(int indexOfActiveStream) const
   130 const qstmUiEventEngine::QStm_UiEventIf* QStm_GestureEngine::getUiEvents(int indexOfActiveStream) const
   131 {
   131 {
   132 //#if defined(ADVANCED_POINTER_EVENTS)
   132 #if defined(ADVANCED_POINTER_EVENTS)
   133     // create temporary array of active event streams and initialize with zero
   133     // create temporary array of active event streams and initialize with zero
   134     const qstmUiEventEngine::QStm_UiEventIf* activeEventPointers[qstmUiEventEngine::KMaxNumberOfPointers] ;
   134     const qstmUiEventEngine::QStm_UiEventIf* activeEventPointers[qstmUiEventEngine::KMaxNumberOfPointers] ;
   135     for (int x = 0; x < qstmUiEventEngine::KMaxNumberOfPointers; activeEventPointers[x++] = 0);
   135     for (int x = 0; x < qstmUiEventEngine::KMaxNumberOfPointers; activeEventPointers[x++] = 0);
   136     
   136     
   137     // then fill from currently active event streams
   137     // then fill from currently active event streams
   141             activeEventPointers[indextoactiveEventPointers++] = m_uiEventStream[i] ;
   141             activeEventPointers[indextoactiveEventPointers++] = m_uiEventStream[i] ;
   142         }
   142         }
   143     }
   143     }
   144     // then return the active event stream asked
   144     // then return the active event stream asked
   145     return activeEventPointers[indexOfActiveStream] ;
   145     return activeEventPointers[indexOfActiveStream] ;
   146 //#else
   146 #else
   147     // in single touch it is enough to return the only possible pointer
   147     // in single touch it is enough to return the only possible pointer
   148 //    return m_uiEventStream[indexOfActiveStream] ;
   148     return m_uiEventStream[indexOfActiveStream] ;
   149 //#endif
   149 #endif
   150 }
   150 }
   151 
   151 
   152 /*!
   152 /*!
   153  * Process the UI events
   153  * Process the UI events
   154  */
   154  */
   192 /*!
   192 /*!
   193  *  Call each gesture handler in turn until one claims to be in control of the gesture.
   193  *  Call each gesture handler in turn until one claims to be in control of the gesture.
   194  */
   194  */
   195 void QStm_GestureEngine::walkTroughGestures()
   195 void QStm_GestureEngine::walkTroughGestures()
   196 {
   196 {
       
   197     if (m_loggingEnabled) {
       
   198         LOGTXT("\n======= walkTroughGestures: start ===================\n");
       
   199     }
       
   200     bool uknownGestureEnabled = false;
       
   201     QStm_GestureRecogniserIf* uknownGesture = gestureAt(gestureCount() - 1);
       
   202     if (uknownGesture->gestureUid() == EGestureUidUnknown) {
       
   203         uknownGestureEnabled = uknownGesture->isEnabled();
       
   204     }
       
   205 
   197     int newowner = -1 ;
   206     int newowner = -1 ;
   198     int newlocker =  -1; //m_currentLockedGesture ;
   207     int newlocker =  -1; //m_currentLockedGesture ;
   199     // check if someone has locked the gesture
   208     // check if someone has locked the gesture
   200     QStm_GestureRecognitionState thestate = ENotMyGesture ;
   209     QStm_GestureRecognitionState thestate = ENotMyGesture ;
   201     if (m_currentLockedGesture != -1) {
   210     if (m_currentLockedGesture != -1) {
   283 					case ENotMyGesture:
   292 					case ENotMyGesture:
   284 					{
   293 					{
   285 						break;
   294 						break;
   286 					}
   295 					}
   287                 }
   296                 }
       
   297                 if (m_loggingEnabled) {
   288                 LOGARG("walkTroughGestures: 0x%x, recognizers count %d, newowner %d, m_currentGestureOwner %d", 
   298                 LOGARG("walkTroughGestures: 0x%x, recognizers count %d, newowner %d, m_currentGestureOwner %d", 
   289                 		pgrif, gcount, newowner, m_currentGestureOwner);
   299                 		pgrif, gcount, newowner, m_currentGestureOwner);
       
   300             }
   290             }
   301             }
   291             if (controlObtained)  {
   302             if (controlObtained)  {
   292                 break; // do not process rest of the gestures
   303                 break; // do not process rest of the gestures
   293             }
   304             }
   294 
   305 
   304             }
   315             }
   305         }
   316         }
   306         m_currentGestureOwner = newowner ;
   317         m_currentGestureOwner = newowner ;
   307     }
   318     }
   308     m_currentLockedGesture = newlocker ;    // if someone locked it or released the lock
   319     m_currentLockedGesture = newlocker ;    // if someone locked it or released the lock
       
   320     // some recognizers might turn it off - restore it.
       
   321     uknownGesture->enable(uknownGestureEnabled);
       
   322     
       
   323     if (m_loggingEnabled) {
       
   324         LOGTXT("\n=================== walkTroughGestures: end =========================\n");
       
   325     }
   309 }
   326 }
   310 
   327 
   311 void QStm_GestureEngine::updateUiEvents()
   328 void QStm_GestureEngine::updateUiEvents()
   312 {
   329 {
   313     for (int i = 0; i < qstmUiEventEngine::KMaxNumberOfPointers; i++) {
   330     for (int i = 0; i < qstmUiEventEngine::KMaxNumberOfPointers; i++) {