summaryrefslogtreecommitdiff
path: root/src/multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multitouch.c')
-rw-r--r--src/multitouch.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/multitouch.c b/src/multitouch.c
index f0e572d..cc57cad 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -28,7 +28,9 @@
28 28
29/* these should be user-configurable at some point */ 29/* these should be user-configurable at some point */
30static const float vscroll_fraction = 0.05; 30static const float vscroll_fraction = 0.05;
31static const float hscroll_fraction = 0.2; 31static const float hscroll_fraction = 0.05;
32static const float vswipe_fraction = 0.25;
33static const float hswipe_fraction = 0.25;
32 34
33/* flip these to enable event debugging */ 35/* flip these to enable event debugging */
34#if 1 36#if 1
@@ -207,9 +209,11 @@ static void handle_gestures(LocalDevicePtr local,
207 const struct Gestures *gs, 209 const struct Gestures *gs,
208 const struct Capabilities *caps) 210 const struct Capabilities *caps)
209{ 211{
210 static int vscroll, hscroll; 212 static int vscroll, hscroll, vswipe, hswipe;
211 int vstep = 1 + vscroll_fraction * get_cap_ysize(caps); 213 int vscrollstep = 1 + vscroll_fraction * get_cap_ysize(caps);
212 int hstep = 1 + hscroll_fraction * get_cap_xsize(caps); 214 int hscrollstep = 1 + hscroll_fraction * get_cap_xsize(caps);
215 int vswipestep = 1 + vswipe_fraction * get_cap_ysize(caps);
216 int hswipestep = 1 + hswipe_fraction * get_cap_xsize(caps);
213 int i; 217 int i;
214 for (i = 0; i < DIM_BUTTON; i++) { 218 for (i = 0; i < DIM_BUTTON; i++) {
215 if (GETBIT(gs->btmask, i)) { 219 if (GETBIT(gs->btmask, i)) {
@@ -224,13 +228,21 @@ static void handle_gestures(LocalDevicePtr local,
224 TRACE2("motion: %d %d\n", gs->dx, gs->dy); 228 TRACE2("motion: %d %d\n", gs->dx, gs->dy);
225 } 229 }
226 if (GETBIT(gs->type, GS_VSCROLL)) { 230 if (GETBIT(gs->type, GS_VSCROLL)) {
227 button_scroll(local, 4, 5, &vscroll, vstep, gs->dy); 231 button_scroll(local, 4, 5, &vscroll, vscrollstep, gs->dy);
228 TRACE1("vscroll: %d\n", gs->dy); 232 TRACE1("vscroll: %d\n", gs->dy);
229 } 233 }
230 if (GETBIT(gs->type, GS_HSCROLL)) { 234 if (GETBIT(gs->type, GS_HSCROLL)) {
231 button_scroll(local, 6, 7, &hscroll, hstep, gs->dx); 235 button_scroll(local, 6, 7, &hscroll, hscrollstep, gs->dx);
232 TRACE1("hscroll: %d\n", gs->dx); 236 TRACE1("hscroll: %d\n", gs->dx);
233 } 237 }
238 if (GETBIT(gs->type, GS_VSWIPE)) {
239 button_scroll(local, 8, 9, &vswipe, vswipestep, gs->dy);
240 TRACE1("vswipe: %d\n", gs->dy);
241 }
242 if (GETBIT(gs->type, GS_HSWIPE)) {
243 button_scroll(local, 10, 11, &hswipe, hswipestep, gs->dx);
244 TRACE1("hswipe: %d\n", gs->dx);
245 }
234} 246}
235 247
236/* called for each full received packet from the touchpad */ 248/* called for each full received packet from the touchpad */