| 139 | } |
| 140 | |
| 141 | mousecmd::mousecmd CGestureClick::ProcessMotion (int dxPix, int dyPix, unsigned int xCurr, unsigned int yCurr) |
| 142 | { |
| 143 | if (!m_enabled) return mousecmd::CMD_NO_CLICK; |
| 144 | |
| 145 | mousecmd::mousecmd retval= mousecmd::CMD_NO_CLICK; |
| 146 | |
| 147 | // Do move. |
| 148 | float despl= sqrtf ((float) (dxPix*dxPix + dyPix*dyPix)); |
| 149 | |
| 150 | // Gesture click |
| 151 | switch (m_state) { |
| 152 | case DWELL_TIME: |
| 153 | // This state waits until the dwell time has expired |
| 154 | if (despl> m_dwellToleranceArea) { |
| 155 | // Pointer moving. Reset countdown and remove |
| 156 | // visual alerts |
| 157 | if (m_visualAlertsEnabled) m_progressVisualAlert.End(); |
| 158 | m_dwellCountdown.Reset(); |
| 159 | } |
| 160 | else { |
| 161 | // Pointer stopped |
| 162 | if (m_dwellCountdown.HasExpired()) { |
| 163 | if (m_visualAlertsEnabled) m_progressVisualAlert.End(); |
| 164 | |
| 165 | m_dwellCountdown.Reset(); |
| 166 | m_xIniGesture = xCurr; |
| 167 | m_yIniGesture = yCurr; |
| 168 | m_state = COMPUTE_DIRECTION; |
| 169 | } |
| 170 | else if (m_visualAlertsEnabled) |
| 171 | m_progressVisualAlert.Update |
| 172 | (xCurr, yCurr, m_dwellCountdown.PercentagePassed()); |
| 173 | } |
| 174 | break; |
| 175 | case COMPUTE_DIRECTION: |
| 176 | if (despl> m_dwellToleranceArea) { |
| 177 | // Pointer moving |
| 178 | if (m_visualAlertsEnabled) { |
| 179 | m_progressVisualAlert.End(); |
| 180 | m_gestureVisualAlert.Update(xCurr, yCurr); |
| 181 | } |
| 182 | if (!m_fastGestureAction) m_dwellCountdown.Reset(); |
| 183 | } |
| 184 | else { |
| 185 | // Pointer static |
| 186 | if (m_dwellCountdown.HasExpired()) { |
| 187 | // Countdown expired |
| 188 | |
| 189 | // Remove visual alerts |
| 190 | if (m_visualAlertsEnabled) { |
| 191 | m_gestureVisualAlert.End(); |
| 192 | m_progressVisualAlert.End(); |
| 193 | } |
| 194 | |
| 195 | // Compute motion from iniGesture point |
| 196 | int dxPixels= xCurr - m_xIniGesture; |
| 197 | int dyPixels= yCurr - m_yIniGesture; |
| 198 |
nothing calls this directly
no test coverage detected