summaryrefslogtreecommitdiff
path: root/src/multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multitouch.c')
-rw-r--r--src/multitouch.c26
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,
128 const struct State *ns) 128 const struct State *ns)
129{ 129{
130 const struct FingerState *fs, *p, *e = ns->finger + ns->nfinger; 130 const struct FingerState *fs, *p, *e = ns->finger + ns->nfinger;
131 int dx = 0, dy = 0, n = 0, i; 131 int dx = 0, dy = 0, dn = 0, n = 0, i;
132 for (p = ns->finger; p != e; p++) { 132 if (count_fingers(ns) == count_fingers(os)) {
133 if (fs = find_finger(os, p->id)) { 133 for (p = ns->finger; p != e; p++) {
134 dx += p->hw.position_x - fs->hw.position_x; 134 if (fs = find_finger(os, p->id)) {
135 dy += p->hw.position_y - fs->hw.position_y; 135 dx += p->hw.position_x - fs->hw.position_x;
136 dy += p->hw.position_y - fs->hw.position_y;
137 dn++;
138 }
136 } 139 }
137 } 140 }
138 if (dx || dy) { 141 if (dx || dy) {
142 dx /= dn;
143 dy /= dn;
139 xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy); 144 xf86PostMotionEvent(local->dev, 0, 0, 2, dx, dy);
140 xf86Msg(X_INFO, "motion: %d %d\n", dx, dy); 145 //xf86Msg(X_INFO, "motion: %d %d\n", dx, dy);
141 n++; 146 n++;
142 } 147 }
143 for (i = 0; i < DIM_BUTTON; i++) { 148 for (i = 0; i < DIM_BUTTON; i++) {
@@ -145,14 +150,13 @@ static void handle_state(LocalDevicePtr local,
145 xf86PostButtonEvent(local->dev, FALSE, 150 xf86PostButtonEvent(local->dev, FALSE,
146 i, GETBIT(ns->button, i), 151 i, GETBIT(ns->button, i),
147 0, 0); 152 0, 0);
148 xf86Msg(X_INFO, "button: %d -> %d\n", 153 //xf86Msg(X_INFO, "button: %d -> %d\n",
149 i, GETBIT(ns->button, i)); 154 //i, GETBIT(ns->button, i));
150 n++; 155 n++;
151 } 156 }
152 } 157 }
153 if (n) { 158 //if (n)
154 output_state(ns); 159 //output_state(ns);
155 }
156} 160}
157 161
158//////////////////////////////////////////////////////////////////////////// 162////////////////////////////////////////////////////////////////////////////