diff options
Diffstat (limited to 'src/multitouch.c')
-rw-r--r-- | src/multitouch.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/multitouch.c b/src/multitouch.c index a16d1b1..0ef808e 100644 --- a/src/multitouch.c +++ b/src/multitouch.c @@ -128,16 +128,21 @@ static void handle_state(LocalDevicePtr local, const struct State *ns) { const struct FingerState *fs, *p, *e = ns->finger + ns->nfinger; - int dx = 0, dy = 0, n = 0, i; - for (p = ns->finger; p != e; p++) { - if (fs = find_finger(os, p->id)) { - dx += p->hw.position_x - fs->hw.position_x; - dy += p->hw.position_y - fs->hw.position_y; + int dx = 0, dy = 0, dn = 0, n = 0, i; + if (count_fingers(ns) == count_fingers(os)) { + for (p = ns->finger; p != e; p++) { + if (fs = find_finger(os, p->id)) { + dx += p->hw.position_x - fs->hw.position_x; + dy += p->hw.position_y - fs->hw.position_y; + dn++; + } } } if (dx || dy) { + dx /= dn; + dy /= dn; xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy); - xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); + //xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); n++; } for (i = 0; i < DIM_BUTTON; i++) { @@ -145,14 +150,13 @@ static void handle_state(LocalDevicePtr local, xf86PostButtonEvent(local->dev, FALSE, i, GETBIT(ns->button, i), 0, 0); - xf86Msg(X_INFO, "button: %d -> %d\n", - i, GETBIT(ns->button, i)); + //xf86Msg(X_INFO, "button: %d -> %d\n", + //i, GETBIT(ns->button, i)); n++; } } - if (n) { - output_state(ns); - } + //if (n) + //output_state(ns); } //////////////////////////////////////////////////////////////////////////// |