]> git.tdb.fi Git - libs/gui.git/blobdiff - source/input/gesturedetector.cpp
Put feature control macros before any headers
[libs/gui.git] / source / input / gesturedetector.cpp
index 62ac3f050d09c9c849b7e0c6c62ecf8e3185a3bf..08232cf8f0fecf023e98fe43b452d2bf9135ee0e 100644 (file)
@@ -1,7 +1,7 @@
 #define _USE_MATH_DEFINES
+#include "gesturedetector.h"
 #include <cmath>
 #include <sigc++/bind_return.h>
-#include "gesturedetector.h"
 #include "touchscreen.h"
 
 using namespace std;
@@ -10,10 +10,8 @@ namespace Msp {
 namespace Input {
 
 GestureDetector::GestureDetector(Touchscreen &ts):
-       touchscreen(ts),
-       current_gesture(GESTURE_NONE),
-       pending_tap(GESTURE_NONE),
-       invalid_gesture(false)
+       Device(UNSPECIFIED),
+       touchscreen(ts)
 {
        name = "Gesture";
 
@@ -150,11 +148,12 @@ void GestureDetector::start_gesture()
        if(!p.down)
                return;
 
-       /* At least one point needs to have moved more than the threshold to start
-       the gesture. */
-       bool threshold_exceeded = false;
-       for(unsigned i=0; (i<MAX_POINTS && !threshold_exceeded); ++i)
-               threshold_exceeded = (points[i].down && points[i].threshold_exceeded);
+       /* All held points need to have moved more than the threshold to start the
+       gesture. */
+       bool threshold_exceeded = true;
+       for(unsigned i=0; (i<MAX_POINTS && threshold_exceeded); ++i)
+               if(points[i].down && !points[i].threshold_exceeded)
+                       threshold_exceeded = false;
        if(!threshold_exceeded)
                return;