summaryrefslogtreecommitdiff
path: root/src/multitouch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/multitouch.c')
-rw-r--r--src/multitouch.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/multitouch.c b/src/multitouch.c
index e2309bd..233f6a3 100644
--- a/src/multitouch.c
+++ b/src/multitouch.c
@@ -26,6 +26,11 @@
26#include <xserver-properties.h> 26#include <xserver-properties.h>
27#endif 27#endif
28 28
29////////////////////////////////////////////////////////////////////////////
30
31// these should be user-configurable at some point
32static const float vscroll_fraction = 0.05;
33static const float hscroll_fraction = 0.2;
29 34
30//////////////////////////////////////////////////////////////////////////// 35////////////////////////////////////////////////////////////////////////////
31 36
@@ -92,7 +97,7 @@ static void InitButtonLabels(Atom *labels, int nlabels)
92static int device_init(DeviceIntPtr dev, LocalDevicePtr local) 97static int device_init(DeviceIntPtr dev, LocalDevicePtr local)
93{ 98{
94 struct MTouch *mt = local->private; 99 struct MTouch *mt = local->private;
95 unsigned char btmap[DIM_BUTTON + 1]={0,1,2,3}; 100 unsigned char btmap[DIM_BUTTON + 1]={0,1,2,3,4,5,6,7};
96#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 101#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
97 Atom btn_labels[SYN_MAX_BUTTONS] = { 0 }; 102 Atom btn_labels[SYN_MAX_BUTTONS] = { 0 };
98 Atom axes_labels[2] = { 0 }; 103 Atom axes_labels[2] = { 0 };
@@ -211,6 +216,12 @@ static void handle_gestures(LocalDevicePtr local,
211 const struct Capabilities *caps) 216 const struct Capabilities *caps)
212{ 217{
213 static int vscroll, hscroll; 218 static int vscroll, hscroll;
219 int vstep = 1 +
220 vscroll_fraction * (caps->abs_position_y.maximum -
221 caps->abs_position_y.minimum);
222 int hstep = 1 +
223 hscroll_fraction * (caps->abs_position_x.maximum -
224 caps->abs_position_x.minimum);
214 int i; 225 int i;
215 for (i = 0; i < gs->nbt; i++) { 226 for (i = 0; i < gs->nbt; i++) {
216 xf86PostButtonEvent(local->dev, FALSE, 227 xf86PostButtonEvent(local->dev, FALSE,
@@ -224,8 +235,6 @@ static void handle_gestures(LocalDevicePtr local,
224 xf86Msg(X_INFO, "motion: %d %d\n", gs->dx, gs->dy); 235 xf86Msg(X_INFO, "motion: %d %d\n", gs->dx, gs->dy);
225 } 236 }
226 if (GETBIT(gs->type, GS_VSCROLL)) { 237 if (GETBIT(gs->type, GS_VSCROLL)) {
227 int vstep = 0.03 * (caps->abs_position_y.maximum -
228 caps->abs_position_y.minimum);
229 vscroll += gs->dy; 238 vscroll += gs->dy;
230 while (vscroll > vstep) { 239 while (vscroll > vstep) {
231 tickle_button(local, 5); 240 tickle_button(local, 5);
@@ -238,8 +247,6 @@ static void handle_gestures(LocalDevicePtr local,
238 xf86Msg(X_INFO, "vscroll: %d\n", gs->dy); 247 xf86Msg(X_INFO, "vscroll: %d\n", gs->dy);
239 } 248 }
240 if (GETBIT(gs->type, GS_HSCROLL)) { 249 if (GETBIT(gs->type, GS_HSCROLL)) {
241 int hstep = 0.1 * (caps->abs_position_x.maximum -
242 caps->abs_position_x.minimum);
243 hscroll += gs->dx; 250 hscroll += gs->dx;
244 while (hscroll > hstep) { 251 while (hscroll > hstep) {
245 tickle_button(local, 6); 252 tickle_button(local, 6);