Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/evdev-mt-touchpad-gestures.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 8fe0bb8..dc8d606 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -49,15 +49,19 @@ static struct normalized_coords
 tp_get_touches_delta(struct tp_dispatch *tp, bool average)
 {
        struct tp_touch *t;
-       unsigned int i, nchanged = 0;
+       unsigned int i, nactive = 0;
        struct normalized_coords normalized;
        struct normalized_coords delta = {0.0, 0.0};
 
        for (i = 0; i < tp->num_slots; i++) {
                t = &tp->touches[i];
 
-               if (tp_touch_active(tp, t) && t->dirty) {
-                       nchanged++;
+               if (!tp_touch_active(tp, t))
+                       continue;
+
+               nactive++;
+
+               if (t->dirty) {
                        normalized = tp_get_delta(t);
 
                        delta.x += normalized.x;
@@ -65,11 +69,11 @@ tp_get_touches_delta(struct tp_dispatch *tp, bool average)
                }
        }
 
-       if (!average || nchanged == 0)
+       if (!average || nactive == 0)
                return delta;
 
-       delta.x /= nchanged;
-       delta.y /= nchanged;
+       delta.x /= nactive;
+       delta.y /= nactive;
 
        return delta;
 }
-- 
2.5.0

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to