From c1131a0c9c628976d35bf6669e4d7aff7ac78988 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Nov 2008 22:19:50 +0100 Subject: matching stable! however, now crashes X occasionally... stream overload? Signed-off-by: Henrik Rydberg --- src/multitouch.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/multitouch.c') 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); } //////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3