From 809b43cb3bac52ad87228a458dcd3dbf11180c97 Mon Sep 17 00:00:00 2001 From: Henrik Rydberg Date: Sat, 8 Nov 2008 16:01:51 +0100 Subject: cleanup Signed-off-by: Henrik Rydberg --- src/multitouch.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/multitouch.c') diff --git a/src/multitouch.c b/src/multitouch.c index 987cf34..a16d1b1 100644 --- a/src/multitouch.c +++ b/src/multitouch.c @@ -128,7 +128,7 @@ 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, i; + 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; @@ -136,15 +136,23 @@ static void handle_state(LocalDevicePtr local, } } if (dx || dy) { - output_state(ns); - xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy); + xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); + n++; } - for (i = 0; i < DIM_BUTTON; i++) - if (ns->button[i] != os->button[i]) + for (i = 0; i < DIM_BUTTON; i++) { + if (GETBIT(ns->button, i) != GETBIT(os->button, i)) { xf86PostButtonEvent(local->dev, FALSE, - i + 1, ns->button[i], + i, GETBIT(ns->button, i), 0, 0); + xf86Msg(X_INFO, "button: %d -> %d\n", + i, GETBIT(ns->button, i)); + n++; + } + } + if (n) { + output_state(ns); + } } //////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3