51 if (countOfEvents > 1) { // do we have more than one event in the stream? |
51 if (countOfEvents > 1) { // do we have more than one event in the stream? |
52 // Then look at the events to see if they are suitable for us |
52 // Then look at the events to see if they are suitable for us |
53 // should we check that all of the events are targeted to our window? |
53 // should we check that all of the events are targeted to our window? |
54 // currently we only check if the last one is for us and is EMove, then we pan if the speed is OK |
54 // currently we only check if the last one is for us and is EMove, then we pan if the speed is OK |
55 if (m_loggingenabled) { |
55 if (m_loggingenabled) { |
56 LOGARG("QStm_PanGestureRecogniser: Got: numer of events %d, event code %d", countOfEvents, eventCode); |
56 LOGARG("QStm_PanGestureRecogniser: Got: numer of events %d, event %s", countOfEvents, event_name(eventCode)); |
57 } |
57 } |
58 |
58 |
59 if (puie->target() == m_powner && |
59 if (puie->target() == m_powner && |
60 eventCode == qstmUiEventEngine::EMove) { // The last one is move in our window |
60 eventCode == qstmUiEventEngine::EMove) { // The last one is move in our window |
61 |
61 |
65 countOfEvents, eventCode, speed, puie->currentXY().x(), puie->currentXY().y(), |
65 countOfEvents, eventCode, speed, puie->currentXY().x(), puie->currentXY().y(), |
66 puie->previousXY().x(), puie->previousXY().y()); |
66 puie->previousXY().x(), puie->previousXY().y()); |
67 } |
67 } |
68 |
68 |
69 // It is pan gesture in our window, handle it, if the speed is inside limits |
69 // It is pan gesture in our window, handle it, if the speed is inside limits |
70 if (speed > m_panningspeedlow && speed < m_panningspeedhigh) { |
70 if (speed >= m_panningspeedlow && speed < m_panningspeedhigh && |
|
71 (puie->currentXY() != puie->previousXY())) { |
71 using qstmUiEventEngine::QStm_UiEventSpeed; |
72 using qstmUiEventEngine::QStm_UiEventSpeed; |
72 |
73 |
73 state = EGestureActive; |
74 state = EGestureActive; |
74 QStm_UiEventSpeed speedIf(speed, puie->speedVec()); |
75 QStm_UiEventSpeed speedIf(speed, puie->speedVec()); |
75 // Panning gesture |
76 // Panning gesture |
76 qstmGesture::QStm_DirectionalGesture pgest( |
77 qstmGesture::QStm_DirectionalGesture pgest( |
77 KUid, |
78 KUid, |
78 puie->currentXY(), |
79 puie->currentXY(), |
79 puie->previousXY(), |
80 puie->previousXY(), |
|
81 puie->timestamp(), |
80 &speedIf, |
82 &speedIf, |
81 m_loggingenabled); |
83 m_loggingenabled); |
82 pgest.setTarget(puie->target()); |
84 pgest.setTarget(puie->target()); |
83 |
85 |
84 // Call the listener to inform that a Pan has occurred... |
86 // Call the listener to inform that a Pan has occurred... |
85 m_listener->gestureEnter(pgest); |
87 m_listener->gestureEnter(pgest); |
86 } |
88 } |
87 } |
89 } |
88 else if (eventCode == qstmUiEventEngine::ERelease) { |
|
89 LOGARG("QStm_PanGestureRecogniser::recognise: (0x%x) eventCode == ERelease", this); |
|
90 } |
90 } |
91 } |
91 } |
92 } |
|
93 m_state = state; |
92 m_state = state; |
94 return state; |
93 return state; |
95 } |
94 } |
96 |
95 |
97 void QStm_PanGestureRecogniser::release(QStm_GestureEngineIf* pge) |
96 void QStm_PanGestureRecogniser::release(QStm_GestureEngineIf* pge) |
104 QStm_UiEventSpeed speedIf(puie->speed(), puie->speedVec()); |
103 QStm_UiEventSpeed speedIf(puie->speed(), puie->speedVec()); |
105 qstmGesture::QStm_DirectionalGesture pgest( |
104 qstmGesture::QStm_DirectionalGesture pgest( |
106 KUid, |
105 KUid, |
107 puie->currentXY(), |
106 puie->currentXY(), |
108 puie->previousXY(), |
107 puie->previousXY(), |
|
108 puie->timestamp(), |
109 &speedIf, |
109 &speedIf, |
110 m_loggingenabled); |
110 m_loggingenabled); |
111 pgest.setTarget(puie->target()); |
111 pgest.setTarget(puie->target()); |
112 m_listener->gestureExit(pgest) ; |
112 m_listener->gestureExit(pgest) ; |
113 m_state = ENotMyGesture; |
113 m_state = ENotMyGesture; |