summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/multitouch.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/multitouch.c b/src/multitouch.c
index 012476d..ebc0033 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -180,6 +180,22 @@ static void tickle_button(LocalDevicePtr local, int id)
180 xf86PostButtonEvent(local->dev, FALSE, id, 0, 0, 0); 180 xf86PostButtonEvent(local->dev, FALSE, id, 0, 0, 0);
181} 181}
182 182
183static void button_scroll(LocalDevicePtr local,
184 int btdec, int btinc,
185 int *scroll, int step,
186 int delta)
187{
188 *scroll += delta;
189 while (*scroll > step) {
190 tickle_button(local, btinc);
191 *scroll -= step;
192 }
193 while (*scroll < -step) {
194 tickle_button(local, btdec);
195 *scroll += step;
196 }
197}
198
183static void handle_gestures(LocalDevicePtr local, 199static void handle_gestures(LocalDevicePtr local,
184 const struct Gestures *gs, 200 const struct Gestures *gs,
185 const struct Capabilities *caps) 201 const struct Capabilities *caps)
@@ -201,27 +217,11 @@ static void handle_gestures(LocalDevicePtr local,
201 TRACE2("motion: %d %d\n", gs->dx, gs->dy); 217 TRACE2("motion: %d %d\n", gs->dx, gs->dy);
202 } 218 }
203 if (GETBIT(gs->type, GS_VSCROLL)) { 219 if (GETBIT(gs->type, GS_VSCROLL)) {
204 vscroll += gs->dy; 220 button_scroll(local, 4, 5, &vscroll, vstep, gs->dy);
205 while (vscroll > vstep) {
206 tickle_button(local, 5);
207 vscroll -= vstep;
208 }
209 while (vscroll < -vstep) {
210 tickle_button(local, 4);
211 vscroll += vstep;
212 }
213 TRACE1("vscroll: %d\n", gs->dy); 221 TRACE1("vscroll: %d\n", gs->dy);
214 } 222 }
215 if (GETBIT(gs->type, GS_HSCROLL)) { 223 if (GETBIT(gs->type, GS_HSCROLL)) {
216 hscroll += gs->dx; 224 button_scroll(local, 6, 7, &hscroll, hstep, gs->dx);
217 while (hscroll > hstep) {
218 tickle_button(local, 7);
219 hscroll -= hstep;
220 }
221 while (hscroll < -hstep) {
222 tickle_button(local, 6);
223 hscroll += hstep;
224 }
225 TRACE1("hscroll: %d\n", gs->dx); 225 TRACE1("hscroll: %d\n", gs->dx);
226 } 226 }
227} 227}